// Code generated by cmd/cgo; DO NOT EDIT.

//line /home/josie/.cache/paru/clone/wiiudownloader/src/pkg/mod/github.com/gotk3/gotk3@v0.6.5-0.20240618185848-ff349ae13f56/cairo/pattern.go:1:1
package cairo

// #include <stdlib.h>
// #include <cairo.h>
// #include <cairo-gobject.h>
import _ "unsafe"

import (
	"runtime"
	"unsafe"

	"github.com/gotk3/gotk3/glib"
)

//--------------------------------------------[ cairo_pattern_t  ==  Pattern ]--

// Filter is a representation of Cairo's cairo_filter_t.
type Filter int

const (
	FILTER_FAST     Filter = ( /*line :21:27*/_Ciconst_CAIRO_FILTER_FAST /*line :21:45*/)
	FILTER_GOOD     Filter = ( /*line :22:27*/_Ciconst_CAIRO_FILTER_GOOD /*line :22:45*/)
	FILTER_BEST     Filter = ( /*line :23:27*/_Ciconst_CAIRO_FILTER_BEST /*line :23:45*/)
	FILTER_NEAREST  Filter = ( /*line :24:27*/_Ciconst_CAIRO_FILTER_NEAREST /*line :24:48*/)
	FILTER_BILINEAR Filter = ( /*line :25:27*/_Ciconst_CAIRO_FILTER_BILINEAR /*line :25:49*/)
	FILTER_GAUSSIAN Filter = ( /*line :26:27*/_Ciconst_CAIRO_FILTER_GAUSSIAN /*line :26:49*/)
)

func marshalFilter(p uintptr) (interface{}, error) {
	c := ( /*line :30:7*/_Cfunc_g_value_get_enum /*line :30:24*/)((* /*line :30:28*/_Ctype_GValue /*line :30:36*/)(unsafe.Pointer(p)))
	return Filter(c), nil
}

// Pattern is a representation of Cairo's cairo_pattern_t.
type Pattern struct {
	pattern * /*line :36:11*/_Ctype_cairo_pattern_t /*line :36:28*/
}

// NewPatternFromRGB is a wrapper around cairo_pattern_create_rgb().
func NewPatternFromRGB(red, green, blue float64) (*Pattern, error) {
	c := ( /*line :41:7*/_Cfunc_cairo_pattern_create_rgb /*line :41:32*/)( /*line :41:34*/_Ctype_double /*line :41:42*/(red),  /*line :41:49*/_Ctype_double /*line :41:57*/(green),  /*line :41:66*/_Ctype_double /*line :41:74*/(blue))
	return newPatternFromNative(c)
}

// NewPatternFromRGBA is a wrapper around cairo_pattern_create_rgba().
func NewPatternFromRGBA(red, green, blue, alpha float64) (*Pattern, error) {
	c := ( /*line :47:7*/_Cfunc_cairo_pattern_create_rgba /*line :47:33*/)( /*line :47:35*/_Ctype_double /*line :47:43*/(red),  /*line :47:50*/_Ctype_double /*line :47:58*/(green),  /*line :47:67*/_Ctype_double /*line :47:75*/(blue),  /*line :47:83*/_Ctype_double /*line :47:91*/(alpha))
	return newPatternFromNative(c)
}

// NewPatternForSurface is a wrapper around cairo_pattern_create_for_surface().
func NewPatternForSurface(s *Surface) (*Pattern, error) {
	c := func() *_Ctype_struct__cairo_pattern{ _cgo0 := /*line :53:42*/s.native(); _cgoCheckPointer(_cgo0, nil); return /*line :53:53*/_Cfunc_cairo_pattern_create_for_surface(_cgo0); }()
	return newPatternFromNative(c)
}

// NewPatternLinear is a wrapper around cairo_pattern_create_linear().
func NewPatternLinear(x0, y0, x1, y1 float64) (*Pattern, error) {
	c := ( /*line :59:7*/_Cfunc_cairo_pattern_create_linear /*line :59:35*/)( /*line :59:37*/_Ctype_double /*line :59:45*/(x0),  /*line :59:51*/_Ctype_double /*line :59:59*/(y0),  /*line :59:65*/_Ctype_double /*line :59:73*/(x1),  /*line :59:79*/_Ctype_double /*line :59:87*/(y1))
	return newPatternFromNative(c)
}

// NewPatternRadial is a wrapper around cairo_pattern_create_radial().
func NewPatternRadial(x0, y0, r0, x1, y1, r1 float64) (*Pattern, error) {
	c := ( /*line :65:7*/_Cfunc_cairo_pattern_create_radial /*line :65:35*/)( /*line :65:37*/_Ctype_double /*line :65:45*/(x0),  /*line :65:51*/_Ctype_double /*line :65:59*/(y0),  /*line :65:65*/_Ctype_double /*line :65:73*/(r0),
		 /*line :66:3*/_Ctype_double /*line :66:11*/(x1),  /*line :66:17*/_Ctype_double /*line :66:25*/(y1),  /*line :66:31*/_Ctype_double /*line :66:39*/(r1))
	return newPatternFromNative(c)
}

func newPatternFromNative(patternNative * /*line :70:42*/_Ctype_cairo_pattern_t /*line :70:59*/) (*Pattern, error) {
	ptr := wrapPattern(patternNative)
	e := ptr.Status().ToError()
	if e != nil {
		return nil, e
	}
	runtime.SetFinalizer(ptr, func(v *Pattern) { glib.FinalizerStrategy(v.destroy) })
	return ptr, nil
}

// native returns a pointer to the underlying cairo_pattern_t.
func (v *Pattern) native() * /*line :81:29*/_Ctype_cairo_pattern_t /*line :81:46*/ {
	if v == nil {
		return nil
	}
	return v.pattern
}

// Native returns a pointer to the underlying cairo_pattern_t.
func (v *Pattern) Native() uintptr {
	return uintptr(unsafe.Pointer(v.native()))
}

func marshalPattern(p uintptr) (interface{}, error) {
	c := ( /*line :94:7*/_Cfunc_g_value_get_boxed /*line :94:25*/)((* /*line :94:29*/_Ctype_GValue /*line :94:37*/)(unsafe.Pointer(p)))
	pattern := (* /*line :95:15*/_Ctype_cairo_pattern_t /*line :95:32*/)(unsafe.Pointer(c))
	return wrapPattern(pattern), nil
}

func wrapPattern(pattern * /*line :99:27*/_Ctype_cairo_pattern_t /*line :99:44*/) *Pattern {
	return &Pattern{pattern}
}

// reference is a wrapper around cairo_pattern_reference().
func (v *Pattern) reference() {
	v.pattern = func() *_Ctype_struct__cairo_pattern{ _cgo0 := /*line :105:40*/v.native(); _cgoCheckPointer(_cgo0, nil); return /*line :105:51*/_Cfunc_cairo_pattern_reference(_cgo0); }()
}

// destroy is a wrapper around cairo_pattern_destroy().
func (v *Pattern) destroy() {
	func() { _cgo0 := /*line :110:26*/v.native(); _cgoCheckPointer(_cgo0, nil); /*line :110:37*/_Cfunc_cairo_pattern_destroy(_cgo0); }()
}

// Status is a wrapper around cairo_pattern_status().
func (v *Pattern) Status() Status {
	c := func() _Ctype_cairo_status_t{ _cgo0 := /*line :115:30*/v.native(); _cgoCheckPointer(_cgo0, nil); return /*line :115:41*/_Cfunc_cairo_pattern_status(_cgo0); }()
	return Status(c)
}

// AddColorStopRGB is a wrapper around cairo_pattern_add_color_stop_rgb().
func (v *Pattern) AddColorStopRGB(offset, red, green, blue float64) error {
	func() { _cgo0 := /*line :121:37*/v.native(); var _cgo1 _Ctype_double = _Ctype_double /*line :121:57*/(offset); var _cgo2 _Ctype_double = _Ctype_double /*line :122:11*/(red); var _cgo3 _Ctype_double = _Ctype_double /*line :122:26*/(green); var _cgo4 _Ctype_double = _Ctype_double /*line :122:43*/(blue); _cgoCheckPointer(_cgo0, nil); /*line :122:50*/_Cfunc_cairo_pattern_add_color_stop_rgb(_cgo0, _cgo1, _cgo2, _cgo3, _cgo4); }()
	return v.Status().ToError()
}

// AddColorStopRGBA is a wrapper around cairo_pattern_add_color_stop_rgba().
func (v *Pattern) AddColorStopRGBA(offset, red, green, blue, alpha float64) error {
	func() { _cgo0 := /*line :128:38*/v.native(); var _cgo1 _Ctype_double = _Ctype_double /*line :128:58*/(offset); var _cgo2 _Ctype_double = _Ctype_double /*line :129:11*/(red); var _cgo3 _Ctype_double = _Ctype_double /*line :129:26*/(green); var _cgo4 _Ctype_double = _Ctype_double /*line :129:43*/(blue); var _cgo5 _Ctype_double = _Ctype_double /*line :129:59*/(alpha); _cgoCheckPointer(_cgo0, nil); /*line :129:67*/_Cfunc_cairo_pattern_add_color_stop_rgba(_cgo0, _cgo1, _cgo2, _cgo3, _cgo4, _cgo5); }()
	return v.Status().ToError()
}

// PatternSetFilter is a wrapper around cairo_pattern_set_filter().
func (v *Pattern) PatternSetFilter(filter Filter) {
	func() { _cgo0 := /*line :135:29*/v.native(); var _cgo1 _Ctype_cairo_filter_t = _Ctype_cairo_filter_t /*line :135:57*/(filter); _cgoCheckPointer(_cgo0, nil); /*line :135:66*/_Cfunc_cairo_pattern_set_filter(_cgo0, _cgo1); }()
}

// PatternGetFilter is a wrapper around cairo_pattern_get_filter().
func (v *Pattern) PatternGetFilter() Filter {
	return Filter(func() _Ctype_cairo_filter_t{ _cgo0 := /*line :140:43*/v.native(); _cgoCheckPointer(_cgo0, nil); return /*line :140:54*/_Cfunc_cairo_pattern_get_filter(_cgo0); }())
}
