refactor: bindings

This commit is contained in:
Tomas Aparicio 2015-04-06 13:25:01 +02:00
parent d6f8ad617b
commit 206a1efc66
6 changed files with 129 additions and 47 deletions

View file

@ -6,8 +6,6 @@ package bimg
*/
import "C"
import ()
type ImageSize struct {
Width int
Height int
@ -16,9 +14,10 @@ type ImageSize struct {
type ImageMetadata struct {
Orientation int
Alpha bool
Channels int
Profile bool
Space int
Type string
Space string
Size ImageSize
}
@ -43,12 +42,19 @@ func Metadata(buf []byte) (ImageMetadata, error) {
}
defer C.g_object_unref(C.gpointer(image))
size := ImageSize{
Width: int(image.Xsize),
Height: int(image.Ysize),
}
metadata := ImageMetadata{
Type: getImageTypeName(imageType),
Size: ImageSize{
Width: int(image.Xsize),
Height: int(image.Ysize),
},
Orientation: vipsExifOrientation(image),
Alpha: vipsHasAlpha(image),
Profile: vipsHasProfile(image),
Space: vipsSpace(image),
Channels: vipsImageBands(image),
Type: getImageTypeName(imageType),
Size: size,
}
return metadata, nil