Ejemplo n.º 1
0
func (c CairoContext) status() error {
	status := C.cairo_status(c.nativePointer())
	if status != 0 {
		return cairoStatusToError(status)
	}
	return nil
}
Ejemplo n.º 2
0
func NewSurfaceFromPNG(filename string) (*Surface, Status) {

	cstr := C.CString(filename)
	defer C.free(unsafe.Pointer(cstr))

	surfaceNative := C.cairo_image_surface_create_from_png(cstr)
	status := Status(C.cairo_surface_status(surfaceNative))
	if status != STATUS_SUCCESS {
		return nil, status
	}

	contextNative := C.cairo_create(surfaceNative)
	status = Status(C.cairo_status(contextNative))
	if status != STATUS_SUCCESS {
		return nil, status
	}

	surface := &Surface{
		surface: surfaceNative,
		context: contextNative,
	}

	return surface, STATUS_SUCCESS
}
Ejemplo n.º 3
0
func (self *Surface) Status() Status {
	return Status(C.cairo_status(self.context))
}
Ejemplo n.º 4
0
// Status is a wrapper around cairo_status().
func (v *Context) Status() Status {
	c := C.cairo_status(v.native())
	return Status(c)
}
Ejemplo n.º 5
0
//Err reports the current error state of c.
//
//Originally cairo_status.
func (c *Context) Err() error {
	if c.c == nil {
		return ErrInvalidLibcairoHandle
	}
	return toerr(C.cairo_status(c.c))
}
Ejemplo n.º 6
0
// gets the status of the cairo context and returns it as an error
func (g *Graphic) cairoStatus() error {
	status := C.cairo_status(g.cr)
	return statusToError(status)
}