v0.2.2 9100209

gskrendernode.go RawHistoryFolder

1// Package gsk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gsk
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/glib"
13	"github.com/bnema/puregotk/v4/gobject"
14	"github.com/bnema/puregotk/v4/gobject/types"
15	"github.com/bnema/puregotk/v4/graphene"
16)
17
18// Type of callback that is called when an error occurs
19// during node deserialization.
20type ParseErrorFunc func(*ParseLocation, *ParseLocation, *glib.Error, uintptr)
21
22// A color stop in a gradient node.
23type ColorStop struct {
24	_ structs.HostLayout
25
26	Offset float32
27
28	Color uintptr
29}
30
31func (x *ColorStop) GoPointer() uintptr {
32	return uintptr(unsafe.Pointer(x))
33}
34
35// A location in a parse buffer.
36type ParseLocation struct {
37	_ structs.HostLayout
38
39	Bytes uint
40
41	Chars uint
42
43	Lines uint
44
45	LineBytes uint
46
47	LineChars uint
48}
49
50func (x *ParseLocation) GoPointer() uintptr {
51	return uintptr(unsafe.Pointer(x))
52}
53
54// The shadow parameters in a shadow node.
55type Shadow struct {
56	_ structs.HostLayout
57
58	Color uintptr
59
60	Dx float32
61
62	Dy float32
63
64	Radius float32
65}
66
67func (x *Shadow) GoPointer() uintptr {
68	return uintptr(unsafe.Pointer(x))
69}
70
71var xSerializationErrorQuark func() glib.Quark
72
73// Registers an error quark for [class@Gsk.RenderNode] errors.
74func SerializationErrorQuark() glib.Quark {
75
76	cret := xSerializationErrorQuark()
77	return cret
78}
79
80var xValueDupRenderNode func(*gobject.Value) uintptr
81
82// Retrieves the render node stored inside a `GValue`,
83// and acquires a reference to it.
84func ValueDupRenderNode(ValueVar *gobject.Value) *RenderNode {
85	var cls *RenderNode
86
87	cret := xValueDupRenderNode(ValueVar)
88
89	if cret == 0 {
90		return nil
91	}
92	cls = &RenderNode{}
93	cls.Ptr = cret
94	return cls
95}
96
97var xValueGetRenderNode func(*gobject.Value) uintptr
98
99// Retrieves the render node stored inside a `GValue`.
100func ValueGetRenderNode(ValueVar *gobject.Value) *RenderNode {
101	var cls *RenderNode
102
103	cret := xValueGetRenderNode(ValueVar)
104
105	if cret == 0 {
106		return nil
107	}
108	gobject.IncreaseRef(cret)
109	cls = &RenderNode{}
110	cls.Ptr = cret
111	return cls
112}
113
114var xValueSetRenderNode func(*gobject.Value, uintptr)
115
116// Stores the given render node inside a `GValue`.
117//
118// The [struct@GObject.Value] will acquire a reference
119// to the render node.
120func ValueSetRenderNode(ValueVar *gobject.Value, NodeVar *RenderNode) {
121
122	xValueSetRenderNode(ValueVar, NodeVar.GoPointer())
123
124}
125
126var xValueTakeRenderNode func(*gobject.Value, uintptr)
127
128// Stores the given render node inside a `GValue`.
129//
130// This function transfers the ownership of the
131// render node to the `GValue`.
132func ValueTakeRenderNode(ValueVar *gobject.Value, NodeVar *RenderNode) {
133
134	xValueTakeRenderNode(ValueVar, NodeVar.GoPointer())
135
136}
137
138// The basic block in a scene graph to be rendered using [class@Gsk.Renderer].
139//
140// Each node has a parent, except the top-level node; each node may have
141// children nodes.
142//
143// Each node has an associated drawing surface, which has the size of
144// the rectangle set when creating it.
145//
146// Render nodes are meant to be transient; once they have been associated
147// to a [class@Gsk.Renderer] it's safe to release any reference you have on
148// them. All [class@Gsk.RenderNode]s are immutable, you can only specify their
149// properties during construction.
150type RenderNode struct {
151	Ptr uintptr
152}
153
154var xRenderNodeGLibType func() types.GType
155
156func RenderNodeGLibType() types.GType {
157	return xRenderNodeGLibType()
158}
159
160func RenderNodeNewFromInternalPtr(ptr uintptr) *RenderNode {
161	cls := &RenderNode{}
162	cls.Ptr = ptr
163	return cls
164}
165
166var xRenderNodeDraw func(uintptr, *cairo.Context)
167
168// Draws the contents of a render node on a cairo context.
169//
170// Typically, you'll use this function to implement fallback rendering
171// of render nodes on an intermediate Cairo context, instead of using
172// the drawing context associated to a [class@Gdk.Surface]'s rendering buffer.
173//
174// For advanced nodes that cannot be supported using Cairo, in particular
175// for nodes doing 3D operations, this function may fail.
176func (x *RenderNode) Draw(CrVar *cairo.Context) {
177
178	xRenderNodeDraw(x.GoPointer(), CrVar)
179
180}
181
182var xRenderNodeGetBounds func(uintptr, *graphene.Rect)
183
184// Retrieves the boundaries of the @node.
185//
186// The node will not draw outside of its boundaries.
187func (x *RenderNode) GetBounds(BoundsVar *graphene.Rect) {
188
189	xRenderNodeGetBounds(x.GoPointer(), BoundsVar)
190
191}
192
193var xRenderNodeGetNodeType func(uintptr) RenderNodeType
194
195// Returns the type of the render node.
196func (x *RenderNode) GetNodeType() RenderNodeType {
197
198	cret := xRenderNodeGetNodeType(x.GoPointer())
199	return cret
200}
201
202var xRenderNodeGetOpaqueRect func(uintptr, *graphene.Rect) bool
203
204// Gets an opaque rectangle inside the node that GTK can determine to
205// be fully opaque.
206//
207// There is no guarantee that this is indeed the largest opaque rectangle or
208// that regions outside the rectangle are not opaque. This function is a best
209// effort with that goal.
210//
211// The rectangle will be fully contained in the bounds of the node.
212func (x *RenderNode) GetOpaqueRect(OutOpaqueVar *graphene.Rect) bool {
213
214	cret := xRenderNodeGetOpaqueRect(x.GoPointer(), OutOpaqueVar)
215	return cret
216}
217
218var xRenderNodeRef func(uintptr) uintptr
219
220// Acquires a reference on the given `GskRenderNode`.
221func (x *RenderNode) Ref() *RenderNode {
222	var cls *RenderNode
223
224	cret := xRenderNodeRef(x.GoPointer())
225
226	if cret == 0 {
227		return nil
228	}
229	cls = &RenderNode{}
230	cls.Ptr = cret
231	return cls
232}
233
234var xRenderNodeSerialize func(uintptr) *glib.Bytes
235
236// Serializes the @node for later deserialization via
237// gsk_render_node_deserialize(). No guarantees are made about the format
238// used other than that the same version of GTK will be able to deserialize
239// the result of a call to gsk_render_node_serialize() and
240// gsk_render_node_deserialize() will correctly reject files it cannot open
241// that were created with previous versions of GTK.
242//
243// The intended use of this functions is testing, benchmarking and debugging.
244// The format is not meant as a permanent storage format.
245func (x *RenderNode) Serialize() *glib.Bytes {
246
247	cret := xRenderNodeSerialize(x.GoPointer())
248	return cret
249}
250
251var xRenderNodeUnref func(uintptr)
252
253// Releases a reference on the given `GskRenderNode`.
254//
255// If the reference was the last, the resources associated to the @node are
256// freed.
257func (x *RenderNode) Unref() {
258
259	xRenderNodeUnref(x.GoPointer())
260
261}
262
263var xRenderNodeWriteToFile func(uintptr, string, **glib.Error) bool
264
265// This function is equivalent to calling [method@Gsk.RenderNode.serialize]
266// followed by [func@GLib.file_set_contents].
267//
268// See those two functions for details on the arguments.
269//
270// It is mostly intended for use inside a debugger to quickly dump a render
271// node to a file for later inspection.
272func (x *RenderNode) WriteToFile(FilenameVar string) (bool, error) {
273	var cerr *glib.Error
274
275	cret := xRenderNodeWriteToFile(x.GoPointer(), FilenameVar, &cerr)
276	if cerr == nil {
277		return cret, nil
278	}
279	return cret, cerr
280
281}
282
283func (c *RenderNode) GoPointer() uintptr {
284	if c == nil {
285		return 0
286	}
287	return c.Ptr
288}
289
290func (c *RenderNode) SetGoPointer(ptr uintptr) {
291	c.Ptr = ptr
292}
293
294var xRenderNodeDeserialize func(*glib.Bytes, uintptr, uintptr) uintptr
295
296// Loads data previously created via [method@Gsk.RenderNode.serialize].
297//
298// For a discussion of the supported format, see that function.
299func RenderNodeDeserialize(BytesVar *glib.Bytes, ErrorFuncVar *ParseErrorFunc, UserDataVar uintptr) *RenderNode {
300	var cls *RenderNode
301
302	var ErrorFuncVarRef uintptr
303	if ErrorFuncVar != nil {
304		ErrorFuncVarPtr := uintptr(unsafe.Pointer(ErrorFuncVar))
305		if cbRefPtr, ok := glib.GetCallback(ErrorFuncVarPtr); ok {
306			ErrorFuncVarRef = cbRefPtr
307		} else {
308			fcb := func(arg0 *ParseLocation, arg1 *ParseLocation, arg2 *glib.Error, arg3 uintptr) {
309				cbFn := *ErrorFuncVar
310				cbFn(arg0, arg1, arg2, arg3)
311			}
312			ErrorFuncVarRef = purego.NewCallback(fcb)
313			glib.SaveCallbackWithClosure(ErrorFuncVarPtr, ErrorFuncVarRef, ErrorFuncVar)
314		}
315	}
316
317	cret := xRenderNodeDeserialize(BytesVar, ErrorFuncVarRef, UserDataVar)
318
319	if cret == 0 {
320		return nil
321	}
322	cls = &RenderNode{}
323	cls.Ptr = cret
324	return cls
325}
326
327func init() {
328	core.SetPackageName("GSK", "gtk4")
329	core.SetSharedLibraries("GSK", []string{"libgtk-4.so.1"})
330	var libs []uintptr
331	for _, libPath := range core.GetPaths("GSK") {
332		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
333		if err != nil {
334			panic(err)
335		}
336		libs = append(libs, lib)
337	}
338
339	core.PuregoSafeRegister(&xSerializationErrorQuark, libs, "gsk_serialization_error_quark")
340	core.PuregoSafeRegister(&xValueDupRenderNode, libs, "gsk_value_dup_render_node")
341	core.PuregoSafeRegister(&xValueGetRenderNode, libs, "gsk_value_get_render_node")
342	core.PuregoSafeRegister(&xValueSetRenderNode, libs, "gsk_value_set_render_node")
343	core.PuregoSafeRegister(&xValueTakeRenderNode, libs, "gsk_value_take_render_node")
344
345	core.PuregoSafeRegister(&xRenderNodeGLibType, libs, "gsk_render_node_get_type")
346
347	core.PuregoSafeRegister(&xRenderNodeDraw, libs, "gsk_render_node_draw")
348	core.PuregoSafeRegister(&xRenderNodeGetBounds, libs, "gsk_render_node_get_bounds")
349	core.PuregoSafeRegister(&xRenderNodeGetNodeType, libs, "gsk_render_node_get_node_type")
350	core.PuregoSafeRegister(&xRenderNodeGetOpaqueRect, libs, "gsk_render_node_get_opaque_rect")
351	core.PuregoSafeRegister(&xRenderNodeRef, libs, "gsk_render_node_ref")
352	core.PuregoSafeRegister(&xRenderNodeSerialize, libs, "gsk_render_node_serialize")
353	core.PuregoSafeRegister(&xRenderNodeUnref, libs, "gsk_render_node_unref")
354	core.PuregoSafeRegister(&xRenderNodeWriteToFile, libs, "gsk_render_node_write_to_file")
355
356	core.PuregoSafeRegister(&xRenderNodeDeserialize, libs, "gsk_render_node_deserialize")
357
358}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close