func WrapContext(p unsafe.Pointer) *Context {
	return wrapContext((*C.cairo_t)(p))
}
Wrap a C cairo_t* found from some external source as a *Context.  The Go side will destroy the reference when it's no longer used.
package cairo
import (
	"fmt"
	"io"
	"runtime"
	"unsafe"
)
import "C"
func (s Status) Error() string {
	return C.GoString(C.cairo_status_to_string(C.cairo_status_t(s)))
}
func (surface *Surface) WriteToPNG(w io.Writer) error {
	data := writeClosure{w: w}
	key := goPointers.put(data)
	status := C.cairo_surface_write_to_png_stream((*C.cairo_surface_t)(surface.Ptr),
		(C.cairo_write_func_t)(unsafe.Pointer(C.gocairo_write_func)),
		unsafe.Pointer(&key))
	goPointers.clear(key)
	return Status(status).toError()
}
func ImageSurfaceCreateFromPNGStream(r io.Reader) (*ImageSurface, error) {
	data := readClosure{r: r}
	key := goPointers.put(data)
	surf := &ImageSurface{wrapSurface(C.cairo_image_surface_create_from_png_stream(
		(C.cairo_read_func_t)(unsafe.Pointer(C.gocairo_read_func)),
		unsafe.Pointer(&key)))}
	goPointers.clear(key)
	return surf, surf.status()
}
func (p *Path) Iter() *PathIter {
	return &PathIter{path: p, i: 0}
}
type PathIter struct {
	path *Path
	i    C.int
}
func (pi *PathIter) Next() *PathSegment {
	if pi.i >= pi.path.Ptr.num_data {
		return nil
	}
	dataArray := (*[1 << 30]C.cairo_path_data_t)(unsafe.Pointer(pi.path.Ptr.data))
	seg, ofs := decodePathSegment(unsafe.Pointer(&dataArray[pi.i]))
	pi.i += C.int(ofs)
	return seg
}
type ImageSurface struct {
	*Surface
}
type RecordingSurface struct {
	*Surface
}
type SurfaceObserver struct {
	*Surface
}
type ToyFontFace struct {
	*FontFace
}
type MeshPattern struct {
	*Pattern
}
type SVGSurface struct {
	*Surface
}
type XlibSurface struct {
	*Surface
}
type XlibDevice struct {
	*Device
}
func Version() int {
	ret := int(C.cairo_version())
	return ret
}
func VersionString() string {
	ret := C.GoString(C.cairo_version_string())
	return ret
}
type Context struct {
	Ptr *C.cairo_t
}
func freeContext(obj *Context) {
	C.cairo_destroy(obj.Ptr)
}
func wrapContext(p *C.cairo_t) *Context {
	ret := &Context{p}
	runtime.SetFinalizer(ret, freeContext)
	return ret
}