(name string)
| 470 | } |
| 471 | |
| 472 | func (img *Image) GetIntSlice(name string) ([]int, error) { |
| 473 | var ptr unsafe.Pointer |
| 474 | size := C.int(0) |
| 475 | |
| 476 | if C.vips_image_get_array_int_go(img.VipsImage, cachedCString(name), (**C.int)(unsafe.Pointer(&ptr)), &size) != 0 { |
| 477 | return nil, Error() |
| 478 | } |
| 479 | |
| 480 | if size == 0 { |
| 481 | return []int{}, nil |
| 482 | } |
| 483 | |
| 484 | cOut := (*[math.MaxInt32]C.int)(ptr)[:int(size):int(size)] |
| 485 | out := make([]int, int(size)) |
| 486 | |
| 487 | for i, el := range cOut { |
| 488 | out[i] = int(el) |
| 489 | } |
| 490 | |
| 491 | return out, nil |
| 492 | } |
| 493 | |
| 494 | func (img *Image) GetIntSliceDefault(name string, def []int) ([]int, error) { |
| 495 | if C.vips_image_get_typeof(img.VipsImage, cachedCString(name)) == 0 { |
no test coverage detected