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 }
// reference is a wrapper around cairo_surface_reference(). func (v *Surface) reference() { v.surface = C.cairo_surface_reference(v.native()) }
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) }
//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) }