mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-08 23:18:19 -07:00
feat(#26): support zoom. several refactors and fixes
This commit is contained in:
parent
e603ddd10a
commit
58b2be80a5
7 changed files with 62 additions and 16 deletions
17
vips.go
17
vips.go
|
|
@ -76,7 +76,7 @@ func VipsDebug() {
|
|||
C.im__print_all()
|
||||
}
|
||||
|
||||
// Get the allocated memory by vips in bytes
|
||||
// Get memory info stats from vips
|
||||
func VipsMemory() VipsMemoryInfo {
|
||||
return VipsMemoryInfo{
|
||||
Memory: int64(C.vips_tracked_get_mem()),
|
||||
|
|
@ -109,14 +109,25 @@ func vipsFlip(image *C.struct__VipsImage, direction Direction) (*C.struct__VipsI
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func vipsZoom(image *C.struct__VipsImage, zoom int) (*C.struct__VipsImage, error) {
|
||||
var out *C.struct__VipsImage
|
||||
defer C.g_object_unref(C.gpointer(image))
|
||||
|
||||
err := C.vips_zoom_bridge(image, &out, C.int(zoom), C.int(zoom))
|
||||
if err != 0 {
|
||||
return nil, catchVipsError()
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func vipsInsert(image *C.struct__VipsImage, sub *C.struct__VipsImage, left, top int) (*C.struct__VipsImage, error) {
|
||||
var out *C.struct__VipsImage
|
||||
var cache *C.struct__VipsImage
|
||||
|
||||
defer C.g_object_unref(C.gpointer(image))
|
||||
defer C.g_object_unref(C.gpointer(sub))
|
||||
|
||||
err = C.vips_insert_bridge(image, sub, &out, C.int(left), C.int(top))
|
||||
err := C.vips_insert_bridge(image, sub, &out, C.int(left), C.int(top))
|
||||
if err != 0 {
|
||||
return nil, catchVipsError()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue