示例#1
0
文件: cairo.go 项目: raichu/gotk3
// CreateSimilar is a wrapper around cairo_surface_create_similar().
func (v *Surface) CreateSimilar(content Content, width, height int) *Surface {
	c := C.cairo_surface_create_similar(v.native(),
		C.cairo_content_t(content), C.int(width), C.int(height))
	s := wrapSurface(c)
	runtime.SetFinalizer(s, (*Surface).destroy)
	return s
}
示例#2
0
//New creates a new recording surface.
//
//If extents.Empty() is true, the recording surface is unbounded.
//
//Originally cairo_recording_surface_create.
func New(content cairo.Content, extents cairo.Rectangle) Surface {
	con := C.cairo_content_t(content)
	extents = extents.Canon()
	var s *C.cairo_surface_t
	if extents.Empty() {
		s = C.cairo_recording_surface_create(con, nil)
	} else {
		r := C.cairo_rectangle_t{
			x:      C.double(extents.Min.X),
			y:      C.double(extents.Min.Y),
			width:  C.double(extents.Dx()),
			height: C.double(extents.Dy()),
		}
		s = C.cairo_recording_surface_create(con, &r)
	}
	return cNew(s, extents)
}
示例#3
0
func (self *Surface) PushGroupWithContent(content Content) {
	C.cairo_push_group_with_content(self.context, C.cairo_content_t(content))
}
示例#4
0
文件: cairo.go 项目: raichu/gotk3
// PushGroupWithContent is a wrapper around cairo_push_group_with_content().
func (v *Context) PushGroupWithContent(content Content) {
	C.cairo_push_group_with_content(v.native(), C.cairo_content_t(content))
}
示例#5
0
package cairo

/*
#include <cairo.h>
#include <stdlib.h>
*/
import "C"

var (
	// Content
	CONTENT_COLOR       = C.cairo_content_t(C.CAIRO_CONTENT_COLOR)
	CONTENT_ALPHA       = C.cairo_content_t(C.CAIRO_CONTENT_ALPHA)
	CONTENT_COLOR_ALPHA = C.cairo_content_t(C.CAIRO_CONTENT_COLOR_ALPHA)
)
示例#6
0
//NewSurface creates a script surface that records to d.
//
//Originally cairo_script_surface_create.
func (d Device) NewSurface(content cairo.Content, width, height float64) (Surface, error) {
	c := C.cairo_content_t(content)
	w, h := C.double(width), C.double(height)
	return cNewSurf(C.cairo_script_surface_create(d.XtensionRaw(), c, w, h))
}
示例#7
0
func (con Content) c() C.cairo_content_t {
	return C.cairo_content_t(con)
}