Exemplo n.º 1
0
func cNew(s *C.cairo_surface_t) (cairo.Surface, error) {
	//Note that if the surface was created with a Writer we have no way of
	//getting it here but that's okay as long as the original reference lives on.
	S := Surface{
		XtensionVectorSurface: cairo.NewXtensionVectorSurface(s),
	}
	return S, S.Err()
}
Exemplo n.º 2
0
//New creates a new SVG surface that writes to writer.
//
//If writer needs to be flushed or closed, that is the responsibility
//of the caller.
//
//The parameters width and height are in the unit of a typographical point
//(1 point = 1/72 inch).
//
//Originally cairo_svg_surface_create_for_stream.
func New(w io.Writer, width, height float64) (Surface, error) {
	wp := cairo.XtensionWrapWriter(w)
	svg := C.cairo_svg_surface_create_for_stream(cairo.XtensionCairoWriteFuncT, wp, C.double(width), C.double(height))
	s := Surface{
		XtensionVectorSurface: cairo.NewXtensionVectorSurface(svg),
	}
	s.XtensionRegisterWriter(wp)
	return s, s.Err()
}