示例#1
0
// CreateImageSurface is a wrapper around cairo_image_surface_create().
func CreateImageSurface(format Format, width, height int) *Surface {
	c := C.cairo_image_surface_create(C.cairo_format_t(format),
		C.int(width), C.int(height))
	s := wrapSurface(c)
	runtime.SetFinalizer(s, (*Surface).destroy)
	return s
}
示例#2
0
func NewSurface(format Format, width, height int) *Surface {
	s := C.cairo_image_surface_create(C.cairo_format_t(format), C.int(width), C.int(height))
	return &Surface{surface: s, context: C.cairo_create(s)}
}
示例#3
0
文件: cairo.go 项目: zvin/gocairo
func NewSurface(format Format, width, height int) *Surface {
	surface := new(Surface)
	surface.surface = C.cairo_image_surface_create(C.cairo_format_t(format), C.int(width), C.int(height))
	surface.context = C.cairo_create(surface.surface)
	return surface
}
示例#4
0
文件: cairo.go 项目: mantyr/go-cairo
func (self Format) StrideForWidth(width int) int {
	return int(C.cairo_format_stride_for_width(C.cairo_format_t(self), C.int(width)))
}
示例#5
0
func (f Format) c() C.cairo_format_t {
	return C.cairo_format_t(f)
}