// 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 }
//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) }
func (self *Surface) PushGroupWithContent(content Content) { C.cairo_push_group_with_content(self.context, C.cairo_content_t(content)) }
// 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)) }
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) )
//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)) }
func (con Content) c() C.cairo_content_t { return C.cairo_content_t(con) }