1// Package gdk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gdk
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8 "github.com/bnema/puregotk/v4/cairo"
9 "github.com/bnema/puregotk/v4/gdkpixbuf"
10)
11
12var xCairoDrawFromGl func(*cairo.Context, uintptr, int, int, int, int, int, int, int)
13
14// Draws GL content onto a cairo context.
15//
16// It takes a render buffer ID (@source_type == GL_RENDERBUFFER) or a texture
17// id (@source_type == GL_TEXTURE) and draws it onto @cr with an OVER operation,
18// respecting the current clip. The top left corner of the rectangle specified
19// by @x, @y, @width and @height will be drawn at the current (0,0) position of
20// the `cairo_t`.
21//
22// This will work for *all* `cairo_t`, as long as @surface is realized, but the
23// fallback implementation that reads back the pixels from the buffer may be
24// used in the general case. In the case of direct drawing to a surface with
25// no special effects applied to @cr it will however use a more efficient
26// approach.
27//
28// For GL_RENDERBUFFER the code will always fall back to software for buffers
29// with alpha components, so make sure you use GL_TEXTURE if using alpha.
30//
31// Calling this may change the current GL context.
32func CairoDrawFromGl(CrVar *cairo.Context, SurfaceVar *Surface, SourceVar int, SourceTypeVar int, BufferScaleVar int, XVar int, YVar int, WidthVar int, HeightVar int) {
33
34 xCairoDrawFromGl(CrVar, SurfaceVar.GoPointer(), SourceVar, SourceTypeVar, BufferScaleVar, XVar, YVar, WidthVar, HeightVar)
35
36}
37
38var xCairoRectangle func(*cairo.Context, *Rectangle)
39
40// Adds the given rectangle to the current path of @cr.
41func CairoRectangle(CrVar *cairo.Context, RectangleVar *Rectangle) {
42
43 xCairoRectangle(CrVar, RectangleVar)
44
45}
46
47var xCairoRegion func(*cairo.Context, *cairo.Region)
48
49// Adds the given region to the current path of @cr.
50func CairoRegion(CrVar *cairo.Context, RegionVar *cairo.Region) {
51
52 xCairoRegion(CrVar, RegionVar)
53
54}
55
56var xCairoRegionCreateFromSurface func(*cairo.Surface) *cairo.Region
57
58// Creates region that covers the area where the given
59// @surface is more than 50% opaque.
60//
61// This function takes into account device offsets that might be
62// set with cairo_surface_set_device_offset().
63func CairoRegionCreateFromSurface(SurfaceVar *cairo.Surface) *cairo.Region {
64
65 cret := xCairoRegionCreateFromSurface(SurfaceVar)
66 return cret
67}
68
69var xCairoSetSourcePixbuf func(*cairo.Context, uintptr, float64, float64)
70
71// Sets the given pixbuf as the source pattern for @cr.
72//
73// The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
74// so that the origin of @pixbuf is @pixbuf_x, @pixbuf_y.
75func CairoSetSourcePixbuf(CrVar *cairo.Context, PixbufVar *gdkpixbuf.Pixbuf, PixbufXVar float64, PixbufYVar float64) {
76
77 xCairoSetSourcePixbuf(CrVar, PixbufVar.GoPointer(), PixbufXVar, PixbufYVar)
78
79}
80
81var xCairoSetSourceRgba func(*cairo.Context, *RGBA)
82
83// Sets the specified `GdkRGBA` as the source color of @cr.
84func CairoSetSourceRgba(CrVar *cairo.Context, RgbaVar *RGBA) {
85
86 xCairoSetSourceRgba(CrVar, RgbaVar)
87
88}
89
90func init() {
91 core.SetPackageName("GDK", "gtk4")
92 core.SetSharedLibraries("GDK", []string{"libgtk-4.so.1"})
93 var libs []uintptr
94 for _, libPath := range core.GetPaths("GDK") {
95 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
96 if err != nil {
97 panic(err)
98 }
99 libs = append(libs, lib)
100 }
101
102 core.PuregoSafeRegister(&xCairoDrawFromGl, libs, "gdk_cairo_draw_from_gl")
103 core.PuregoSafeRegister(&xCairoRectangle, libs, "gdk_cairo_rectangle")
104 core.PuregoSafeRegister(&xCairoRegion, libs, "gdk_cairo_region")
105 core.PuregoSafeRegister(&xCairoRegionCreateFromSurface, libs, "gdk_cairo_region_create_from_surface")
106 core.PuregoSafeRegister(&xCairoSetSourcePixbuf, libs, "gdk_cairo_set_source_pixbuf")
107 core.PuregoSafeRegister(&xCairoSetSourceRgba, libs, "gdk_cairo_set_source_rgba")
108
109}