1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/cairo"
12 "github.com/bnema/puregotk/v4/gdk"
13 "github.com/bnema/puregotk/v4/glib"
14 "github.com/bnema/puregotk/v4/gobject/types"
15 "github.com/bnema/puregotk/v4/graphene"
16 "github.com/bnema/puregotk/v4/gsk"
17 "github.com/bnema/puregotk/v4/pango"
18)
19
20type SnapshotClass struct {
21 _ structs.HostLayout
22}
23
24func (x *SnapshotClass) GoPointer() uintptr {
25 return uintptr(unsafe.Pointer(x))
26}
27
28// Assists in creating [class@Gsk.RenderNode]s for widgets.
29//
30// It functions in a similar way to a cairo context, and maintains a stack
31// of render nodes and their associated transformations.
32//
33// The node at the top of the stack is the one that `gtk_snapshot_append_…()`
34// functions operate on. Use the `gtk_snapshot_push_…()` functions and
35// [method@Snapshot.pop] to change the current node.
36//
37// The typical way to obtain a `GtkSnapshot` object is as an argument to
38// the [vfunc@Gtk.Widget.snapshot] vfunc. If you need to create your own
39// `GtkSnapshot`, use [ctor@Gtk.Snapshot.new].
40type Snapshot struct {
41 gdk.Snapshot
42}
43
44var xSnapshotGLibType func() types.GType
45
46func SnapshotGLibType() types.GType {
47 return xSnapshotGLibType()
48}
49
50func SnapshotNewFromInternalPtr(ptr uintptr) *Snapshot {
51 cls := &Snapshot{}
52 cls.Ptr = ptr
53 return cls
54}
55
56var xNewSnapshot func() uintptr
57
58// Creates a new `GtkSnapshot`.
59func NewSnapshot() *Snapshot {
60 var cls *Snapshot
61
62 cret := xNewSnapshot()
63
64 if cret == 0 {
65 return nil
66 }
67 cls = &Snapshot{}
68 cls.Ptr = cret
69 return cls
70}
71
72var xSnapshotAppendBorder func(uintptr, *gsk.RoundedRect, *[4]float32, *[4]gdk.RGBA)
73
74// Appends a stroked border rectangle inside the given @outline.
75//
76// The four sides of the border can have different widths and colors.
77func (x *Snapshot) AppendBorder(OutlineVar *gsk.RoundedRect, BorderWidthVar [4]float32, BorderColorVar [4]gdk.RGBA) {
78
79 xSnapshotAppendBorder(x.GoPointer(), OutlineVar, &BorderWidthVar, &BorderColorVar)
80
81}
82
83var xSnapshotAppendCairo func(uintptr, *graphene.Rect) *cairo.Context
84
85// Creates a new [class@Gsk.CairoNode] and appends it to the current
86// render node of @snapshot, without changing the current node.
87func (x *Snapshot) AppendCairo(BoundsVar *graphene.Rect) *cairo.Context {
88
89 cret := xSnapshotAppendCairo(x.GoPointer(), BoundsVar)
90 return cret
91}
92
93var xSnapshotAppendColor func(uintptr, *gdk.RGBA, *graphene.Rect)
94
95// Creates a new render node drawing the @color into the
96// given @bounds and appends it to the current render node
97// of @snapshot.
98//
99// You should try to avoid calling this function if
100// @color is transparent.
101func (x *Snapshot) AppendColor(ColorVar *gdk.RGBA, BoundsVar *graphene.Rect) {
102
103 xSnapshotAppendColor(x.GoPointer(), ColorVar, BoundsVar)
104
105}
106
107var xSnapshotAppendConicGradient func(uintptr, *graphene.Rect, *graphene.Point, float32, []gsk.ColorStop, uint)
108
109// Appends a conic gradient node with the given stops to @snapshot.
110func (x *Snapshot) AppendConicGradient(BoundsVar *graphene.Rect, CenterVar *graphene.Point, RotationVar float32, StopsVar []gsk.ColorStop, NStopsVar uint) {
111
112 xSnapshotAppendConicGradient(x.GoPointer(), BoundsVar, CenterVar, RotationVar, StopsVar, NStopsVar)
113
114}
115
116var xSnapshotAppendFill func(uintptr, *gsk.Path, gsk.FillRule, *gdk.RGBA)
117
118// A convenience method to fill a path with a color.
119//
120// See [method@Gtk.Snapshot.push_fill] if you need
121// to fill a path with more complex content than
122// a color.
123func (x *Snapshot) AppendFill(PathVar *gsk.Path, FillRuleVar gsk.FillRule, ColorVar *gdk.RGBA) {
124
125 xSnapshotAppendFill(x.GoPointer(), PathVar, FillRuleVar, ColorVar)
126
127}
128
129var xSnapshotAppendInsetShadow func(uintptr, *gsk.RoundedRect, *gdk.RGBA, float32, float32, float32, float32)
130
131// Appends an inset shadow into the box given by @outline.
132func (x *Snapshot) AppendInsetShadow(OutlineVar *gsk.RoundedRect, ColorVar *gdk.RGBA, DxVar float32, DyVar float32, SpreadVar float32, BlurRadiusVar float32) {
133
134 xSnapshotAppendInsetShadow(x.GoPointer(), OutlineVar, ColorVar, DxVar, DyVar, SpreadVar, BlurRadiusVar)
135
136}
137
138var xSnapshotAppendLayout func(uintptr, uintptr, *gdk.RGBA)
139
140// Creates render nodes for rendering @layout in the given foregound @color
141// and appends them to the current node of @snapshot without changing the
142// current node. The current theme's foreground color for a widget can be
143// obtained with [method@Gtk.Widget.get_color].
144//
145// Note that if the layout does not produce any visible output, then nodes
146// may not be added to the @snapshot.
147func (x *Snapshot) AppendLayout(LayoutVar *pango.Layout, ColorVar *gdk.RGBA) {
148
149 xSnapshotAppendLayout(x.GoPointer(), LayoutVar.GoPointer(), ColorVar)
150
151}
152
153var xSnapshotAppendLinearGradient func(uintptr, *graphene.Rect, *graphene.Point, *graphene.Point, []gsk.ColorStop, uint)
154
155// Appends a linear gradient node with the given stops to @snapshot.
156func (x *Snapshot) AppendLinearGradient(BoundsVar *graphene.Rect, StartPointVar *graphene.Point, EndPointVar *graphene.Point, StopsVar []gsk.ColorStop, NStopsVar uint) {
157
158 xSnapshotAppendLinearGradient(x.GoPointer(), BoundsVar, StartPointVar, EndPointVar, StopsVar, NStopsVar)
159
160}
161
162var xSnapshotAppendNode func(uintptr, uintptr)
163
164// Appends @node to the current render node of @snapshot,
165// without changing the current node.
166//
167// If @snapshot does not have a current node yet, @node
168// will become the initial node.
169func (x *Snapshot) AppendNode(NodeVar *gsk.RenderNode) {
170
171 xSnapshotAppendNode(x.GoPointer(), NodeVar.GoPointer())
172
173}
174
175var xSnapshotAppendOutsetShadow func(uintptr, *gsk.RoundedRect, *gdk.RGBA, float32, float32, float32, float32)
176
177// Appends an outset shadow node around the box given by @outline.
178func (x *Snapshot) AppendOutsetShadow(OutlineVar *gsk.RoundedRect, ColorVar *gdk.RGBA, DxVar float32, DyVar float32, SpreadVar float32, BlurRadiusVar float32) {
179
180 xSnapshotAppendOutsetShadow(x.GoPointer(), OutlineVar, ColorVar, DxVar, DyVar, SpreadVar, BlurRadiusVar)
181
182}
183
184var xSnapshotAppendRadialGradient func(uintptr, *graphene.Rect, *graphene.Point, float32, float32, float32, float32, []gsk.ColorStop, uint)
185
186// Appends a radial gradient node with the given stops to @snapshot.
187func (x *Snapshot) AppendRadialGradient(BoundsVar *graphene.Rect, CenterVar *graphene.Point, HradiusVar float32, VradiusVar float32, StartVar float32, EndVar float32, StopsVar []gsk.ColorStop, NStopsVar uint) {
188
189 xSnapshotAppendRadialGradient(x.GoPointer(), BoundsVar, CenterVar, HradiusVar, VradiusVar, StartVar, EndVar, StopsVar, NStopsVar)
190
191}
192
193var xSnapshotAppendRepeatingLinearGradient func(uintptr, *graphene.Rect, *graphene.Point, *graphene.Point, []gsk.ColorStop, uint)
194
195// Appends a repeating linear gradient node with the given stops to @snapshot.
196func (x *Snapshot) AppendRepeatingLinearGradient(BoundsVar *graphene.Rect, StartPointVar *graphene.Point, EndPointVar *graphene.Point, StopsVar []gsk.ColorStop, NStopsVar uint) {
197
198 xSnapshotAppendRepeatingLinearGradient(x.GoPointer(), BoundsVar, StartPointVar, EndPointVar, StopsVar, NStopsVar)
199
200}
201
202var xSnapshotAppendRepeatingRadialGradient func(uintptr, *graphene.Rect, *graphene.Point, float32, float32, float32, float32, []gsk.ColorStop, uint)
203
204// Appends a repeating radial gradient node with the given stops to @snapshot.
205func (x *Snapshot) AppendRepeatingRadialGradient(BoundsVar *graphene.Rect, CenterVar *graphene.Point, HradiusVar float32, VradiusVar float32, StartVar float32, EndVar float32, StopsVar []gsk.ColorStop, NStopsVar uint) {
206
207 xSnapshotAppendRepeatingRadialGradient(x.GoPointer(), BoundsVar, CenterVar, HradiusVar, VradiusVar, StartVar, EndVar, StopsVar, NStopsVar)
208
209}
210
211var xSnapshotAppendScaledTexture func(uintptr, uintptr, gsk.ScalingFilter, *graphene.Rect)
212
213// Creates a new render node drawing the @texture
214// into the given @bounds and appends it to the
215// current render node of @snapshot.
216//
217// In contrast to [method@Gtk.Snapshot.append_texture],
218// this function provides control about how the filter
219// that is used when scaling.
220func (x *Snapshot) AppendScaledTexture(TextureVar *gdk.Texture, FilterVar gsk.ScalingFilter, BoundsVar *graphene.Rect) {
221
222 xSnapshotAppendScaledTexture(x.GoPointer(), TextureVar.GoPointer(), FilterVar, BoundsVar)
223
224}
225
226var xSnapshotAppendStroke func(uintptr, *gsk.Path, *gsk.Stroke, *gdk.RGBA)
227
228// A convenience method to stroke a path with a color.
229//
230// See [method@Gtk.Snapshot.push_stroke] if you need
231// to stroke a path with more complex content than
232// a color.
233func (x *Snapshot) AppendStroke(PathVar *gsk.Path, StrokeVar *gsk.Stroke, ColorVar *gdk.RGBA) {
234
235 xSnapshotAppendStroke(x.GoPointer(), PathVar, StrokeVar, ColorVar)
236
237}
238
239var xSnapshotAppendTexture func(uintptr, uintptr, *graphene.Rect)
240
241// Creates a new render node drawing the @texture
242// into the given @bounds and appends it to the
243// current render node of @snapshot.
244//
245// If the texture needs to be scaled to fill @bounds,
246// linear filtering is used. See [method@Gtk.Snapshot.append_scaled_texture]
247// if you need other filtering, such as nearest-neighbour.
248func (x *Snapshot) AppendTexture(TextureVar *gdk.Texture, BoundsVar *graphene.Rect) {
249
250 xSnapshotAppendTexture(x.GoPointer(), TextureVar.GoPointer(), BoundsVar)
251
252}
253
254var xSnapshotFreeToNode func(uintptr) uintptr
255
256// Returns the node that was constructed by @snapshot
257// and frees @snapshot.
258//
259// See also [method@Gtk.Snapshot.to_node].
260func (x *Snapshot) FreeToNode() *gsk.RenderNode {
261 var cls *gsk.RenderNode
262
263 cret := xSnapshotFreeToNode(x.GoPointer())
264
265 if cret == 0 {
266 return nil
267 }
268 cls = &gsk.RenderNode{}
269 cls.Ptr = cret
270 return cls
271}
272
273var xSnapshotFreeToPaintable func(uintptr, *graphene.Size) uintptr
274
275// Returns a paintable for the node that was
276// constructed by @snapshot and frees @snapshot.
277func (x *Snapshot) FreeToPaintable(SizeVar *graphene.Size) *gdk.PaintableBase {
278 var cls *gdk.PaintableBase
279
280 cret := xSnapshotFreeToPaintable(x.GoPointer(), SizeVar)
281
282 if cret == 0 {
283 return nil
284 }
285 cls = &gdk.PaintableBase{}
286 cls.Ptr = cret
287 return cls
288}
289
290var xSnapshotGlShaderPopTexture func(uintptr)
291
292// Removes the top element from the stack of render nodes and
293// adds it to the nearest [class@Gsk.GLShaderNode] below it.
294//
295// This must be called the same number of times as the number
296// of textures is needed for the shader in
297// [method@Gtk.Snapshot.push_gl_shader].
298func (x *Snapshot) GlShaderPopTexture() {
299
300 xSnapshotGlShaderPopTexture(x.GoPointer())
301
302}
303
304var xSnapshotPerspective func(uintptr, float32)
305
306// Applies a perspective projection transform.
307//
308// See [method@Gsk.Transform.perspective] for a discussion on the details.
309func (x *Snapshot) Perspective(DepthVar float32) {
310
311 xSnapshotPerspective(x.GoPointer(), DepthVar)
312
313}
314
315var xSnapshotPop func(uintptr)
316
317// Removes the top element from the stack of render nodes,
318// and appends it to the node underneath it.
319func (x *Snapshot) Pop() {
320
321 xSnapshotPop(x.GoPointer())
322
323}
324
325var xSnapshotPushBlend func(uintptr, gsk.BlendMode)
326
327// Blends together two images with the given blend mode.
328//
329// Until the first call to [method@Gtk.Snapshot.pop], the
330// bottom image for the blend operation will be recorded.
331// After that call, the top image to be blended will be
332// recorded until the second call to [method@Gtk.Snapshot.pop].
333//
334// Calling this function requires two subsequent calls
335// to [method@Gtk.Snapshot.pop].
336func (x *Snapshot) PushBlend(BlendModeVar gsk.BlendMode) {
337
338 xSnapshotPushBlend(x.GoPointer(), BlendModeVar)
339
340}
341
342var xSnapshotPushBlur func(uintptr, float64)
343
344// Blurs an image.
345//
346// The image is recorded until the next call to [method@Gtk.Snapshot.pop].
347func (x *Snapshot) PushBlur(RadiusVar float64) {
348
349 xSnapshotPushBlur(x.GoPointer(), RadiusVar)
350
351}
352
353var xSnapshotPushClip func(uintptr, *graphene.Rect)
354
355// Clips an image to a rectangle.
356//
357// The image is recorded until the next call to [method@Gtk.Snapshot.pop].
358func (x *Snapshot) PushClip(BoundsVar *graphene.Rect) {
359
360 xSnapshotPushClip(x.GoPointer(), BoundsVar)
361
362}
363
364var xSnapshotPushColorMatrix func(uintptr, *graphene.Matrix, *graphene.Vec4)
365
366// Modifies the colors of an image by applying an affine transformation
367// in RGB space.
368//
369// In particular, the colors will be transformed by applying
370//
371// pixel = transpose(color_matrix) * pixel + color_offset
372//
373// for every pixel. The transformation operates on unpremultiplied
374// colors, with color components ordered R, G, B, A.
375//
376// The image is recorded until the next call to [method@Gtk.Snapshot.pop].
377func (x *Snapshot) PushColorMatrix(ColorMatrixVar *graphene.Matrix, ColorOffsetVar *graphene.Vec4) {
378
379 xSnapshotPushColorMatrix(x.GoPointer(), ColorMatrixVar, ColorOffsetVar)
380
381}
382
383var xSnapshotPushComponentTransfer func(uintptr, *gsk.ComponentTransfer, *gsk.ComponentTransfer, *gsk.ComponentTransfer, *gsk.ComponentTransfer)
384
385// Modifies the colors of an image by applying a transfer
386// function for each component.
387//
388// The transfer functions operate on unpremultiplied colors.
389//
390// The image is recorded until the next call to [method@Gtk.Snapshot.pop].
391func (x *Snapshot) PushComponentTransfer(RedVar *gsk.ComponentTransfer, GreenVar *gsk.ComponentTransfer, BlueVar *gsk.ComponentTransfer, AlphaVar *gsk.ComponentTransfer) {
392
393 xSnapshotPushComponentTransfer(x.GoPointer(), RedVar, GreenVar, BlueVar, AlphaVar)
394
395}
396
397var xSnapshotPushCrossFade func(uintptr, float64)
398
399// Snapshots a cross-fade operation between two images with the
400// given @progress.
401//
402// Until the first call to [method@Gtk.Snapshot.pop], the start image
403// will be snapshot. After that call, the end image will be recorded
404// until the second call to [method@Gtk.Snapshot.pop].
405//
406// Calling this function requires two subsequent calls
407// to [method@Gtk.Snapshot.pop].
408func (x *Snapshot) PushCrossFade(ProgressVar float64) {
409
410 xSnapshotPushCrossFade(x.GoPointer(), ProgressVar)
411
412}
413
414var xSnapshotPushDebug func(uintptr, string, ...interface{})
415
416// Inserts a debug node with a message.
417//
418// Debug nodes don't affect the rendering at all, but can be
419// helpful in identifying parts of a render node tree dump,
420// for example in the GTK inspector.
421func (x *Snapshot) PushDebug(MessageVar string, varArgs ...interface{}) {
422
423 xSnapshotPushDebug(x.GoPointer(), MessageVar, varArgs...)
424
425}
426
427var xSnapshotPushFill func(uintptr, *gsk.Path, gsk.FillRule)
428
429// Fills the area given by @path and @fill_rule with an image and discards everything
430// outside of it.
431//
432// The image is recorded until the next call to [method@Gtk.Snapshot.pop].
433//
434// If you want to fill the path with a color, [method@Gtk.Snapshot.append_fill]
435// than rendering new ones, use [method@Gtk.Snapshot.append_fill]
436// may be more convenient.
437func (x *Snapshot) PushFill(PathVar *gsk.Path, FillRuleVar gsk.FillRule) {
438
439 xSnapshotPushFill(x.GoPointer(), PathVar, FillRuleVar)
440
441}
442
443var xSnapshotPushGlShader func(uintptr, uintptr, *graphene.Rect, *glib.Bytes)
444
445// Push a [class@Gsk.GLShaderNode].
446//
447// The node uses the given [class@Gsk.GLShader] and uniform values
448// Additionally this takes a list of @n_children other nodes
449// which will be passed to the [class@Gsk.GLShaderNode].
450//
451// The @take_args argument is a block of data to use for uniform
452// arguments, as per types and offsets defined by the @shader.
453// Normally this is generated by [method@Gsk.GLShader.format_args]
454// or [struct@Gsk.ShaderArgsBuilder].
455//
456// The snapshotter takes ownership of @take_args, so the caller should
457// not free it after this.
458//
459// If the renderer doesn't support GL shaders, or if there is any
460// problem when compiling the shader, then the node will draw pink.
461// You should use [method@Gsk.GLShader.compile] to ensure the @shader
462// will work for the renderer before using it.
463//
464// If the shader requires textures (see [method@Gsk.GLShader.get_n_textures]),
465// then it is expected that you call [method@Gtk.Snapshot.gl_shader_pop_texture]
466// the number of times that are required. Each of these calls will generate
467// a node that is added as a child to the `GskGLShaderNode`, which in turn
468// will render these offscreen and pass as a texture to the shader.
469//
470// Once all textures (if any) are pop:ed, you must call the regular
471// [method@Gtk.Snapshot.pop].
472//
473// If you want to use pre-existing textures as input to the shader rather
474// than rendering new ones, use [method@Gtk.Snapshot.append_texture] to
475// push a texture node. These will be used directly rather than being
476// re-rendered.
477//
478// For details on how to write shaders, see [class@Gsk.GLShader].
479func (x *Snapshot) PushGlShader(ShaderVar *gsk.GLShader, BoundsVar *graphene.Rect, TakeArgsVar *glib.Bytes) {
480
481 xSnapshotPushGlShader(x.GoPointer(), ShaderVar.GoPointer(), BoundsVar, TakeArgsVar)
482
483}
484
485var xSnapshotPushMask func(uintptr, gsk.MaskMode)
486
487// Until the first call to [method@Gtk.Snapshot.pop], the
488// mask image for the mask operation will be recorded.
489//
490// After that call, the source image will be recorded until
491// the second call to [method@Gtk.Snapshot.pop].
492//
493// Calling this function requires 2 subsequent calls to gtk_snapshot_pop().
494func (x *Snapshot) PushMask(MaskModeVar gsk.MaskMode) {
495
496 xSnapshotPushMask(x.GoPointer(), MaskModeVar)
497
498}
499
500var xSnapshotPushOpacity func(uintptr, float64)
501
502// Modifies the opacity of an image.
503//
504// The image is recorded until the next call to [method@Gtk.Snapshot.pop].
505func (x *Snapshot) PushOpacity(OpacityVar float64) {
506
507 xSnapshotPushOpacity(x.GoPointer(), OpacityVar)
508
509}
510
511var xSnapshotPushRepeat func(uintptr, *graphene.Rect, *graphene.Rect)
512
513// Creates a node that repeats the child node.
514//
515// The child is recorded until the next call to [method@Gtk.Snapshot.pop].
516func (x *Snapshot) PushRepeat(BoundsVar *graphene.Rect, ChildBoundsVar *graphene.Rect) {
517
518 xSnapshotPushRepeat(x.GoPointer(), BoundsVar, ChildBoundsVar)
519
520}
521
522var xSnapshotPushRoundedClip func(uintptr, *gsk.RoundedRect)
523
524// Clips an image to a rounded rectangle.
525//
526// The image is recorded until the next call to [method@Gtk.Snapshot.pop].
527func (x *Snapshot) PushRoundedClip(BoundsVar *gsk.RoundedRect) {
528
529 xSnapshotPushRoundedClip(x.GoPointer(), BoundsVar)
530
531}
532
533var xSnapshotPushShadow func(uintptr, []gsk.Shadow, uint)
534
535// Applies a shadow to an image.
536//
537// The image is recorded until the next call to [method@Gtk.Snapshot.pop].
538func (x *Snapshot) PushShadow(ShadowVar []gsk.Shadow, NShadowsVar uint) {
539
540 xSnapshotPushShadow(x.GoPointer(), ShadowVar, NShadowsVar)
541
542}
543
544var xSnapshotPushStroke func(uintptr, *gsk.Path, *gsk.Stroke)
545
546// Strokes the given @path with the attributes given by @stroke and
547// an image.
548//
549// The image is recorded until the next call to [method@Gtk.Snapshot.pop].
550//
551// Note that the strokes are subject to the same transformation as
552// everything else, so uneven scaling will cause horizontal and vertical
553// strokes to have different widths.
554//
555// If you want to stroke the path with a color, [method@Gtk.Snapshot.append_stroke]
556// may be more convenient.
557func (x *Snapshot) PushStroke(PathVar *gsk.Path, StrokeVar *gsk.Stroke) {
558
559 xSnapshotPushStroke(x.GoPointer(), PathVar, StrokeVar)
560
561}
562
563var xSnapshotRenderBackground func(uintptr, uintptr, float64, float64, float64, float64)
564
565// Creates a render node for the CSS background according to @context,
566// and appends it to the current node of @snapshot, without changing
567// the current node.
568func (x *Snapshot) RenderBackground(ContextVar *StyleContext, XVar float64, YVar float64, WidthVar float64, HeightVar float64) {
569
570 xSnapshotRenderBackground(x.GoPointer(), ContextVar.GoPointer(), XVar, YVar, WidthVar, HeightVar)
571
572}
573
574var xSnapshotRenderFocus func(uintptr, uintptr, float64, float64, float64, float64)
575
576// Creates a render node for the focus outline according to @context,
577// and appends it to the current node of @snapshot, without changing
578// the current node.
579func (x *Snapshot) RenderFocus(ContextVar *StyleContext, XVar float64, YVar float64, WidthVar float64, HeightVar float64) {
580
581 xSnapshotRenderFocus(x.GoPointer(), ContextVar.GoPointer(), XVar, YVar, WidthVar, HeightVar)
582
583}
584
585var xSnapshotRenderFrame func(uintptr, uintptr, float64, float64, float64, float64)
586
587// Creates a render node for the CSS border according to @context,
588// and appends it to the current node of @snapshot, without changing
589// the current node.
590func (x *Snapshot) RenderFrame(ContextVar *StyleContext, XVar float64, YVar float64, WidthVar float64, HeightVar float64) {
591
592 xSnapshotRenderFrame(x.GoPointer(), ContextVar.GoPointer(), XVar, YVar, WidthVar, HeightVar)
593
594}
595
596var xSnapshotRenderInsertionCursor func(uintptr, uintptr, float64, float64, uintptr, int, pango.Direction)
597
598// Draws a text caret using @snapshot at the specified index of @layout.
599func (x *Snapshot) RenderInsertionCursor(ContextVar *StyleContext, XVar float64, YVar float64, LayoutVar *pango.Layout, IndexVar int, DirectionVar pango.Direction) {
600
601 xSnapshotRenderInsertionCursor(x.GoPointer(), ContextVar.GoPointer(), XVar, YVar, LayoutVar.GoPointer(), IndexVar, DirectionVar)
602
603}
604
605var xSnapshotRenderLayout func(uintptr, uintptr, float64, float64, uintptr)
606
607// Creates a render node for rendering @layout according to the style
608// information in @context, and appends it to the current node of @snapshot,
609// without changing the current node.
610func (x *Snapshot) RenderLayout(ContextVar *StyleContext, XVar float64, YVar float64, LayoutVar *pango.Layout) {
611
612 xSnapshotRenderLayout(x.GoPointer(), ContextVar.GoPointer(), XVar, YVar, LayoutVar.GoPointer())
613
614}
615
616var xSnapshotRestore func(uintptr)
617
618// Restores @snapshot to the state saved by a preceding call to
619// [method@Snapshot.save] and removes that state from the stack of
620// saved states.
621func (x *Snapshot) Restore() {
622
623 xSnapshotRestore(x.GoPointer())
624
625}
626
627var xSnapshotRotate func(uintptr, float32)
628
629// Rotates @@snapshot's coordinate system by @angle degrees in 2D space -
630// or in 3D speak, rotates around the Z axis. The rotation happens around
631// the origin point of (0, 0) in the @snapshot's current coordinate system.
632//
633// To rotate around axes other than the Z axis, use [method@Gsk.Transform.rotate_3d].
634func (x *Snapshot) Rotate(AngleVar float32) {
635
636 xSnapshotRotate(x.GoPointer(), AngleVar)
637
638}
639
640var xSnapshotRotate3d func(uintptr, float32, *graphene.Vec3)
641
642// Rotates @snapshot's coordinate system by @angle degrees around @axis.
643//
644// For a rotation in 2D space, use [method@Gsk.Transform.rotate].
645func (x *Snapshot) Rotate3d(AngleVar float32, AxisVar *graphene.Vec3) {
646
647 xSnapshotRotate3d(x.GoPointer(), AngleVar, AxisVar)
648
649}
650
651var xSnapshotSave func(uintptr)
652
653// Makes a copy of the current state of @snapshot and saves it
654// on an internal stack.
655//
656// When [method@Gtk.Snapshot.restore] is called, @snapshot will
657// be restored to the saved state.
658//
659// Multiple calls to [method@Gtk.Snapshot.save] and [method@Gtk.Snapshot.restore]
660// can be nested; each call to `gtk_snapshot_restore()` restores the state from
661// the matching paired `gtk_snapshot_save()`.
662//
663// It is necessary to clear all saved states with corresponding
664// calls to `gtk_snapshot_restore()`.
665func (x *Snapshot) Save() {
666
667 xSnapshotSave(x.GoPointer())
668
669}
670
671var xSnapshotScale func(uintptr, float32, float32)
672
673// Scales @snapshot's coordinate system in 2-dimensional space by
674// the given factors.
675//
676// Use [method@Gtk.Snapshot.scale_3d] to scale in all 3 dimensions.
677func (x *Snapshot) Scale(FactorXVar float32, FactorYVar float32) {
678
679 xSnapshotScale(x.GoPointer(), FactorXVar, FactorYVar)
680
681}
682
683var xSnapshotScale3d func(uintptr, float32, float32, float32)
684
685// Scales @snapshot's coordinate system by the given factors.
686func (x *Snapshot) Scale3d(FactorXVar float32, FactorYVar float32, FactorZVar float32) {
687
688 xSnapshotScale3d(x.GoPointer(), FactorXVar, FactorYVar, FactorZVar)
689
690}
691
692var xSnapshotToNode func(uintptr) uintptr
693
694// Returns the render node that was constructed
695// by @snapshot.
696//
697// Note that this function may return %NULL if nothing has been
698// added to the snapshot or if its content does not produce pixels
699// to be rendered.
700//
701// After calling this function, it is no longer possible to
702// add more nodes to @snapshot. The only function that should
703// be called after this is [method@GObject.Object.unref].
704func (x *Snapshot) ToNode() *gsk.RenderNode {
705 var cls *gsk.RenderNode
706
707 cret := xSnapshotToNode(x.GoPointer())
708
709 if cret == 0 {
710 return nil
711 }
712 cls = &gsk.RenderNode{}
713 cls.Ptr = cret
714 return cls
715}
716
717var xSnapshotToPaintable func(uintptr, *graphene.Size) uintptr
718
719// Returns a paintable encapsulating the render node
720// that was constructed by @snapshot.
721//
722// After calling this function, it is no longer possible to
723// add more nodes to @snapshot. The only function that should
724// be called after this is [method@GObject.Object.unref].
725func (x *Snapshot) ToPaintable(SizeVar *graphene.Size) *gdk.PaintableBase {
726 var cls *gdk.PaintableBase
727
728 cret := xSnapshotToPaintable(x.GoPointer(), SizeVar)
729
730 if cret == 0 {
731 return nil
732 }
733 cls = &gdk.PaintableBase{}
734 cls.Ptr = cret
735 return cls
736}
737
738var xSnapshotTransform func(uintptr, *gsk.Transform)
739
740// Transforms @snapshot's coordinate system with the given @transform.
741func (x *Snapshot) Transform(TransformVar *gsk.Transform) {
742
743 xSnapshotTransform(x.GoPointer(), TransformVar)
744
745}
746
747var xSnapshotTransformMatrix func(uintptr, *graphene.Matrix)
748
749// Transforms @snapshot's coordinate system with the given @matrix.
750func (x *Snapshot) TransformMatrix(MatrixVar *graphene.Matrix) {
751
752 xSnapshotTransformMatrix(x.GoPointer(), MatrixVar)
753
754}
755
756var xSnapshotTranslate func(uintptr, *graphene.Point)
757
758// Translates @snapshot's coordinate system by @point in 2-dimensional space.
759func (x *Snapshot) Translate(PointVar *graphene.Point) {
760
761 xSnapshotTranslate(x.GoPointer(), PointVar)
762
763}
764
765var xSnapshotTranslate3d func(uintptr, *graphene.Point3D)
766
767// Translates @snapshot's coordinate system by @point.
768func (x *Snapshot) Translate3d(PointVar *graphene.Point3D) {
769
770 xSnapshotTranslate3d(x.GoPointer(), PointVar)
771
772}
773
774func (c *Snapshot) GoPointer() uintptr {
775 if c == nil {
776 return 0
777 }
778 return c.Ptr
779}
780
781func (c *Snapshot) SetGoPointer(ptr uintptr) {
782 c.Ptr = ptr
783}
784
785func init() {
786 core.SetPackageName("GTK", "gtk4")
787 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
788 var libs []uintptr
789 for _, libPath := range core.GetPaths("GTK") {
790 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
791 if err != nil {
792 panic(err)
793 }
794 libs = append(libs, lib)
795 }
796
797 core.PuregoSafeRegister(&xSnapshotGLibType, libs, "gtk_snapshot_get_type")
798
799 core.PuregoSafeRegister(&xNewSnapshot, libs, "gtk_snapshot_new")
800
801 core.PuregoSafeRegister(&xSnapshotAppendBorder, libs, "gtk_snapshot_append_border")
802 core.PuregoSafeRegister(&xSnapshotAppendCairo, libs, "gtk_snapshot_append_cairo")
803 core.PuregoSafeRegister(&xSnapshotAppendColor, libs, "gtk_snapshot_append_color")
804 core.PuregoSafeRegister(&xSnapshotAppendConicGradient, libs, "gtk_snapshot_append_conic_gradient")
805 core.PuregoSafeRegister(&xSnapshotAppendFill, libs, "gtk_snapshot_append_fill")
806 core.PuregoSafeRegister(&xSnapshotAppendInsetShadow, libs, "gtk_snapshot_append_inset_shadow")
807 core.PuregoSafeRegister(&xSnapshotAppendLayout, libs, "gtk_snapshot_append_layout")
808 core.PuregoSafeRegister(&xSnapshotAppendLinearGradient, libs, "gtk_snapshot_append_linear_gradient")
809 core.PuregoSafeRegister(&xSnapshotAppendNode, libs, "gtk_snapshot_append_node")
810 core.PuregoSafeRegister(&xSnapshotAppendOutsetShadow, libs, "gtk_snapshot_append_outset_shadow")
811 core.PuregoSafeRegister(&xSnapshotAppendRadialGradient, libs, "gtk_snapshot_append_radial_gradient")
812 core.PuregoSafeRegister(&xSnapshotAppendRepeatingLinearGradient, libs, "gtk_snapshot_append_repeating_linear_gradient")
813 core.PuregoSafeRegister(&xSnapshotAppendRepeatingRadialGradient, libs, "gtk_snapshot_append_repeating_radial_gradient")
814 core.PuregoSafeRegister(&xSnapshotAppendScaledTexture, libs, "gtk_snapshot_append_scaled_texture")
815 core.PuregoSafeRegister(&xSnapshotAppendStroke, libs, "gtk_snapshot_append_stroke")
816 core.PuregoSafeRegister(&xSnapshotAppendTexture, libs, "gtk_snapshot_append_texture")
817 core.PuregoSafeRegister(&xSnapshotFreeToNode, libs, "gtk_snapshot_free_to_node")
818 core.PuregoSafeRegister(&xSnapshotFreeToPaintable, libs, "gtk_snapshot_free_to_paintable")
819 core.PuregoSafeRegister(&xSnapshotGlShaderPopTexture, libs, "gtk_snapshot_gl_shader_pop_texture")
820 core.PuregoSafeRegister(&xSnapshotPerspective, libs, "gtk_snapshot_perspective")
821 core.PuregoSafeRegister(&xSnapshotPop, libs, "gtk_snapshot_pop")
822 core.PuregoSafeRegister(&xSnapshotPushBlend, libs, "gtk_snapshot_push_blend")
823 core.PuregoSafeRegister(&xSnapshotPushBlur, libs, "gtk_snapshot_push_blur")
824 core.PuregoSafeRegister(&xSnapshotPushClip, libs, "gtk_snapshot_push_clip")
825 core.PuregoSafeRegister(&xSnapshotPushColorMatrix, libs, "gtk_snapshot_push_color_matrix")
826 core.PuregoSafeRegister(&xSnapshotPushComponentTransfer, libs, "gtk_snapshot_push_component_transfer")
827 core.PuregoSafeRegister(&xSnapshotPushCrossFade, libs, "gtk_snapshot_push_cross_fade")
828 core.PuregoSafeRegister(&xSnapshotPushDebug, libs, "gtk_snapshot_push_debug")
829 core.PuregoSafeRegister(&xSnapshotPushFill, libs, "gtk_snapshot_push_fill")
830 core.PuregoSafeRegister(&xSnapshotPushGlShader, libs, "gtk_snapshot_push_gl_shader")
831 core.PuregoSafeRegister(&xSnapshotPushMask, libs, "gtk_snapshot_push_mask")
832 core.PuregoSafeRegister(&xSnapshotPushOpacity, libs, "gtk_snapshot_push_opacity")
833 core.PuregoSafeRegister(&xSnapshotPushRepeat, libs, "gtk_snapshot_push_repeat")
834 core.PuregoSafeRegister(&xSnapshotPushRoundedClip, libs, "gtk_snapshot_push_rounded_clip")
835 core.PuregoSafeRegister(&xSnapshotPushShadow, libs, "gtk_snapshot_push_shadow")
836 core.PuregoSafeRegister(&xSnapshotPushStroke, libs, "gtk_snapshot_push_stroke")
837 core.PuregoSafeRegister(&xSnapshotRenderBackground, libs, "gtk_snapshot_render_background")
838 core.PuregoSafeRegister(&xSnapshotRenderFocus, libs, "gtk_snapshot_render_focus")
839 core.PuregoSafeRegister(&xSnapshotRenderFrame, libs, "gtk_snapshot_render_frame")
840 core.PuregoSafeRegister(&xSnapshotRenderInsertionCursor, libs, "gtk_snapshot_render_insertion_cursor")
841 core.PuregoSafeRegister(&xSnapshotRenderLayout, libs, "gtk_snapshot_render_layout")
842 core.PuregoSafeRegister(&xSnapshotRestore, libs, "gtk_snapshot_restore")
843 core.PuregoSafeRegister(&xSnapshotRotate, libs, "gtk_snapshot_rotate")
844 core.PuregoSafeRegister(&xSnapshotRotate3d, libs, "gtk_snapshot_rotate_3d")
845 core.PuregoSafeRegister(&xSnapshotSave, libs, "gtk_snapshot_save")
846 core.PuregoSafeRegister(&xSnapshotScale, libs, "gtk_snapshot_scale")
847 core.PuregoSafeRegister(&xSnapshotScale3d, libs, "gtk_snapshot_scale_3d")
848 core.PuregoSafeRegister(&xSnapshotToNode, libs, "gtk_snapshot_to_node")
849 core.PuregoSafeRegister(&xSnapshotToPaintable, libs, "gtk_snapshot_to_paintable")
850 core.PuregoSafeRegister(&xSnapshotTransform, libs, "gtk_snapshot_transform")
851 core.PuregoSafeRegister(&xSnapshotTransformMatrix, libs, "gtk_snapshot_transform_matrix")
852 core.PuregoSafeRegister(&xSnapshotTranslate, libs, "gtk_snapshot_translate")
853 core.PuregoSafeRegister(&xSnapshotTranslate3d, libs, "gtk_snapshot_translate_3d")
854
855}