forked from davidbyttow/govips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.go
37 lines (28 loc) · 933 Bytes
/
create.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package vips
// #include "create.h"
import "C"
// https://libvips.github.io/libvips/API/current/libvips-create.html#vips-xyz
func vipsXYZ(width int, height int) (*C.VipsImage, error) {
var out *C.VipsImage
if err := C.xyz(&out, C.int(width), C.int(height)); err != 0 {
return nil, handleImageError(out)
}
return out, nil
}
// http://libvips.github.io/libvips/API/current/libvips-create.html#vips-black
func vipsBlack(width int, height int) (*C.VipsImage, error) {
var out *C.VipsImage
if err := C.black(&out, C.int(width), C.int(height)); err != 0 {
return nil, handleImageError(out)
}
return out, nil
}
// https://libvips.github.io/libvips/API/current/libvips-create.html#vips-identity
func vipsIdentity(ushort bool) (*C.VipsImage, error) {
var out *C.VipsImage
ushortInt := C.int(boolToInt(ushort))
if err := C.identity(&out, ushortInt); err != 0 {
return nil, handleImageError(out)
}
return out, nil
}