v0.2.1 c0399be

gdkgltexturebuilder.go RawHistoryFolder

1// Package gdk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gdk
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)
16
17type GLTextureBuilderClass struct {
18	_ structs.HostLayout
19}
20
21func (x *GLTextureBuilderClass) GoPointer() uintptr {
22	return uintptr(unsafe.Pointer(x))
23}
24
25// Constructs [class@Gdk.Texture] objects from GL textures.
26//
27// The operation is quite simple: Create a texture builder, set all the necessary
28// properties - keep in mind that the properties [property@Gdk.GLTextureBuilder:context],
29// [property@Gdk.GLTextureBuilder:id], [property@Gdk.GLTextureBuilder:width], and
30// [property@Gdk.GLTextureBuilder:height] are mandatory - and then call
31// [method@Gdk.GLTextureBuilder.build] to create the new texture.
32//
33// `GdkGLTextureBuilder` can be used for quick one-shot construction of
34// textures as well as kept around and reused to construct multiple textures.
35type GLTextureBuilder struct {
36	gobject.Object
37}
38
39var xGLTextureBuilderGLibType func() types.GType
40
41func GLTextureBuilderGLibType() types.GType {
42	return xGLTextureBuilderGLibType()
43}
44
45func GLTextureBuilderNewFromInternalPtr(ptr uintptr) *GLTextureBuilder {
46	cls := &GLTextureBuilder{}
47	cls.Ptr = ptr
48	return cls
49}
50
51var xNewGLTextureBuilder func() uintptr
52
53// Creates a new texture builder.
54func NewGLTextureBuilder() *GLTextureBuilder {
55	var cls *GLTextureBuilder
56
57	cret := xNewGLTextureBuilder()
58
59	if cret == 0 {
60		return nil
61	}
62	cls = &GLTextureBuilder{}
63	cls.Ptr = cret
64	return cls
65}
66
67var xGLTextureBuilderBuild func(uintptr, uintptr, uintptr) uintptr
68
69// Builds a new `GdkTexture` with the values set up in the builder.
70//
71// The `destroy` function gets called when the returned texture gets released;
72// either when the texture is finalized or by an explicit call to
73// [method@Gdk.GLTexture.release]. It should release all GL resources associated
74// with the texture, such as the [property@Gdk.GLTextureBuilder:id] and the
75// [property@Gdk.GLTextureBuilder:sync].
76//
77// Note that it is a programming error to call this function if any mandatory
78// property has not been set.
79//
80// It is possible to call this function multiple times to create multiple textures,
81// possibly with changing properties in between.
82func (x *GLTextureBuilder) Build(DestroyVar *glib.DestroyNotify, DataVar uintptr) *Texture {
83	var cls *Texture
84
85	var DestroyVarRef uintptr
86	if DestroyVar != nil {
87		DestroyVarPtr := uintptr(unsafe.Pointer(DestroyVar))
88		if cbRefPtr, ok := glib.GetCallback(DestroyVarPtr); ok {
89			DestroyVarRef = cbRefPtr
90		} else {
91			fcb := func(arg0 uintptr) {
92				cbFn := *DestroyVar
93				cbFn(arg0)
94			}
95			DestroyVarRef = purego.NewCallback(fcb)
96			glib.SaveCallbackWithClosure(DestroyVarPtr, DestroyVarRef, DestroyVar)
97		}
98	}
99
100	cret := xGLTextureBuilderBuild(x.GoPointer(), DestroyVarRef, DataVar)
101
102	if cret == 0 {
103		return nil
104	}
105	cls = &Texture{}
106	cls.Ptr = cret
107	return cls
108}
109
110var xGLTextureBuilderGetColorState func(uintptr) *ColorState
111
112// Gets the color state previously set via gdk_gl_texture_builder_set_color_state().
113func (x *GLTextureBuilder) GetColorState() *ColorState {
114
115	cret := xGLTextureBuilderGetColorState(x.GoPointer())
116	return cret
117}
118
119var xGLTextureBuilderGetContext func(uintptr) uintptr
120
121// Gets the context previously set via gdk_gl_texture_builder_set_context() or
122// %NULL if none was set.
123func (x *GLTextureBuilder) GetContext() *GLContext {
124	var cls *GLContext
125
126	cret := xGLTextureBuilderGetContext(x.GoPointer())
127
128	if cret == 0 {
129		return nil
130	}
131	gobject.IncreaseRef(cret)
132	cls = &GLContext{}
133	cls.Ptr = cret
134	return cls
135}
136
137var xGLTextureBuilderGetFormat func(uintptr) MemoryFormat
138
139// Gets the format previously set via gdk_gl_texture_builder_set_format().
140func (x *GLTextureBuilder) GetFormat() MemoryFormat {
141
142	cret := xGLTextureBuilderGetFormat(x.GoPointer())
143	return cret
144}
145
146var xGLTextureBuilderGetHasMipmap func(uintptr) bool
147
148// Gets whether the texture has a mipmap.
149func (x *GLTextureBuilder) GetHasMipmap() bool {
150
151	cret := xGLTextureBuilderGetHasMipmap(x.GoPointer())
152	return cret
153}
154
155var xGLTextureBuilderGetHeight func(uintptr) int
156
157// Gets the height previously set via gdk_gl_texture_builder_set_height() or
158// 0 if the height wasn't set.
159func (x *GLTextureBuilder) GetHeight() int {
160
161	cret := xGLTextureBuilderGetHeight(x.GoPointer())
162	return cret
163}
164
165var xGLTextureBuilderGetId func(uintptr) uint
166
167// Gets the texture id previously set via gdk_gl_texture_builder_set_id() or
168// 0 if the id wasn't set.
169func (x *GLTextureBuilder) GetId() uint {
170
171	cret := xGLTextureBuilderGetId(x.GoPointer())
172	return cret
173}
174
175var xGLTextureBuilderGetSync func(uintptr) uintptr
176
177// Gets the `GLsync` previously set via gdk_gl_texture_builder_set_sync().
178func (x *GLTextureBuilder) GetSync() uintptr {
179
180	cret := xGLTextureBuilderGetSync(x.GoPointer())
181	return cret
182}
183
184var xGLTextureBuilderGetUpdateRegion func(uintptr) *cairo.Region
185
186// Gets the region previously set via gdk_gl_texture_builder_set_update_region() or
187// %NULL if none was set.
188func (x *GLTextureBuilder) GetUpdateRegion() *cairo.Region {
189
190	cret := xGLTextureBuilderGetUpdateRegion(x.GoPointer())
191	return cret
192}
193
194var xGLTextureBuilderGetUpdateTexture func(uintptr) uintptr
195
196// Gets the texture previously set via gdk_gl_texture_builder_set_update_texture() or
197// %NULL if none was set.
198func (x *GLTextureBuilder) GetUpdateTexture() *Texture {
199	var cls *Texture
200
201	cret := xGLTextureBuilderGetUpdateTexture(x.GoPointer())
202
203	if cret == 0 {
204		return nil
205	}
206	gobject.IncreaseRef(cret)
207	cls = &Texture{}
208	cls.Ptr = cret
209	return cls
210}
211
212var xGLTextureBuilderGetWidth func(uintptr) int
213
214// Gets the width previously set via gdk_gl_texture_builder_set_width() or
215// 0 if the width wasn't set.
216func (x *GLTextureBuilder) GetWidth() int {
217
218	cret := xGLTextureBuilderGetWidth(x.GoPointer())
219	return cret
220}
221
222var xGLTextureBuilderSetColorState func(uintptr, *ColorState)
223
224// Sets the color state for the texture.
225//
226// By default, the sRGB colorstate is used. If you don't know what
227// colorstates are, this is probably the right thing.
228func (x *GLTextureBuilder) SetColorState(ColorStateVar *ColorState) {
229
230	xGLTextureBuilderSetColorState(x.GoPointer(), ColorStateVar)
231
232}
233
234var xGLTextureBuilderSetContext func(uintptr, uintptr)
235
236// Sets the context to be used for the texture. This is the context that owns
237// the texture.
238//
239// The context must be set before calling [method@Gdk.GLTextureBuilder.build].
240func (x *GLTextureBuilder) SetContext(ContextVar *GLContext) {
241
242	xGLTextureBuilderSetContext(x.GoPointer(), ContextVar.GoPointer())
243
244}
245
246var xGLTextureBuilderSetFormat func(uintptr, MemoryFormat)
247
248// Sets the format of the texture. The default is `GDK_MEMORY_R8G8B8A8_PREMULTIPLIED`.
249//
250// The format is the preferred format the texture data should be downloaded to. The
251// format must be supported by the GL version of [property@Gdk.GLTextureBuilder:context].
252//
253// GDK's texture download code assumes that the format corresponds to the storage
254// parameters of the GL texture in an obvious way. For example, a format of
255// `GDK_MEMORY_R16G16B16A16_PREMULTIPLIED` is expected to be stored as `GL_RGBA16`
256// texture, and `GDK_MEMORY_G8A8` is expected to be stored as `GL_RG8` texture.
257//
258// Setting the right format is particularly useful when using high bit depth textures
259// to preserve the bit depth, to set the correct value for unpremultiplied textures
260// and to make sure opaque textures are treated as such.
261//
262// Non-RGBA textures need to have swizzling parameters set up properly to be usable
263// in GSK's shaders.
264func (x *GLTextureBuilder) SetFormat(FormatVar MemoryFormat) {
265
266	xGLTextureBuilderSetFormat(x.GoPointer(), FormatVar)
267
268}
269
270var xGLTextureBuilderSetHasMipmap func(uintptr, bool)
271
272// Sets whether the texture has a mipmap. This allows the renderer and other users of the
273// generated texture to use a higher quality downscaling.
274//
275// Typically, the `glGenerateMipmap` function is used to generate a mimap.
276func (x *GLTextureBuilder) SetHasMipmap(HasMipmapVar bool) {
277
278	xGLTextureBuilderSetHasMipmap(x.GoPointer(), HasMipmapVar)
279
280}
281
282var xGLTextureBuilderSetHeight func(uintptr, int)
283
284// Sets the height of the texture.
285//
286// The height must be set before calling [method@Gdk.GLTextureBuilder.build].
287func (x *GLTextureBuilder) SetHeight(HeightVar int) {
288
289	xGLTextureBuilderSetHeight(x.GoPointer(), HeightVar)
290
291}
292
293var xGLTextureBuilderSetId func(uintptr, uint)
294
295// Sets the texture id of the texture. The texture id must remain unmodified
296// until the texture was finalized. See [method@Gdk.GLTextureBuilder.build]
297// for a longer discussion.
298//
299// The id must be set before calling [method@Gdk.GLTextureBuilder.build].
300func (x *GLTextureBuilder) SetId(IdVar uint) {
301
302	xGLTextureBuilderSetId(x.GoPointer(), IdVar)
303
304}
305
306var xGLTextureBuilderSetSync func(uintptr, uintptr)
307
308// Sets the GLSync object to use for the texture.
309//
310// GTK will wait on this object before using the created `GdkTexture`.
311//
312// The `destroy` function that is passed to [method@Gdk.GLTextureBuilder.build]
313// is responsible for freeing the sync object when it is no longer needed.
314// The texture builder does not destroy it and it is the callers
315// responsibility to make sure it doesn't leak.
316func (x *GLTextureBuilder) SetSync(SyncVar uintptr) {
317
318	xGLTextureBuilderSetSync(x.GoPointer(), SyncVar)
319
320}
321
322var xGLTextureBuilderSetUpdateRegion func(uintptr, *cairo.Region)
323
324// Sets the region to be updated by this texture. Together with
325// [property@Gdk.GLTextureBuilder:update-texture] this describes an
326// update of a previous texture.
327//
328// When rendering animations of large textures, it is possible that
329// consecutive textures are only updating contents in parts of the texture.
330// It is then possible to describe this update via these two properties,
331// so that GTK can avoid rerendering parts that did not change.
332//
333// An example would be a screen recording where only the mouse pointer moves.
334func (x *GLTextureBuilder) SetUpdateRegion(RegionVar *cairo.Region) {
335
336	xGLTextureBuilderSetUpdateRegion(x.GoPointer(), RegionVar)
337
338}
339
340var xGLTextureBuilderSetUpdateTexture func(uintptr, uintptr)
341
342// Sets the texture to be updated by this texture. See
343// [method@Gdk.GLTextureBuilder.set_update_region] for an explanation.
344func (x *GLTextureBuilder) SetUpdateTexture(TextureVar *Texture) {
345
346	xGLTextureBuilderSetUpdateTexture(x.GoPointer(), TextureVar.GoPointer())
347
348}
349
350var xGLTextureBuilderSetWidth func(uintptr, int)
351
352// Sets the width of the texture.
353//
354// The width must be set before calling [method@Gdk.GLTextureBuilder.build].
355func (x *GLTextureBuilder) SetWidth(WidthVar int) {
356
357	xGLTextureBuilderSetWidth(x.GoPointer(), WidthVar)
358
359}
360
361func (c *GLTextureBuilder) GoPointer() uintptr {
362	if c == nil {
363		return 0
364	}
365	return c.Ptr
366}
367
368func (c *GLTextureBuilder) SetGoPointer(ptr uintptr) {
369	c.Ptr = ptr
370}
371
372// SetPropertyColorState sets the "color-state" property.
373// The color state of the texture.
374func (x *GLTextureBuilder) SetPropertyColorState(value uintptr) {
375	var v gobject.Value
376	v.Init(gobject.TypePointerVal)
377	v.SetPointer(value)
378	x.SetProperty("color-state", &v)
379}
380
381// GetPropertyColorState gets the "color-state" property.
382// The color state of the texture.
383func (x *GLTextureBuilder) GetPropertyColorState() uintptr {
384	var v gobject.Value
385	x.GetProperty("color-state", &v)
386	return v.GetPointer()
387}
388
389// SetPropertyHasMipmap sets the "has-mipmap" property.
390// If the texture has a mipmap.
391func (x *GLTextureBuilder) SetPropertyHasMipmap(value bool) {
392	var v gobject.Value
393	v.Init(gobject.TypeBooleanVal)
394	v.SetBoolean(value)
395	x.SetProperty("has-mipmap", &v)
396}
397
398// GetPropertyHasMipmap gets the "has-mipmap" property.
399// If the texture has a mipmap.
400func (x *GLTextureBuilder) GetPropertyHasMipmap() bool {
401	var v gobject.Value
402	x.GetProperty("has-mipmap", &v)
403	return v.GetBoolean()
404}
405
406// SetPropertyHeight sets the "height" property.
407// The height of the texture.
408func (x *GLTextureBuilder) SetPropertyHeight(value int) {
409	var v gobject.Value
410	v.Init(gobject.TypeIntVal)
411	v.SetInt(value)
412	x.SetProperty("height", &v)
413}
414
415// GetPropertyHeight gets the "height" property.
416// The height of the texture.
417func (x *GLTextureBuilder) GetPropertyHeight() int {
418	var v gobject.Value
419	x.GetProperty("height", &v)
420	return v.GetInt()
421}
422
423// SetPropertyId sets the "id" property.
424// The texture ID to use.
425func (x *GLTextureBuilder) SetPropertyId(value uint) {
426	var v gobject.Value
427	v.Init(gobject.TypeUintVal)
428	v.SetUint(value)
429	x.SetProperty("id", &v)
430}
431
432// GetPropertyId gets the "id" property.
433// The texture ID to use.
434func (x *GLTextureBuilder) GetPropertyId() uint {
435	var v gobject.Value
436	x.GetProperty("id", &v)
437	return v.GetUint()
438}
439
440// SetPropertySync sets the "sync" property.
441// An optional `GLSync` object.
442//
443// If this is set, GTK will wait on it before using the texture.
444func (x *GLTextureBuilder) SetPropertySync(value uintptr) {
445	var v gobject.Value
446	v.Init(gobject.TypePointerVal)
447	v.SetPointer(value)
448	x.SetProperty("sync", &v)
449}
450
451// GetPropertySync gets the "sync" property.
452// An optional `GLSync` object.
453//
454// If this is set, GTK will wait on it before using the texture.
455func (x *GLTextureBuilder) GetPropertySync() uintptr {
456	var v gobject.Value
457	x.GetProperty("sync", &v)
458	return v.GetPointer()
459}
460
461// SetPropertyUpdateRegion sets the "update-region" property.
462// The update region for [property@Gdk.GLTextureBuilder:update-texture].
463func (x *GLTextureBuilder) SetPropertyUpdateRegion(value uintptr) {
464	var v gobject.Value
465	v.Init(gobject.TypePointerVal)
466	v.SetPointer(value)
467	x.SetProperty("update-region", &v)
468}
469
470// GetPropertyUpdateRegion gets the "update-region" property.
471// The update region for [property@Gdk.GLTextureBuilder:update-texture].
472func (x *GLTextureBuilder) GetPropertyUpdateRegion() uintptr {
473	var v gobject.Value
474	x.GetProperty("update-region", &v)
475	return v.GetPointer()
476}
477
478// SetPropertyWidth sets the "width" property.
479// The width of the texture.
480func (x *GLTextureBuilder) SetPropertyWidth(value int) {
481	var v gobject.Value
482	v.Init(gobject.TypeIntVal)
483	v.SetInt(value)
484	x.SetProperty("width", &v)
485}
486
487// GetPropertyWidth gets the "width" property.
488// The width of the texture.
489func (x *GLTextureBuilder) GetPropertyWidth() int {
490	var v gobject.Value
491	x.GetProperty("width", &v)
492	return v.GetInt()
493}
494
495func init() {
496	core.SetPackageName("GDK", "gtk4")
497	core.SetSharedLibraries("GDK", []string{"libgtk-4.so.1"})
498	var libs []uintptr
499	for _, libPath := range core.GetPaths("GDK") {
500		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
501		if err != nil {
502			panic(err)
503		}
504		libs = append(libs, lib)
505	}
506
507	core.PuregoSafeRegister(&xGLTextureBuilderGLibType, libs, "gdk_gl_texture_builder_get_type")
508
509	core.PuregoSafeRegister(&xNewGLTextureBuilder, libs, "gdk_gl_texture_builder_new")
510
511	core.PuregoSafeRegister(&xGLTextureBuilderBuild, libs, "gdk_gl_texture_builder_build")
512	core.PuregoSafeRegister(&xGLTextureBuilderGetColorState, libs, "gdk_gl_texture_builder_get_color_state")
513	core.PuregoSafeRegister(&xGLTextureBuilderGetContext, libs, "gdk_gl_texture_builder_get_context")
514	core.PuregoSafeRegister(&xGLTextureBuilderGetFormat, libs, "gdk_gl_texture_builder_get_format")
515	core.PuregoSafeRegister(&xGLTextureBuilderGetHasMipmap, libs, "gdk_gl_texture_builder_get_has_mipmap")
516	core.PuregoSafeRegister(&xGLTextureBuilderGetHeight, libs, "gdk_gl_texture_builder_get_height")
517	core.PuregoSafeRegister(&xGLTextureBuilderGetId, libs, "gdk_gl_texture_builder_get_id")
518	core.PuregoSafeRegister(&xGLTextureBuilderGetSync, libs, "gdk_gl_texture_builder_get_sync")
519	core.PuregoSafeRegister(&xGLTextureBuilderGetUpdateRegion, libs, "gdk_gl_texture_builder_get_update_region")
520	core.PuregoSafeRegister(&xGLTextureBuilderGetUpdateTexture, libs, "gdk_gl_texture_builder_get_update_texture")
521	core.PuregoSafeRegister(&xGLTextureBuilderGetWidth, libs, "gdk_gl_texture_builder_get_width")
522	core.PuregoSafeRegister(&xGLTextureBuilderSetColorState, libs, "gdk_gl_texture_builder_set_color_state")
523	core.PuregoSafeRegister(&xGLTextureBuilderSetContext, libs, "gdk_gl_texture_builder_set_context")
524	core.PuregoSafeRegister(&xGLTextureBuilderSetFormat, libs, "gdk_gl_texture_builder_set_format")
525	core.PuregoSafeRegister(&xGLTextureBuilderSetHasMipmap, libs, "gdk_gl_texture_builder_set_has_mipmap")
526	core.PuregoSafeRegister(&xGLTextureBuilderSetHeight, libs, "gdk_gl_texture_builder_set_height")
527	core.PuregoSafeRegister(&xGLTextureBuilderSetId, libs, "gdk_gl_texture_builder_set_id")
528	core.PuregoSafeRegister(&xGLTextureBuilderSetSync, libs, "gdk_gl_texture_builder_set_sync")
529	core.PuregoSafeRegister(&xGLTextureBuilderSetUpdateRegion, libs, "gdk_gl_texture_builder_set_update_region")
530	core.PuregoSafeRegister(&xGLTextureBuilderSetUpdateTexture, libs, "gdk_gl_texture_builder_set_update_texture")
531	core.PuregoSafeRegister(&xGLTextureBuilderSetWidth, libs, "gdk_gl_texture_builder_set_width")
532
533}

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