1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-11-29 23:07:40 +02:00

Fix the way the dpr processing option affects offsets and paddings

This commit is contained in:
DarthSim
2023-04-16 20:20:44 +03:00
parent ee0cb9feda
commit 2c28252966
14 changed files with 101 additions and 44 deletions

View File

@@ -434,6 +434,23 @@ func (img *Image) GetIntSliceDefault(name string, def []int) ([]int, error) {
return img.GetIntSlice(name)
}
func (img *Image) GetDouble(name string) (float64, error) {
var d C.double
if C.vips_image_get_double(img.VipsImage, cachedCString(name), &d) != 0 {
return 0, Error()
}
return float64(d), nil
}
func (img *Image) GetDoubleDefault(name string, def float64) (float64, error) {
if C.vips_image_get_typeof(img.VipsImage, cachedCString(name)) == 0 {
return def, nil
}
return img.GetDouble(name)
}
func (img *Image) GetBlob(name string) ([]byte, error) {
var (
tmp unsafe.Pointer
@@ -458,6 +475,10 @@ func (img *Image) SetIntSlice(name string, value []int) {
C.vips_image_set_array_int_go(img.VipsImage, cachedCString(name), &in[0], C.int(len(value)))
}
func (img *Image) SetDouble(name string, value float64) {
C.vips_image_set_double(img.VipsImage, cachedCString(name), C.double(value))
}
func (img *Image) SetBlob(name string, value []byte) {
defer runtime.KeepAlive(value)
C.vips_image_set_blob_copy(img.VipsImage, cachedCString(name), unsafe.Pointer(&value[0]), C.size_t(len(value)))