func (this *Context) CopyClipRectangleList() ([]Rectangle, Status) {
	var slice []Rectangle
	var status Status
	rl := C.cairo_copy_clip_rectangle_list(this.c())
	if rl.num_rectangles > 0 {
		var slice_header reflect.SliceHeader
		slice_header.Data = uintptr(unsafe.Pointer(rl.rectangles))
		slice_header.Len = int(rl.num_rectangles)
		slice_header.Cap = int(rl.num_rectangles)
		slice_src := *(*[]Rectangle)(unsafe.Pointer(&slice_header))
		slice = make([]Rectangle, rl.num_rectangles)
		copy(slice, slice_src)
	}
	status = Status(rl.status)
	C.cairo_rectangle_list_destroy(rl)
	return slice, status
}
cairo_rectangle_list_t;
void                cairo_rectangle_list_destroy        (cairo_rectangle_list_t *rectangle_list);
cairo_rectangle_list_t * cairo_copy_clip_rectangle_list (cairo_t *cr);
package cairo
import "C"
import "runtime"
import "strings"
import "reflect"
import "unsafe"
import "io"
import (
	"gobject/gobject-2.0"
)
func (*Context) GetStaticType() gobject.Type {
	return gobject.Type(C.cairo_gobject_context_get_type())
}
func ContextGetType() gobject.Type { return (*Context)(nil).GetStaticType() }
func (*Pattern) GetStaticType() gobject.Type {
	return gobject.Type(C.cairo_gobject_pattern_get_type())
}
func PatternGetType() gobject.Type { return (*Pattern)(nil).GetStaticType() }
func (*Surface) GetStaticType() gobject.Type {
	return gobject.Type(C.cairo_gobject_surface_get_type())
}
func SurfaceGetType() gobject.Type { return (*Surface)(nil).GetStaticType() }
func (*ScaledFont) GetStaticType() gobject.Type {
	return gobject.Type(C.cairo_gobject_scaled_font_get_type())
}
func ScaledFontGetType() gobject.Type { return (*ScaledFont)(nil).GetStaticType() }
func (*FontFace) GetStaticType() gobject.Type {
	return gobject.Type(C.cairo_gobject_font_face_get_type())
}
func FontFaceGetType() gobject.Type { return (*FontFace)(nil).GetStaticType() }
func (*FontOptions) GetStaticType() gobject.Type {
	return gobject.Type(C.cairo_gobject_font_options_get_type())
}
func FontOptionsGetType() gobject.Type { return (*FontOptions)(nil).GetStaticType() }
func (*Region) GetStaticType() gobject.Type {
	return gobject.Type(C.cairo_gobject_region_get_type())
}
func RegionGetType() gobject.Type { return (*Region)(nil).GetStaticType() }
func cairo_marshaler(value *gobject.Value, t reflect.Type) (reflect.Value, bool) {
	if !strings.HasSuffix(t.Elem().PkgPath(), "cairo-1.0") {
		return reflect.Value{}, false
	}
	out := reflect.New(t)
	st, ok := out.Elem().Interface().(gobject.StaticTyper)
	if !ok {
		return reflect.Value{}, false
	}
	gtypedst := st.GetStaticType()
	var dst gobject.Value
	dst.Init(gtypedst)
	ok = dst.Transform(value)
	if !ok {
		panic("GValue is not transformable to " + t.String())
	}
	defer dst.Unset()
	switch gtypedst {
	case ContextGetType():
		*(*unsafe.Pointer)(unsafe.Pointer(out.Pointer())) = ContextWrap(dst.GetBoxed(), true)
	case PatternGetType():
		*(*unsafe.Pointer)(unsafe.Pointer(out.Pointer())) = PatternWrap(dst.GetBoxed(), true)
	case SurfaceGetType():
		*(*unsafe.Pointer)(unsafe.Pointer(out.Pointer())) = SurfaceWrap(dst.GetBoxed(), true)
	case FontOptionsGetType():
		*(*unsafe.Pointer)(unsafe.Pointer(out.Pointer())) = FontOptionsWrap(dst.GetBoxed())
	case RegionGetType():
		*(*unsafe.Pointer)(unsafe.Pointer(out.Pointer())) = RegionWrap(dst.GetBoxed(), true)
	case FontFaceGetType():
		*(*unsafe.Pointer)(unsafe.Pointer(out.Pointer())) = FontFaceWrap(dst.GetBoxed(), true)
	case ScaledFontGetType():
		*(*unsafe.Pointer)(unsafe.Pointer(out.Pointer())) = ScaledFontWrap(dst.GetBoxed(), true)
	default:
		return reflect.Value{}, false
	}
	return out.Elem(), true
}
func init() {
	gobject.CairoMarshaler = cairo_marshaler
}
var go_repr_cookie C.cairo_user_data_key_t
type RectangleInt struct {
	X      int32
	Y      int32
	Width  int32
	Height int32
}
func (this *RectangleInt) c() *C.cairo_rectangle_int_t {
	return (*C.cairo_rectangle_int_t)(unsafe.Pointer(this))
}
type Status int
const (
	StatusSuccess                Status = C.CAIRO_STATUS_SUCCESS
	StatusNoMemory               Status = C.CAIRO_STATUS_NO_MEMORY
	StatusInvalidRestore         Status = C.CAIRO_STATUS_INVALID_RESTORE
	StatusInvalidPopGroup        Status = C.CAIRO_STATUS_INVALID_POP_GROUP
	StatusNoCurrentPoint         Status = C.CAIRO_STATUS_NO_CURRENT_POINT
	StatusInvalidMatrix          Status = C.CAIRO_STATUS_INVALID_MATRIX
	StatusInvalidStatus          Status = C.CAIRO_STATUS_INVALID_STATUS
	StatusNullPointer            Status = C.CAIRO_STATUS_NULL_POINTER
	StatusInvalidString          Status = C.CAIRO_STATUS_INVALID_STRING
	StatusInvalidPathData        Status = C.CAIRO_STATUS_INVALID_PATH_DATA
	StatusReadError              Status = C.CAIRO_STATUS_READ_ERROR
	StatusWriteError             Status = C.CAIRO_STATUS_WRITE_ERROR
	StatusSurfaceFinished        Status = C.CAIRO_STATUS_SURFACE_FINISHED
	StatusSurfaceTypeMismatch    Status = C.CAIRO_STATUS_SURFACE_TYPE_MISMATCH
	StatusPatternTypeMismatch    Status = C.CAIRO_STATUS_PATTERN_TYPE_MISMATCH
	StatusInvalidContent         Status = C.CAIRO_STATUS_INVALID_CONTENT
	StatusInvalidFormat          Status = C.CAIRO_STATUS_INVALID_FORMAT
	StatusInvalidVisual          Status = C.CAIRO_STATUS_INVALID_VISUAL
	StatusFileNotFound           Status = C.CAIRO_STATUS_FILE_NOT_FOUND
	StatusInvalidDash            Status = C.CAIRO_STATUS_INVALID_DASH
	StatusInvalidDscComment      Status = C.CAIRO_STATUS_INVALID_DSC_COMMENT
	StatusInvalidIndex           Status = C.CAIRO_STATUS_INVALID_INDEX
	StatusClipNotRepresentable   Status = C.CAIRO_STATUS_CLIP_NOT_REPRESENTABLE
	StatusTempFileError          Status = C.CAIRO_STATUS_TEMP_FILE_ERROR
	StatusInvalidStride          Status = C.CAIRO_STATUS_INVALID_STRIDE
	StatusFontTypeMismatch       Status = C.CAIRO_STATUS_FONT_TYPE_MISMATCH
	StatusUserFontImmutable      Status = C.CAIRO_STATUS_USER_FONT_IMMUTABLE
	StatusUserFontError          Status = C.CAIRO_STATUS_USER_FONT_ERROR
	StatusNegativeCount          Status = C.CAIRO_STATUS_NEGATIVE_COUNT
	StatusInvalidClusters        Status = C.CAIRO_STATUS_INVALID_CLUSTERS
	StatusInvalidSlant           Status = C.CAIRO_STATUS_INVALID_SLANT
	StatusInvalidWeight          Status = C.CAIRO_STATUS_INVALID_WEIGHT
	StatusInvalidSize            Status = C.CAIRO_STATUS_INVALID_SIZE
	StatusUserFontNotImplemented Status = C.CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED
	StatusDeviceTypeMismatch     Status = C.CAIRO_STATUS_DEVICE_TYPE_MISMATCH
	StatusDeviceError            Status = C.CAIRO_STATUS_DEVICE_ERROR
	StatusLastStatus             Status = C.CAIRO_STATUS_LAST_STATUS
)
func (this Status) c() C.cairo_status_t {
	return C.cairo_status_t(this)
}
func (this Status) String() string {
	cstr := C.cairo_status_to_string(this.c())
	return C.GoString(cstr)
}
type Context struct {
	C unsafe.Pointer
}
func (this *Context) c() *C.cairo_t {
	return (*C.cairo_t)(this.C)
}
func context_finalizer(this *Context) {
	if gobject.FQueue.Push(unsafe.Pointer(this), context_finalizer2) {
		return
	}
	C.cairo_set_user_data(this.c(), &go_repr_cookie, nil, nil)
	C.cairo_destroy(this.c())
}
func context_finalizer2(this_un unsafe.Pointer) {
	this := (*Context)(this_un)
	C.cairo_set_user_data(this.c(), &go_repr_cookie, nil, nil)
	C.cairo_destroy(this.c())
}
func ContextWrap(c_un unsafe.Pointer, grab bool) unsafe.Pointer {
	if c_un == nil {
		return nil
	}
	c := (*C.cairo_t)(c_un)
	go_repr := C.cairo_get_user_data(c, &go_repr_cookie)
	if go_repr != nil {
		return unsafe.Pointer(go_repr)
	}
	context := &Context{unsafe.Pointer(c)}
	if grab {
		C.cairo_reference(c)
	}
	runtime.SetFinalizer(context, context_finalizer)
	status := C.cairo_set_user_data(c, &go_repr_cookie, unsafe.Pointer(context), nil)
	if status != C.CAIRO_STATUS_SUCCESS {
		panic("failed to set user data, out of memory?")
	}
	return unsafe.Pointer(context)
}
func NewContext(target SurfaceLike) *Context {
	return (*Context)(ContextWrap(unsafe.Pointer(C.cairo_create(target.InheritedFromCairoSurface().c())), false))
}
func (this *Context) Unref() {
	runtime.SetFinalizer(this, nil)
	C.cairo_set_user_data(this.c(), &go_repr_cookie, nil, nil)
	C.cairo_destroy(this.c())
	this.C = nil
}
func (this *Context) Status() Status {
	return Status(C.cairo_status(this.c()))
}
func (this *Context) Save() {
	C.cairo_save(this.c())
}
func (this *Context) Restore() {
	C.cairo_restore(this.c())
}
func (this *Context) GetTarget() *Surface {
	return (*Surface)(SurfaceWrap(unsafe.Pointer(C.cairo_get_target(this.c())), true))
}
func (this *Context) PushGroup() {
	C.cairo_push_group(this.c())
}
func (this *Context) PushGroupWithContent(content Content) {
	C.cairo_push_group_with_content(this.c(), content.c())
}
func (this *Context) PopGroup() *Pattern {
	return (*Pattern)(PatternWrap(unsafe.Pointer(C.cairo_pop_group(this.c())), false))
}
func (this *Context) PopGroupToSource() {
	C.cairo_pop_group_to_source(this.c())
}
func (this *Context) GetGroupTarget() *Surface {
	return (*Surface)(SurfaceWrap(unsafe.Pointer(C.cairo_get_group_target(this.c())), true))
}
func (this *Context) SetSourceRGB(r, g, b float64) {
	C.cairo_set_source_rgb(this.c(), C.double(r), C.double(g), C.double(b))
}
func (this *Context) SetSourceRGBA(r, g, b, a float64) {
	C.cairo_set_source_rgba(this.c(), C.double(r), C.double(g), C.double(b), C.double(a))
}
func (this *Context) SetSource(source PatternLike) {
	C.cairo_set_source(this.c(), source.InheritedFromCairoPattern().c())
}
func (this *Context) SetSourceSurface(surface SurfaceLike, x, y float64) {
	C.cairo_set_source_surface(this.c(), surface.InheritedFromCairoSurface().c(), C.double(x), C.double(y))
}
func (this *Context) GetSource() *Pattern {
	return (*Pattern)(PatternWrap(unsafe.Pointer(C.cairo_get_source(this.c())), true))
}
type Antialias int
const (
	AntialiasDefault  Antialias = C.CAIRO_ANTIALIAS_DEFAULT
	AntialiasNone     Antialias = C.CAIRO_ANTIALIAS_NONE
	AntialiasGray     Antialias = C.CAIRO_ANTIALIAS_GRAY
	AntialiasSubpixel Antialias = C.CAIRO_ANTIALIAS_SUBPIXEL
)
func (this Antialias) c() C.cairo_antialias_t {
	return C.cairo_antialias_t(this)
}
func (this *Context) SetAntialias(antialias Antialias) {
	C.cairo_set_antialias(this.c(), antialias.c())
}
func (this *Context) GetAntialias() Antialias {
	return Antialias(C.cairo_get_antialias(this.c()))
}
func (this *Context) SetDash(dashes []float64, offset float64) {
	var first *C.double
	if len(dashes) != 0 {
		first = (*C.double)(unsafe.Pointer(&dashes[0]))
	}
	C.cairo_set_dash(this.c(), first, C.int(len(dashes)), C.double(offset))
}
func (this *Context) GetDashCount() int {
	return int(C.cairo_get_dash_count(this.c()))
}
func (this *Context) GetDash() ([]float64, float64) {
	var first *C.double
	var offset C.double
	var dashes []float64
	count := this.GetDashCount()
	if count != 0 {
		dashes = make([]float64, count)
		first = (*C.double)(unsafe.Pointer(&dashes[0]))
	}
	C.cairo_get_dash(this.c(), first, &offset)
	return dashes, float64(offset)
}
type FillRule int
const (
	FillRuleWinding FillRule = C.CAIRO_FILL_RULE_WINDING
	FillRuleEvenOdd FillRule = C.CAIRO_FILL_RULE_EVEN_ODD
)
func (this FillRule) c() C.cairo_fill_rule_t {
	return C.cairo_fill_rule_t(this)
}
func (this *Context) SetFillRule(fill_rule FillRule) {
	C.cairo_set_fill_rule(this.c(), fill_rule.c())
}
func (this *Context) GetFillRule() FillRule {
	return FillRule(C.cairo_get_fill_rule(this.c()))
}
type LineCap int
const (
	LineCapButt   LineCap = C.CAIRO_LINE_CAP_BUTT
	LineCapRound  LineCap = C.CAIRO_LINE_CAP_ROUND
	LineCapSquare LineCap = C.CAIRO_LINE_CAP_SQUARE
)
func (this LineCap) c() C.cairo_line_cap_t {
	return C.cairo_line_cap_t(this)
}
func (this *Context) SetLineCap(line_cap LineCap) {
	C.cairo_set_line_cap(this.c(), line_cap.c())
}
func (this *Context) GetLineCap() LineCap {
	return LineCap(C.cairo_get_line_cap(this.c()))
}
type LineJoin int
const (
	LineJoinMiter LineJoin = C.CAIRO_LINE_JOIN_MITER
	LineJoinRound LineJoin = C.CAIRO_LINE_JOIN_ROUND
	LineJoinBevel LineJoin = C.CAIRO_LINE_JOIN_BEVEL
)
func (this LineJoin) c() C.cairo_line_join_t {
	return C.cairo_line_join_t(this)
}
func (this *Context) SetLineJoin(line_join LineJoin) {
	C.cairo_set_line_join(this.c(), line_join.c())
}
func (this *Context) GetLineJoin() LineJoin {
	return LineJoin(C.cairo_get_line_join(this.c()))
}
func (this *Context) SetLineWidth(width float64) {
	C.cairo_set_line_width(this.c(), C.double(width))
}
func (this *Context) GetLineWidth() float64 {
	return float64(C.cairo_get_line_width(this.c()))
}
func (this *Context) SetMiterLimit(limit float64) {
	C.cairo_set_miter_limit(this.c(), C.double(limit))
}
func (this *Context) GetMiterLimit() float64 {
	return float64(C.cairo_get_miter_limit(this.c()))
}
type Operator int
const (
	OperatorClear         Operator = C.CAIRO_OPERATOR_CLEAR
	OperatorSource        Operator = C.CAIRO_OPERATOR_SOURCE
	OperatorOver          Operator = C.CAIRO_OPERATOR_OVER
	OperatorIn            Operator = C.CAIRO_OPERATOR_IN
	OperatorOut           Operator = C.CAIRO_OPERATOR_OUT
	OperatorAtop          Operator = C.CAIRO_OPERATOR_ATOP
	OperatorDest          Operator = C.CAIRO_OPERATOR_DEST
	OperatorDestOver      Operator = C.CAIRO_OPERATOR_DEST_OVER
	OperatorDestIn        Operator = C.CAIRO_OPERATOR_DEST_IN
	OperatorDestOut       Operator = C.CAIRO_OPERATOR_DEST_OUT
	OperatorDestAtop      Operator = C.CAIRO_OPERATOR_DEST_ATOP
	OperatorXor           Operator = C.CAIRO_OPERATOR_XOR
	OperatorAdd           Operator = C.CAIRO_OPERATOR_ADD
	OperatorSaturate      Operator = C.CAIRO_OPERATOR_SATURATE
	OperatorMultiply      Operator = C.CAIRO_OPERATOR_MULTIPLY
	OperatorScreen        Operator = C.CAIRO_OPERATOR_SCREEN
	OperatorOverlay       Operator = C.CAIRO_OPERATOR_OVERLAY
	OperatorDarken        Operator = C.CAIRO_OPERATOR_DARKEN
	OperatorLighten       Operator = C.CAIRO_OPERATOR_LIGHTEN
	OperatorColorDodge    Operator = C.CAIRO_OPERATOR_COLOR_DODGE
	OperatorColorBurn     Operator = C.CAIRO_OPERATOR_COLOR_BURN
	OperatorHardLight     Operator = C.CAIRO_OPERATOR_HARD_LIGHT
	OperatorSoftLight     Operator = C.CAIRO_OPERATOR_SOFT_LIGHT
	OperatorDifference    Operator = C.CAIRO_OPERATOR_DIFFERENCE
	OperatorExclusion     Operator = C.CAIRO_OPERATOR_EXCLUSION
	OperatorHslHue        Operator = C.CAIRO_OPERATOR_HSL_HUE
	OperatorHslSaturation Operator = C.CAIRO_OPERATOR_HSL_SATURATION
	OperatorHslColor      Operator = C.CAIRO_OPERATOR_HSL_COLOR
	OperatorHslLuminosity Operator = C.CAIRO_OPERATOR_HSL_LUMINOSITY
)
func (this Operator) c() C.cairo_operator_t {
	return C.cairo_operator_t(this)
}
func (this *Context) SetOperator(op Operator) {
	C.cairo_set_operator(this.c(), op.c())
}
func (this *Context) GetOperator() Operator {
	return Operator(C.cairo_get_operator(this.c()))
}
func (this *Context) SetTolerance(tolerance float64) {
	C.cairo_set_tolerance(this.c(), C.double(tolerance))
}
func (this *Context) GetTolerance() float64 {
	return float64(C.cairo_get_tolerance(this.c()))
}
func (this *Context) Clip() {
	C.cairo_clip(this.c())
}
func (this *Context) ClipPreserve() {
	C.cairo_clip_preserve(this.c())
}
func (this *Context) ClipExtents() (x1, y1, x2, y2 float64) {
	C.cairo_clip_extents(this.c(),
		(*C.double)(unsafe.Pointer(&x1)),
		(*C.double)(unsafe.Pointer(&y1)),
		(*C.double)(unsafe.Pointer(&x2)),
		(*C.double)(unsafe.Pointer(&y2)))
	return
}
func (this *Context) InClip(x, y float64) bool {
	return C.cairo_in_clip(this.c(), C.double(x), C.double(y)) != 0
}
func (this *Context) ResetClip() {
	C.cairo_reset_clip(this.c())
}
type Rectangle struct {
	X, Y, Width, Height float64
}