Exemple #1
0
// 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
}
Exemple #2
0
//CreateSimilar is documented in the Surface interface.
//with e.
//For example, the new surface will have the same fallback resolution and font
//options as e.
//Generally, the new surface will also use the same backend as e, unless that
//is not possible for some reason.
//
//Initially the contents of the returned surface are all 0 (transparent if contents
//have transparency, black otherwise.)
//
//Originally cairo_surface_create_similar.
func (e *XtensionSurface) CreateSimilar(c Content, w, h int) (Surface, error) {
	s := C.cairo_surface_create_similar(e.s, c.c(), C.int(w), C.int(h))
	o := NewXtensionSurface(s)
	return o, o.Err()
}