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 MemoryTextureBuilderClass struct {
18 _ structs.HostLayout
19}
20
21func (x *MemoryTextureBuilderClass) GoPointer() uintptr {
22 return uintptr(unsafe.Pointer(x))
23}
24
25// Constructs [class@Gdk.Texture] objects from system memory provided
26// via [struct@GLib.Bytes].
27//
28// The operation is quite simple: Create a texture builder, set all the necessary
29// properties - keep in mind that the properties [property@Gdk.MemoryTextureBuilder:bytes],
30// [property@Gdk.MemoryTextureBuilder:stride], [property@Gdk.MemoryTextureBuilder:width],
31// and [property@Gdk.MemoryTextureBuilder:height] are mandatory - and then call
32// [method@Gdk.MemoryTextureBuilder.build] to create the new texture.
33//
34// `GdkMemoryTextureBuilder` can be used for quick one-shot construction of
35// textures as well as kept around and reused to construct multiple textures.
36type MemoryTextureBuilder struct {
37 gobject.Object
38}
39
40var xMemoryTextureBuilderGLibType func() types.GType
41
42func MemoryTextureBuilderGLibType() types.GType {
43 return xMemoryTextureBuilderGLibType()
44}
45
46func MemoryTextureBuilderNewFromInternalPtr(ptr uintptr) *MemoryTextureBuilder {
47 cls := &MemoryTextureBuilder{}
48 cls.Ptr = ptr
49 return cls
50}
51
52var xNewMemoryTextureBuilder func() uintptr
53
54// Creates a new texture builder.
55func NewMemoryTextureBuilder() *MemoryTextureBuilder {
56 var cls *MemoryTextureBuilder
57
58 cret := xNewMemoryTextureBuilder()
59
60 if cret == 0 {
61 return nil
62 }
63 cls = &MemoryTextureBuilder{}
64 cls.Ptr = cret
65 return cls
66}
67
68var xMemoryTextureBuilderBuild func(uintptr) uintptr
69
70// Builds a new `GdkTexture` with the values set up in the builder.
71//
72// Note that it is a programming error to call this function if any mandatory
73// property has not been set.
74//
75// It is possible to call this function multiple times to create multiple textures,
76// possibly with changing properties in between.
77func (x *MemoryTextureBuilder) Build() *Texture {
78 var cls *Texture
79
80 cret := xMemoryTextureBuilderBuild(x.GoPointer())
81
82 if cret == 0 {
83 return nil
84 }
85 cls = &Texture{}
86 cls.Ptr = cret
87 return cls
88}
89
90var xMemoryTextureBuilderGetBytes func(uintptr) *glib.Bytes
91
92// Gets the bytes previously set via gdk_memory_texture_builder_set_bytes()
93// or %NULL if none was set.
94func (x *MemoryTextureBuilder) GetBytes() *glib.Bytes {
95
96 cret := xMemoryTextureBuilderGetBytes(x.GoPointer())
97 return cret
98}
99
100var xMemoryTextureBuilderGetColorState func(uintptr) *ColorState
101
102// Gets the colorstate previously set via gdk_memory_texture_builder_set_color_state().
103func (x *MemoryTextureBuilder) GetColorState() *ColorState {
104
105 cret := xMemoryTextureBuilderGetColorState(x.GoPointer())
106 return cret
107}
108
109var xMemoryTextureBuilderGetFormat func(uintptr) MemoryFormat
110
111// Gets the format previously set via gdk_memory_texture_builder_set_format().
112func (x *MemoryTextureBuilder) GetFormat() MemoryFormat {
113
114 cret := xMemoryTextureBuilderGetFormat(x.GoPointer())
115 return cret
116}
117
118var xMemoryTextureBuilderGetHeight func(uintptr) int
119
120// Gets the height previously set via gdk_memory_texture_builder_set_height()
121// or 0 if the height wasn't set.
122func (x *MemoryTextureBuilder) GetHeight() int {
123
124 cret := xMemoryTextureBuilderGetHeight(x.GoPointer())
125 return cret
126}
127
128var xMemoryTextureBuilderGetOffset func(uintptr, uint) uint
129
130// Gets the offset previously set via gdk_memory_texture_builder_set_offset().
131func (x *MemoryTextureBuilder) GetOffset(PlaneVar uint) uint {
132
133 cret := xMemoryTextureBuilderGetOffset(x.GoPointer(), PlaneVar)
134 return cret
135}
136
137var xMemoryTextureBuilderGetStride func(uintptr) uint
138
139// Gets the stride previously set via gdk_memory_texture_builder_set_stride().
140func (x *MemoryTextureBuilder) GetStride() uint {
141
142 cret := xMemoryTextureBuilderGetStride(x.GoPointer())
143 return cret
144}
145
146var xMemoryTextureBuilderGetStrideForPlane func(uintptr, uint) uint
147
148// Gets the stride previously set via gdk_memory_texture_builder_set_stride_for_plane().
149func (x *MemoryTextureBuilder) GetStrideForPlane(PlaneVar uint) uint {
150
151 cret := xMemoryTextureBuilderGetStrideForPlane(x.GoPointer(), PlaneVar)
152 return cret
153}
154
155var xMemoryTextureBuilderGetUpdateRegion func(uintptr) *cairo.Region
156
157// Gets the region previously set via gdk_memory_texture_builder_set_update_region()
158// or %NULL if none was set.
159func (x *MemoryTextureBuilder) GetUpdateRegion() *cairo.Region {
160
161 cret := xMemoryTextureBuilderGetUpdateRegion(x.GoPointer())
162 return cret
163}
164
165var xMemoryTextureBuilderGetUpdateTexture func(uintptr) uintptr
166
167// Gets the texture previously set via gdk_memory_texture_builder_set_update_texture()
168// or %NULL if none was set.
169func (x *MemoryTextureBuilder) GetUpdateTexture() *Texture {
170 var cls *Texture
171
172 cret := xMemoryTextureBuilderGetUpdateTexture(x.GoPointer())
173
174 if cret == 0 {
175 return nil
176 }
177 gobject.IncreaseRef(cret)
178 cls = &Texture{}
179 cls.Ptr = cret
180 return cls
181}
182
183var xMemoryTextureBuilderGetWidth func(uintptr) int
184
185// Gets the width previously set via gdk_memory_texture_builder_set_width()
186// or 0 if the width wasn't set.
187func (x *MemoryTextureBuilder) GetWidth() int {
188
189 cret := xMemoryTextureBuilderGetWidth(x.GoPointer())
190 return cret
191}
192
193var xMemoryTextureBuilderSetBytes func(uintptr, *glib.Bytes)
194
195// Sets the data to be shown but the texture.
196//
197// The bytes must be set before calling [method@Gdk.MemoryTextureBuilder.build].
198func (x *MemoryTextureBuilder) SetBytes(BytesVar *glib.Bytes) {
199
200 xMemoryTextureBuilderSetBytes(x.GoPointer(), BytesVar)
201
202}
203
204var xMemoryTextureBuilderSetColorState func(uintptr, *ColorState)
205
206// Sets the colorstate describing the data.
207//
208// By default, the sRGB colorstate is used. If you don't know
209// what colorstates are, this is probably the right thing.
210func (x *MemoryTextureBuilder) SetColorState(ColorStateVar *ColorState) {
211
212 xMemoryTextureBuilderSetColorState(x.GoPointer(), ColorStateVar)
213
214}
215
216var xMemoryTextureBuilderSetFormat func(uintptr, MemoryFormat)
217
218// Sets the format of the bytes.
219//
220// The default is `GDK_MEMORY_R8G8B8A8_PREMULTIPLIED`.
221func (x *MemoryTextureBuilder) SetFormat(FormatVar MemoryFormat) {
222
223 xMemoryTextureBuilderSetFormat(x.GoPointer(), FormatVar)
224
225}
226
227var xMemoryTextureBuilderSetHeight func(uintptr, int)
228
229// Sets the height of the texture.
230//
231// The height must be set before calling [method@Gdk.MemoryTextureBuilder.build]
232// and conform to size requirements of the provided format.
233func (x *MemoryTextureBuilder) SetHeight(HeightVar int) {
234
235 xMemoryTextureBuilderSetHeight(x.GoPointer(), HeightVar)
236
237}
238
239var xMemoryTextureBuilderSetOffset func(uintptr, uint, uint)
240
241// Sets the offset of the texture for @plane.
242func (x *MemoryTextureBuilder) SetOffset(PlaneVar uint, OffsetVar uint) {
243
244 xMemoryTextureBuilderSetOffset(x.GoPointer(), PlaneVar, OffsetVar)
245
246}
247
248var xMemoryTextureBuilderSetStride func(uintptr, uint)
249
250// Sets the rowstride of the bytes used.
251//
252// The rowstride must be set before calling [method@Gdk.MemoryTextureBuilder.build].
253func (x *MemoryTextureBuilder) SetStride(StrideVar uint) {
254
255 xMemoryTextureBuilderSetStride(x.GoPointer(), StrideVar)
256
257}
258
259var xMemoryTextureBuilderSetStrideForPlane func(uintptr, uint, uint)
260
261// Sets the stride of the texture for @plane.
262func (x *MemoryTextureBuilder) SetStrideForPlane(PlaneVar uint, StrideVar uint) {
263
264 xMemoryTextureBuilderSetStrideForPlane(x.GoPointer(), PlaneVar, StrideVar)
265
266}
267
268var xMemoryTextureBuilderSetUpdateRegion func(uintptr, *cairo.Region)
269
270// Sets the region to be updated by this texture.
271//
272// Together with [property@Gdk.MemoryTextureBuilder:update-texture],
273// this describes an update of a previous texture.
274//
275// When rendering animations of large textures, it is possible that
276// consecutive textures are only updating contents in parts of the texture.
277// It is then possible to describe this update via these two properties,
278// so that GTK can avoid rerendering parts that did not change.
279//
280// An example would be a screen recording where only the mouse pointer moves.
281func (x *MemoryTextureBuilder) SetUpdateRegion(RegionVar *cairo.Region) {
282
283 xMemoryTextureBuilderSetUpdateRegion(x.GoPointer(), RegionVar)
284
285}
286
287var xMemoryTextureBuilderSetUpdateTexture func(uintptr, uintptr)
288
289// Sets the texture to be updated by this texture.
290//
291// See [method@Gdk.MemoryTextureBuilder.set_update_region] for an explanation.
292func (x *MemoryTextureBuilder) SetUpdateTexture(TextureVar *Texture) {
293
294 xMemoryTextureBuilderSetUpdateTexture(x.GoPointer(), TextureVar.GoPointer())
295
296}
297
298var xMemoryTextureBuilderSetWidth func(uintptr, int)
299
300// Sets the width of the texture.
301//
302// The width must be set before calling [method@Gdk.MemoryTextureBuilder.build]
303// and conform to size requirements of the provided format.
304func (x *MemoryTextureBuilder) SetWidth(WidthVar int) {
305
306 xMemoryTextureBuilderSetWidth(x.GoPointer(), WidthVar)
307
308}
309
310func (c *MemoryTextureBuilder) GoPointer() uintptr {
311 if c == nil {
312 return 0
313 }
314 return c.Ptr
315}
316
317func (c *MemoryTextureBuilder) SetGoPointer(ptr uintptr) {
318 c.Ptr = ptr
319}
320
321// SetPropertyBytes sets the "bytes" property.
322// The bytes holding the data.
323func (x *MemoryTextureBuilder) SetPropertyBytes(value uintptr) {
324 var v gobject.Value
325 v.Init(gobject.TypePointerVal)
326 v.SetPointer(value)
327 x.SetProperty("bytes", &v)
328}
329
330// GetPropertyBytes gets the "bytes" property.
331// The bytes holding the data.
332func (x *MemoryTextureBuilder) GetPropertyBytes() uintptr {
333 var v gobject.Value
334 x.GetProperty("bytes", &v)
335 return v.GetPointer()
336}
337
338// SetPropertyColorState sets the "color-state" property.
339// The colorstate describing the data.
340func (x *MemoryTextureBuilder) SetPropertyColorState(value uintptr) {
341 var v gobject.Value
342 v.Init(gobject.TypePointerVal)
343 v.SetPointer(value)
344 x.SetProperty("color-state", &v)
345}
346
347// GetPropertyColorState gets the "color-state" property.
348// The colorstate describing the data.
349func (x *MemoryTextureBuilder) GetPropertyColorState() uintptr {
350 var v gobject.Value
351 x.GetProperty("color-state", &v)
352 return v.GetPointer()
353}
354
355// SetPropertyHeight sets the "height" property.
356// The height of the texture.
357func (x *MemoryTextureBuilder) SetPropertyHeight(value int) {
358 var v gobject.Value
359 v.Init(gobject.TypeIntVal)
360 v.SetInt(value)
361 x.SetProperty("height", &v)
362}
363
364// GetPropertyHeight gets the "height" property.
365// The height of the texture.
366func (x *MemoryTextureBuilder) GetPropertyHeight() int {
367 var v gobject.Value
368 x.GetProperty("height", &v)
369 return v.GetInt()
370}
371
372// SetPropertyStride sets the "stride" property.
373// The rowstride of the texture.
374//
375// The rowstride is the number of bytes between the first pixel
376// in a row of image data, and the first pixel in the next row.
377func (x *MemoryTextureBuilder) SetPropertyStride(value uint64) {
378 var v gobject.Value
379 v.Init(gobject.TypeUint64Val)
380 v.SetUint64(value)
381 x.SetProperty("stride", &v)
382}
383
384// GetPropertyStride gets the "stride" property.
385// The rowstride of the texture.
386//
387// The rowstride is the number of bytes between the first pixel
388// in a row of image data, and the first pixel in the next row.
389func (x *MemoryTextureBuilder) GetPropertyStride() uint64 {
390 var v gobject.Value
391 x.GetProperty("stride", &v)
392 return v.GetUint64()
393}
394
395// SetPropertyUpdateRegion sets the "update-region" property.
396// The update region for [property@Gdk.MemoryTextureBuilder:update-texture].
397func (x *MemoryTextureBuilder) SetPropertyUpdateRegion(value uintptr) {
398 var v gobject.Value
399 v.Init(gobject.TypePointerVal)
400 v.SetPointer(value)
401 x.SetProperty("update-region", &v)
402}
403
404// GetPropertyUpdateRegion gets the "update-region" property.
405// The update region for [property@Gdk.MemoryTextureBuilder:update-texture].
406func (x *MemoryTextureBuilder) GetPropertyUpdateRegion() uintptr {
407 var v gobject.Value
408 x.GetProperty("update-region", &v)
409 return v.GetPointer()
410}
411
412// SetPropertyWidth sets the "width" property.
413// The width of the texture.
414func (x *MemoryTextureBuilder) SetPropertyWidth(value int) {
415 var v gobject.Value
416 v.Init(gobject.TypeIntVal)
417 v.SetInt(value)
418 x.SetProperty("width", &v)
419}
420
421// GetPropertyWidth gets the "width" property.
422// The width of the texture.
423func (x *MemoryTextureBuilder) GetPropertyWidth() int {
424 var v gobject.Value
425 x.GetProperty("width", &v)
426 return v.GetInt()
427}
428
429func init() {
430 core.SetPackageName("GDK", "gtk4")
431 core.SetSharedLibraries("GDK", []string{"libgtk-4.so.1"})
432 var libs []uintptr
433 for _, libPath := range core.GetPaths("GDK") {
434 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
435 if err != nil {
436 panic(err)
437 }
438 libs = append(libs, lib)
439 }
440
441 core.PuregoSafeRegister(&xMemoryTextureBuilderGLibType, libs, "gdk_memory_texture_builder_get_type")
442
443 core.PuregoSafeRegister(&xNewMemoryTextureBuilder, libs, "gdk_memory_texture_builder_new")
444
445 core.PuregoSafeRegister(&xMemoryTextureBuilderBuild, libs, "gdk_memory_texture_builder_build")
446 core.PuregoSafeRegister(&xMemoryTextureBuilderGetBytes, libs, "gdk_memory_texture_builder_get_bytes")
447 core.PuregoSafeRegister(&xMemoryTextureBuilderGetColorState, libs, "gdk_memory_texture_builder_get_color_state")
448 core.PuregoSafeRegister(&xMemoryTextureBuilderGetFormat, libs, "gdk_memory_texture_builder_get_format")
449 core.PuregoSafeRegister(&xMemoryTextureBuilderGetHeight, libs, "gdk_memory_texture_builder_get_height")
450 core.PuregoSafeRegister(&xMemoryTextureBuilderGetOffset, libs, "gdk_memory_texture_builder_get_offset")
451 core.PuregoSafeRegister(&xMemoryTextureBuilderGetStride, libs, "gdk_memory_texture_builder_get_stride")
452 core.PuregoSafeRegister(&xMemoryTextureBuilderGetStrideForPlane, libs, "gdk_memory_texture_builder_get_stride_for_plane")
453 core.PuregoSafeRegister(&xMemoryTextureBuilderGetUpdateRegion, libs, "gdk_memory_texture_builder_get_update_region")
454 core.PuregoSafeRegister(&xMemoryTextureBuilderGetUpdateTexture, libs, "gdk_memory_texture_builder_get_update_texture")
455 core.PuregoSafeRegister(&xMemoryTextureBuilderGetWidth, libs, "gdk_memory_texture_builder_get_width")
456 core.PuregoSafeRegister(&xMemoryTextureBuilderSetBytes, libs, "gdk_memory_texture_builder_set_bytes")
457 core.PuregoSafeRegister(&xMemoryTextureBuilderSetColorState, libs, "gdk_memory_texture_builder_set_color_state")
458 core.PuregoSafeRegister(&xMemoryTextureBuilderSetFormat, libs, "gdk_memory_texture_builder_set_format")
459 core.PuregoSafeRegister(&xMemoryTextureBuilderSetHeight, libs, "gdk_memory_texture_builder_set_height")
460 core.PuregoSafeRegister(&xMemoryTextureBuilderSetOffset, libs, "gdk_memory_texture_builder_set_offset")
461 core.PuregoSafeRegister(&xMemoryTextureBuilderSetStride, libs, "gdk_memory_texture_builder_set_stride")
462 core.PuregoSafeRegister(&xMemoryTextureBuilderSetStrideForPlane, libs, "gdk_memory_texture_builder_set_stride_for_plane")
463 core.PuregoSafeRegister(&xMemoryTextureBuilderSetUpdateRegion, libs, "gdk_memory_texture_builder_set_update_region")
464 core.PuregoSafeRegister(&xMemoryTextureBuilderSetUpdateTexture, libs, "gdk_memory_texture_builder_set_update_texture")
465 core.PuregoSafeRegister(&xMemoryTextureBuilderSetWidth, libs, "gdk_memory_texture_builder_set_width")
466
467}