feat(#3, #5): support image operations

This commit is contained in:
Tomas Aparicio 2015-03-30 02:41:16 +02:00
parent 63f4b01c8d
commit 61997bc68b
7 changed files with 107 additions and 53 deletions

View file

@ -1,5 +1,11 @@
package bimg
/*
#cgo pkg-config: vips
#include "vips/vips.h"
*/
import "C"
const QUALITY = 80
type Gravity int
@ -16,6 +22,26 @@ func (i Interpolator) String() string {
return interpolations[i]
}
type Rotation struct {
angle int
}
func (a Rotation) calculate() int {
angle := a.angle
divisor := angle % 90
if divisor != 0 {
angle = a.angle - divisor
}
return angle
}
type Direction int
const (
HORIZONTAL Direction = C.VIPS_DIRECTION_HORIZONTAL
VERTICAL Direction = C.VIPS_DIRECTION_VERTICAL
)
type Options struct {
Height int
Width int
@ -23,7 +49,9 @@ type Options struct {
Enlarge bool
Extend int
Embed bool
Interpolator Interpolator
Gravity Gravity
Quality int
Rotate int
Flip Direction
Gravity Gravity
Interpolator Interpolator
}