forked from ungerik/go-cairo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cairo.go
80 lines (59 loc) · 1.04 KB
/
cairo.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Go binding for the cairo graphics library
package cairo
// #cgo pkg-config: cairo
// #include <cairo/cairo.h>
import "C"
type FontType int
// cairo_font_type_t
const (
FONT_TYPE_TOY FontType = iota
FONT_TYPE_FT
FONT_TYPE_WIN32
FONT_TYPE_QUARTZ
FONT_TYPE_USER
)
type RegionOverlap int
const (
REGION_OVERLAP_IN RegionOverlap = iota
REGION_OVERLAP_OUT
REGION_OVERLAP_PART
)
type DeviceType int
const (
DEVICE_TYPE_DRM DeviceType = iota
DEVICE_TYPE_GL
DEVICE_TYPE_SCRIPT
DEVICE_TYPE_XCB
DEVICE_TYPE_XLIB
DEVICE_TYPE_XML
)
const (
MIME_TYPE_JPEG = "image/jpeg"
MIME_TYPE_PNG = "image/png"
MIME_TYPE_JP2 = "image/jp2"
MIME_TYPE_URI = "text/x-uri"
)
type FontFace struct {
// todo
}
type FontOptions struct {
// todo
}
type ScaledFont struct {
// todo
}
type Device struct {
// todo
}
func Version() int {
return int(C.cairo_version())
}
func VersionString() string {
return C.GoString(C.cairo_version_string())
}
func cairobool2bool(flag C.cairo_bool_t) bool {
if int(flag) > 0 {
return true
}
return false;
}