@@ -158,6 +158,11 @@ func wrapContext(p *C.cairo_t) *Context {
158158 return ret
159159}
160160
161+ // 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.
162+ func WrapContext (p unsafe.Pointer ) * Context {
163+ return wrapContext ((* C .cairo_t )(p ))
164+ }
165+
161166// Construct a Context from a C cairo_t* found from some exernal source. It is the caller's responsibility to ensure the pointer lives.
162167func BorrowContext (p unsafe.Pointer ) * Context {
163168 return & Context {(* C .cairo_t )(p )}
@@ -179,6 +184,11 @@ func wrapSurface(p *C.cairo_surface_t) *Surface {
179184 return ret
180185}
181186
187+ // Wrap a C cairo_surface_t* found from some external source as a *Surface. The Go side will destroy the reference when it's no longer used.
188+ func WrapSurface (p unsafe.Pointer ) * Surface {
189+ return wrapSurface ((* C .cairo_surface_t )(p ))
190+ }
191+
182192// Construct a Surface from a C cairo_surface_t* found from some exernal source. It is the caller's responsibility to ensure the pointer lives.
183193func BorrowSurface (p unsafe.Pointer ) * Surface {
184194 return & Surface {(* C .cairo_surface_t )(p )}
@@ -200,6 +210,11 @@ func wrapDevice(p *C.cairo_device_t) *Device {
200210 return ret
201211}
202212
213+ // Wrap a C cairo_device_t* found from some external source as a *Device. The Go side will destroy the reference when it's no longer used.
214+ func WrapDevice (p unsafe.Pointer ) * Device {
215+ return wrapDevice ((* C .cairo_device_t )(p ))
216+ }
217+
203218// Construct a Device from a C cairo_device_t* found from some exernal source. It is the caller's responsibility to ensure the pointer lives.
204219func BorrowDevice (p unsafe.Pointer ) * Device {
205220 return & Device {(* C .cairo_device_t )(p )}
@@ -233,6 +248,11 @@ func wrapPattern(p *C.cairo_pattern_t) *Pattern {
233248 return ret
234249}
235250
251+ // Wrap a C cairo_pattern_t* found from some external source as a *Pattern. The Go side will destroy the reference when it's no longer used.
252+ func WrapPattern (p unsafe.Pointer ) * Pattern {
253+ return wrapPattern ((* C .cairo_pattern_t )(p ))
254+ }
255+
236256// Construct a Pattern from a C cairo_pattern_t* found from some exernal source. It is the caller's responsibility to ensure the pointer lives.
237257func BorrowPattern (p unsafe.Pointer ) * Pattern {
238258 return & Pattern {(* C .cairo_pattern_t )(p )}
@@ -1228,6 +1248,11 @@ func wrapScaledFont(p *C.cairo_scaled_font_t) *ScaledFont {
12281248 return ret
12291249}
12301250
1251+ // Wrap a C cairo_scaled_font_t* found from some external source as a *ScaledFont. The Go side will destroy the reference when it's no longer used.
1252+ func WrapScaledFont (p unsafe.Pointer ) * ScaledFont {
1253+ return wrapScaledFont ((* C .cairo_scaled_font_t )(p ))
1254+ }
1255+
12311256// Construct a ScaledFont from a C cairo_scaled_font_t* found from some exernal source. It is the caller's responsibility to ensure the pointer lives.
12321257func BorrowScaledFont (p unsafe.Pointer ) * ScaledFont {
12331258 return & ScaledFont {(* C .cairo_scaled_font_t )(p )}
@@ -1249,6 +1274,11 @@ func wrapFontFace(p *C.cairo_font_face_t) *FontFace {
12491274 return ret
12501275}
12511276
1277+ // Wrap a C cairo_font_face_t* found from some external source as a *FontFace. The Go side will destroy the reference when it's no longer used.
1278+ func WrapFontFace (p unsafe.Pointer ) * FontFace {
1279+ return wrapFontFace ((* C .cairo_font_face_t )(p ))
1280+ }
1281+
12521282// Construct a FontFace from a C cairo_font_face_t* found from some exernal source. It is the caller's responsibility to ensure the pointer lives.
12531283func BorrowFontFace (p unsafe.Pointer ) * FontFace {
12541284 return & FontFace {(* C .cairo_font_face_t )(p )}
@@ -1449,6 +1479,11 @@ func wrapFontOptions(p *C.cairo_font_options_t) *FontOptions {
14491479 return ret
14501480}
14511481
1482+ // Wrap a C cairo_font_options_t* found from some external source as a *FontOptions. The Go side will destroy the reference when it's no longer used.
1483+ func WrapFontOptions (p unsafe.Pointer ) * FontOptions {
1484+ return wrapFontOptions ((* C .cairo_font_options_t )(p ))
1485+ }
1486+
14521487// Construct a FontOptions from a C cairo_font_options_t* found from some exernal source. It is the caller's responsibility to ensure the pointer lives.
14531488func BorrowFontOptions (p unsafe.Pointer ) * FontOptions {
14541489 return & FontOptions {(* C .cairo_font_options_t )(p )}
@@ -2219,6 +2254,11 @@ func wrapPath(p *C.cairo_path_t) *Path {
22192254 return ret
22202255}
22212256
2257+ // Wrap a C cairo_path_t* found from some external source as a *Path. The Go side will destroy the reference when it's no longer used.
2258+ func WrapPath (p unsafe.Pointer ) * Path {
2259+ return wrapPath ((* C .cairo_path_t )(p ))
2260+ }
2261+
22222262// Construct a Path from a C cairo_path_t* found from some exernal source. It is the caller's responsibility to ensure the pointer lives.
22232263func BorrowPath (p unsafe.Pointer ) * Path {
22242264 return & Path {(* C .cairo_path_t )(p )}
@@ -2447,8 +2487,6 @@ func (surface *SurfaceObserver) Elapsed() float64 {
24472487}
24482488
24492489// See cairo_device_observer_elapsed().
2450- //
2451- // C API documentation: http://cairographics.org/manual/cairo-cairo-device-t.html#cairo-device-observer-elapsed
24522490func (device * Device ) ObserverElapsed () float64 {
24532491 ret := float64 (C .cairo_device_observer_elapsed (device .Ptr ))
24542492 if err := device .status (); err != nil {
@@ -2458,8 +2496,6 @@ func (device *Device) ObserverElapsed() float64 {
24582496}
24592497
24602498// See cairo_device_observer_paint_elapsed().
2461- //
2462- // C API documentation: http://cairographics.org/manual/cairo-cairo-device-t.html#cairo-device-observer-paint-elapsed
24632499func (device * Device ) ObserverPaintElapsed () float64 {
24642500 ret := float64 (C .cairo_device_observer_paint_elapsed (device .Ptr ))
24652501 if err := device .status (); err != nil {
@@ -2469,8 +2505,6 @@ func (device *Device) ObserverPaintElapsed() float64 {
24692505}
24702506
24712507// See cairo_device_observer_mask_elapsed().
2472- //
2473- // C API documentation: http://cairographics.org/manual/cairo-cairo-device-t.html#cairo-device-observer-mask-elapsed
24742508func (device * Device ) ObserverMaskElapsed () float64 {
24752509 ret := float64 (C .cairo_device_observer_mask_elapsed (device .Ptr ))
24762510 if err := device .status (); err != nil {
@@ -2480,8 +2514,6 @@ func (device *Device) ObserverMaskElapsed() float64 {
24802514}
24812515
24822516// See cairo_device_observer_fill_elapsed().
2483- //
2484- // C API documentation: http://cairographics.org/manual/cairo-cairo-device-t.html#cairo-device-observer-fill-elapsed
24852517func (device * Device ) ObserverFillElapsed () float64 {
24862518 ret := float64 (C .cairo_device_observer_fill_elapsed (device .Ptr ))
24872519 if err := device .status (); err != nil {
@@ -2491,8 +2523,6 @@ func (device *Device) ObserverFillElapsed() float64 {
24912523}
24922524
24932525// See cairo_device_observer_stroke_elapsed().
2494- //
2495- // C API documentation: http://cairographics.org/manual/cairo-cairo-device-t.html#cairo-device-observer-stroke-elapsed
24962526func (device * Device ) ObserverStrokeElapsed () float64 {
24972527 ret := float64 (C .cairo_device_observer_stroke_elapsed (device .Ptr ))
24982528 if err := device .status (); err != nil {
@@ -2502,8 +2532,6 @@ func (device *Device) ObserverStrokeElapsed() float64 {
25022532}
25032533
25042534// See cairo_device_observer_glyphs_elapsed().
2505- //
2506- // C API documentation: http://cairographics.org/manual/cairo-cairo-device-t.html#cairo-device-observer-glyphs-elapsed
25072535func (device * Device ) ObserverGlyphsElapsed () float64 {
25082536 ret := float64 (C .cairo_device_observer_glyphs_elapsed (device .Ptr ))
25092537 if err := device .status (); err != nil {
@@ -2707,8 +2735,6 @@ func (surface *Surface) MarkDirtyRectangle(x, y, width, height int) {
27072735}
27082736
27092737// See cairo_surface_set_device_scale().
2710- //
2711- // C API documentation: http://cairographics.org/manual/cairo-cairo-surface-t.html#cairo-surface-set-device-scale
27122738func (surface * Surface ) SetDeviceScale (xScale , yScale float64 ) {
27132739 C .cairo_surface_set_device_scale (surface .Ptr , C .double (xScale ), C .double (yScale ))
27142740 if err := surface .status (); err != nil {
@@ -2717,8 +2743,6 @@ func (surface *Surface) SetDeviceScale(xScale, yScale float64) {
27172743}
27182744
27192745// See cairo_surface_get_device_scale().
2720- //
2721- // C API documentation: http://cairographics.org/manual/cairo-cairo-surface-t.html#cairo-surface-get-device-scale
27222746func (surface * Surface ) GetDeviceScale () (float64 , float64 ) {
27232747 var xScale C.double
27242748 var yScale C.double
@@ -3363,6 +3387,11 @@ func wrapRegion(p *C.cairo_region_t) *Region {
33633387 return ret
33643388}
33653389
3390+ // Wrap a C cairo_region_t* found from some external source as a *Region. The Go side will destroy the reference when it's no longer used.
3391+ func WrapRegion (p unsafe.Pointer ) * Region {
3392+ return wrapRegion ((* C .cairo_region_t )(p ))
3393+ }
3394+
33663395// Construct a Region from a C cairo_region_t* found from some exernal source. It is the caller's responsibility to ensure the pointer lives.
33673396func BorrowRegion (p unsafe.Pointer ) * Region {
33683397 return & Region {(* C .cairo_region_t )(p )}
0 commit comments