Пример #1
0
func cNewSurfacePattern(p *C.cairo_pattern_t) (Pattern, error) {
	var s *C.cairo_surface_t
	C.cairo_pattern_get_surface(p, &s)
	C.cairo_surface_reference(s) //returned surface does not up libcairo refcount
	S, err := XtensionRevivifySurface(p)
	if err != nil {
		return nil, err
	}
	P := SurfacePattern{
		XtensionPattern: XtensionNewPattern(p),
		s:               S,
	}
	return P, nil
}
Пример #2
0
// reference is a wrapper around cairo_surface_reference().
func (v *Surface) reference() {
	v.surface = C.cairo_surface_reference(v.native())
}
Пример #3
0
func registerImageSurface(m Surface, from *C.cairo_surface_t) {
	mismux.Lock()
	defer mismux.Unlock()
	//let original from be collected, we just need a general handle
	mis[m.id()] = C.cairo_surface_reference(from)
}
Пример #4
0
//GroupTarget returns the current destination surface for c.
//If there have been no calls to PushGroup/PushGroupWithContent,
//this is equivalent to Target.
//Otherwise,
//Originally cairo_get_group_target.
func (c *Context) GroupTarget() (Surface, error) {
	s := C.cairo_get_group_target(c.c)
	s = C.cairo_surface_reference(s)
	return XtensionRevivifySurface(s)
}