mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-14 09:55:56 -07:00
feat(#20): support flop operation (interface broken, sorry im still beta)
This commit is contained in:
parent
2d17baca0d
commit
414fe40c91
5 changed files with 25 additions and 7 deletions
14
resize.go
14
resize.go
|
|
@ -160,10 +160,11 @@ func extractImage(image *C.struct__VipsImage, o Options) (*C.struct__VipsImage,
|
|||
|
||||
func rotateImage(image *C.struct__VipsImage, o Options) (*C.struct__VipsImage, error) {
|
||||
var err error
|
||||
var direction Direction = -1
|
||||
|
||||
rotation, flip := calculateRotationAndFlip(image, o.Rotate)
|
||||
if flip {
|
||||
o.Flip = HORIZONTAL
|
||||
o.Flip = flip
|
||||
}
|
||||
if rotation > D0 && o.Rotate == 0 {
|
||||
o.Rotate = rotation
|
||||
|
|
@ -172,8 +173,15 @@ func rotateImage(image *C.struct__VipsImage, o Options) (*C.struct__VipsImage, e
|
|||
if o.Rotate > 0 {
|
||||
image, err = vipsRotate(image, getAngle(o.Rotate))
|
||||
}
|
||||
if o.Flip > 0 {
|
||||
image, err = vipsFlip(image, o.Flip)
|
||||
|
||||
if o.Flip {
|
||||
direction = HORIZONTAL
|
||||
} else if o.Flop {
|
||||
direction = VERTICAL
|
||||
}
|
||||
|
||||
if direction != -1 {
|
||||
image, err = vipsFlip(image, direction)
|
||||
}
|
||||
|
||||
return image, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue