// Package gdk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gdk import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/cairo" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type GLTextureBuilderClass struct { _ structs.HostLayout } func (x *GLTextureBuilderClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // Constructs [class@Gdk.Texture] objects from GL textures. // // The operation is quite simple: Create a texture builder, set all the necessary // properties - keep in mind that the properties [property@Gdk.GLTextureBuilder:context], // [property@Gdk.GLTextureBuilder:id], [property@Gdk.GLTextureBuilder:width], and // [property@Gdk.GLTextureBuilder:height] are mandatory - and then call // [method@Gdk.GLTextureBuilder.build] to create the new texture. // // `GdkGLTextureBuilder` can be used for quick one-shot construction of // textures as well as kept around and reused to construct multiple textures. type GLTextureBuilder struct { gobject.Object } var xGLTextureBuilderGLibType func() types.GType func GLTextureBuilderGLibType() types.GType { return xGLTextureBuilderGLibType() } func GLTextureBuilderNewFromInternalPtr(ptr uintptr) *GLTextureBuilder { cls := &GLTextureBuilder{} cls.Ptr = ptr return cls } var xNewGLTextureBuilder func() uintptr // Creates a new texture builder. func NewGLTextureBuilder() *GLTextureBuilder { var cls *GLTextureBuilder cret := xNewGLTextureBuilder() if cret == 0 { return nil } cls = &GLTextureBuilder{} cls.Ptr = cret return cls } var xGLTextureBuilderBuild func(uintptr, uintptr, uintptr) uintptr // Builds a new `GdkTexture` with the values set up in the builder. // // The `destroy` function gets called when the returned texture gets released; // either when the texture is finalized or by an explicit call to // [method@Gdk.GLTexture.release]. It should release all GL resources associated // with the texture, such as the [property@Gdk.GLTextureBuilder:id] and the // [property@Gdk.GLTextureBuilder:sync]. // // Note that it is a programming error to call this function if any mandatory // property has not been set. // // It is possible to call this function multiple times to create multiple textures, // possibly with changing properties in between. func (x *GLTextureBuilder) Build(DestroyVar *glib.DestroyNotify, DataVar uintptr) *Texture { var cls *Texture var DestroyVarRef uintptr if DestroyVar != nil { DestroyVarPtr := uintptr(unsafe.Pointer(DestroyVar)) if cbRefPtr, ok := glib.GetCallback(DestroyVarPtr); ok { DestroyVarRef = cbRefPtr } else { fcb := func(arg0 uintptr) { cbFn := *DestroyVar cbFn(arg0) } DestroyVarRef = purego.NewCallback(fcb) glib.SaveCallbackWithClosure(DestroyVarPtr, DestroyVarRef, DestroyVar) } } cret := xGLTextureBuilderBuild(x.GoPointer(), DestroyVarRef, DataVar) if cret == 0 { return nil } cls = &Texture{} cls.Ptr = cret return cls } var xGLTextureBuilderGetColorState func(uintptr) *ColorState // Gets the color state previously set via gdk_gl_texture_builder_set_color_state(). func (x *GLTextureBuilder) GetColorState() *ColorState { cret := xGLTextureBuilderGetColorState(x.GoPointer()) return cret } var xGLTextureBuilderGetContext func(uintptr) uintptr // Gets the context previously set via gdk_gl_texture_builder_set_context() or // %NULL if none was set. func (x *GLTextureBuilder) GetContext() *GLContext { var cls *GLContext cret := xGLTextureBuilderGetContext(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &GLContext{} cls.Ptr = cret return cls } var xGLTextureBuilderGetFormat func(uintptr) MemoryFormat // Gets the format previously set via gdk_gl_texture_builder_set_format(). func (x *GLTextureBuilder) GetFormat() MemoryFormat { cret := xGLTextureBuilderGetFormat(x.GoPointer()) return cret } var xGLTextureBuilderGetHasMipmap func(uintptr) bool // Gets whether the texture has a mipmap. func (x *GLTextureBuilder) GetHasMipmap() bool { cret := xGLTextureBuilderGetHasMipmap(x.GoPointer()) return cret } var xGLTextureBuilderGetHeight func(uintptr) int // Gets the height previously set via gdk_gl_texture_builder_set_height() or // 0 if the height wasn't set. func (x *GLTextureBuilder) GetHeight() int { cret := xGLTextureBuilderGetHeight(x.GoPointer()) return cret } var xGLTextureBuilderGetId func(uintptr) uint // Gets the texture id previously set via gdk_gl_texture_builder_set_id() or // 0 if the id wasn't set. func (x *GLTextureBuilder) GetId() uint { cret := xGLTextureBuilderGetId(x.GoPointer()) return cret } var xGLTextureBuilderGetSync func(uintptr) uintptr // Gets the `GLsync` previously set via gdk_gl_texture_builder_set_sync(). func (x *GLTextureBuilder) GetSync() uintptr { cret := xGLTextureBuilderGetSync(x.GoPointer()) return cret } var xGLTextureBuilderGetUpdateRegion func(uintptr) *cairo.Region // Gets the region previously set via gdk_gl_texture_builder_set_update_region() or // %NULL if none was set. func (x *GLTextureBuilder) GetUpdateRegion() *cairo.Region { cret := xGLTextureBuilderGetUpdateRegion(x.GoPointer()) return cret } var xGLTextureBuilderGetUpdateTexture func(uintptr) uintptr // Gets the texture previously set via gdk_gl_texture_builder_set_update_texture() or // %NULL if none was set. func (x *GLTextureBuilder) GetUpdateTexture() *Texture { var cls *Texture cret := xGLTextureBuilderGetUpdateTexture(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Texture{} cls.Ptr = cret return cls } var xGLTextureBuilderGetWidth func(uintptr) int // Gets the width previously set via gdk_gl_texture_builder_set_width() or // 0 if the width wasn't set. func (x *GLTextureBuilder) GetWidth() int { cret := xGLTextureBuilderGetWidth(x.GoPointer()) return cret } var xGLTextureBuilderSetColorState func(uintptr, *ColorState) // Sets the color state for the texture. // // By default, the sRGB colorstate is used. If you don't know what // colorstates are, this is probably the right thing. func (x *GLTextureBuilder) SetColorState(ColorStateVar *ColorState) { xGLTextureBuilderSetColorState(x.GoPointer(), ColorStateVar) } var xGLTextureBuilderSetContext func(uintptr, uintptr) // Sets the context to be used for the texture. This is the context that owns // the texture. // // The context must be set before calling [method@Gdk.GLTextureBuilder.build]. func (x *GLTextureBuilder) SetContext(ContextVar *GLContext) { xGLTextureBuilderSetContext(x.GoPointer(), ContextVar.GoPointer()) } var xGLTextureBuilderSetFormat func(uintptr, MemoryFormat) // Sets the format of the texture. The default is `GDK_MEMORY_R8G8B8A8_PREMULTIPLIED`. // // The format is the preferred format the texture data should be downloaded to. The // format must be supported by the GL version of [property@Gdk.GLTextureBuilder:context]. // // GDK's texture download code assumes that the format corresponds to the storage // parameters of the GL texture in an obvious way. For example, a format of // `GDK_MEMORY_R16G16B16A16_PREMULTIPLIED` is expected to be stored as `GL_RGBA16` // texture, and `GDK_MEMORY_G8A8` is expected to be stored as `GL_RG8` texture. // // Setting the right format is particularly useful when using high bit depth textures // to preserve the bit depth, to set the correct value for unpremultiplied textures // and to make sure opaque textures are treated as such. // // Non-RGBA textures need to have swizzling parameters set up properly to be usable // in GSK's shaders. func (x *GLTextureBuilder) SetFormat(FormatVar MemoryFormat) { xGLTextureBuilderSetFormat(x.GoPointer(), FormatVar) } var xGLTextureBuilderSetHasMipmap func(uintptr, bool) // Sets whether the texture has a mipmap. This allows the renderer and other users of the // generated texture to use a higher quality downscaling. // // Typically, the `glGenerateMipmap` function is used to generate a mimap. func (x *GLTextureBuilder) SetHasMipmap(HasMipmapVar bool) { xGLTextureBuilderSetHasMipmap(x.GoPointer(), HasMipmapVar) } var xGLTextureBuilderSetHeight func(uintptr, int) // Sets the height of the texture. // // The height must be set before calling [method@Gdk.GLTextureBuilder.build]. func (x *GLTextureBuilder) SetHeight(HeightVar int) { xGLTextureBuilderSetHeight(x.GoPointer(), HeightVar) } var xGLTextureBuilderSetId func(uintptr, uint) // Sets the texture id of the texture. The texture id must remain unmodified // until the texture was finalized. See [method@Gdk.GLTextureBuilder.build] // for a longer discussion. // // The id must be set before calling [method@Gdk.GLTextureBuilder.build]. func (x *GLTextureBuilder) SetId(IdVar uint) { xGLTextureBuilderSetId(x.GoPointer(), IdVar) } var xGLTextureBuilderSetSync func(uintptr, uintptr) // Sets the GLSync object to use for the texture. // // GTK will wait on this object before using the created `GdkTexture`. // // The `destroy` function that is passed to [method@Gdk.GLTextureBuilder.build] // is responsible for freeing the sync object when it is no longer needed. // The texture builder does not destroy it and it is the callers // responsibility to make sure it doesn't leak. func (x *GLTextureBuilder) SetSync(SyncVar uintptr) { xGLTextureBuilderSetSync(x.GoPointer(), SyncVar) } var xGLTextureBuilderSetUpdateRegion func(uintptr, *cairo.Region) // Sets the region to be updated by this texture. Together with // [property@Gdk.GLTextureBuilder:update-texture] this describes an // update of a previous texture. // // When rendering animations of large textures, it is possible that // consecutive textures are only updating contents in parts of the texture. // It is then possible to describe this update via these two properties, // so that GTK can avoid rerendering parts that did not change. // // An example would be a screen recording where only the mouse pointer moves. func (x *GLTextureBuilder) SetUpdateRegion(RegionVar *cairo.Region) { xGLTextureBuilderSetUpdateRegion(x.GoPointer(), RegionVar) } var xGLTextureBuilderSetUpdateTexture func(uintptr, uintptr) // Sets the texture to be updated by this texture. See // [method@Gdk.GLTextureBuilder.set_update_region] for an explanation. func (x *GLTextureBuilder) SetUpdateTexture(TextureVar *Texture) { xGLTextureBuilderSetUpdateTexture(x.GoPointer(), TextureVar.GoPointer()) } var xGLTextureBuilderSetWidth func(uintptr, int) // Sets the width of the texture. // // The width must be set before calling [method@Gdk.GLTextureBuilder.build]. func (x *GLTextureBuilder) SetWidth(WidthVar int) { xGLTextureBuilderSetWidth(x.GoPointer(), WidthVar) } func (c *GLTextureBuilder) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *GLTextureBuilder) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyColorState sets the "color-state" property. // The color state of the texture. func (x *GLTextureBuilder) SetPropertyColorState(value uintptr) { var v gobject.Value v.Init(gobject.TypePointerVal) v.SetPointer(value) x.SetProperty("color-state", &v) } // GetPropertyColorState gets the "color-state" property. // The color state of the texture. func (x *GLTextureBuilder) GetPropertyColorState() uintptr { var v gobject.Value x.GetProperty("color-state", &v) return v.GetPointer() } // SetPropertyHasMipmap sets the "has-mipmap" property. // If the texture has a mipmap. func (x *GLTextureBuilder) SetPropertyHasMipmap(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("has-mipmap", &v) } // GetPropertyHasMipmap gets the "has-mipmap" property. // If the texture has a mipmap. func (x *GLTextureBuilder) GetPropertyHasMipmap() bool { var v gobject.Value x.GetProperty("has-mipmap", &v) return v.GetBoolean() } // SetPropertyHeight sets the "height" property. // The height of the texture. func (x *GLTextureBuilder) SetPropertyHeight(value int) { var v gobject.Value v.Init(gobject.TypeIntVal) v.SetInt(value) x.SetProperty("height", &v) } // GetPropertyHeight gets the "height" property. // The height of the texture. func (x *GLTextureBuilder) GetPropertyHeight() int { var v gobject.Value x.GetProperty("height", &v) return v.GetInt() } // SetPropertyId sets the "id" property. // The texture ID to use. func (x *GLTextureBuilder) SetPropertyId(value uint) { var v gobject.Value v.Init(gobject.TypeUintVal) v.SetUint(value) x.SetProperty("id", &v) } // GetPropertyId gets the "id" property. // The texture ID to use. func (x *GLTextureBuilder) GetPropertyId() uint { var v gobject.Value x.GetProperty("id", &v) return v.GetUint() } // SetPropertySync sets the "sync" property. // An optional `GLSync` object. // // If this is set, GTK will wait on it before using the texture. func (x *GLTextureBuilder) SetPropertySync(value uintptr) { var v gobject.Value v.Init(gobject.TypePointerVal) v.SetPointer(value) x.SetProperty("sync", &v) } // GetPropertySync gets the "sync" property. // An optional `GLSync` object. // // If this is set, GTK will wait on it before using the texture. func (x *GLTextureBuilder) GetPropertySync() uintptr { var v gobject.Value x.GetProperty("sync", &v) return v.GetPointer() } // SetPropertyUpdateRegion sets the "update-region" property. // The update region for [property@Gdk.GLTextureBuilder:update-texture]. func (x *GLTextureBuilder) SetPropertyUpdateRegion(value uintptr) { var v gobject.Value v.Init(gobject.TypePointerVal) v.SetPointer(value) x.SetProperty("update-region", &v) } // GetPropertyUpdateRegion gets the "update-region" property. // The update region for [property@Gdk.GLTextureBuilder:update-texture]. func (x *GLTextureBuilder) GetPropertyUpdateRegion() uintptr { var v gobject.Value x.GetProperty("update-region", &v) return v.GetPointer() } // SetPropertyWidth sets the "width" property. // The width of the texture. func (x *GLTextureBuilder) SetPropertyWidth(value int) { var v gobject.Value v.Init(gobject.TypeIntVal) v.SetInt(value) x.SetProperty("width", &v) } // GetPropertyWidth gets the "width" property. // The width of the texture. func (x *GLTextureBuilder) GetPropertyWidth() int { var v gobject.Value x.GetProperty("width", &v) return v.GetInt() } func init() { core.SetPackageName("GDK", "gtk4") core.SetSharedLibraries("GDK", []string{"libgtk-4.so.1"}) var libs []uintptr for _, libPath := range core.GetPaths("GDK") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xGLTextureBuilderGLibType, libs, "gdk_gl_texture_builder_get_type") core.PuregoSafeRegister(&xNewGLTextureBuilder, libs, "gdk_gl_texture_builder_new") core.PuregoSafeRegister(&xGLTextureBuilderBuild, libs, "gdk_gl_texture_builder_build") core.PuregoSafeRegister(&xGLTextureBuilderGetColorState, libs, "gdk_gl_texture_builder_get_color_state") core.PuregoSafeRegister(&xGLTextureBuilderGetContext, libs, "gdk_gl_texture_builder_get_context") core.PuregoSafeRegister(&xGLTextureBuilderGetFormat, libs, "gdk_gl_texture_builder_get_format") core.PuregoSafeRegister(&xGLTextureBuilderGetHasMipmap, libs, "gdk_gl_texture_builder_get_has_mipmap") core.PuregoSafeRegister(&xGLTextureBuilderGetHeight, libs, "gdk_gl_texture_builder_get_height") core.PuregoSafeRegister(&xGLTextureBuilderGetId, libs, "gdk_gl_texture_builder_get_id") core.PuregoSafeRegister(&xGLTextureBuilderGetSync, libs, "gdk_gl_texture_builder_get_sync") core.PuregoSafeRegister(&xGLTextureBuilderGetUpdateRegion, libs, "gdk_gl_texture_builder_get_update_region") core.PuregoSafeRegister(&xGLTextureBuilderGetUpdateTexture, libs, "gdk_gl_texture_builder_get_update_texture") core.PuregoSafeRegister(&xGLTextureBuilderGetWidth, libs, "gdk_gl_texture_builder_get_width") core.PuregoSafeRegister(&xGLTextureBuilderSetColorState, libs, "gdk_gl_texture_builder_set_color_state") core.PuregoSafeRegister(&xGLTextureBuilderSetContext, libs, "gdk_gl_texture_builder_set_context") core.PuregoSafeRegister(&xGLTextureBuilderSetFormat, libs, "gdk_gl_texture_builder_set_format") core.PuregoSafeRegister(&xGLTextureBuilderSetHasMipmap, libs, "gdk_gl_texture_builder_set_has_mipmap") core.PuregoSafeRegister(&xGLTextureBuilderSetHeight, libs, "gdk_gl_texture_builder_set_height") core.PuregoSafeRegister(&xGLTextureBuilderSetId, libs, "gdk_gl_texture_builder_set_id") core.PuregoSafeRegister(&xGLTextureBuilderSetSync, libs, "gdk_gl_texture_builder_set_sync") core.PuregoSafeRegister(&xGLTextureBuilderSetUpdateRegion, libs, "gdk_gl_texture_builder_set_update_region") core.PuregoSafeRegister(&xGLTextureBuilderSetUpdateTexture, libs, "gdk_gl_texture_builder_set_update_texture") core.PuregoSafeRegister(&xGLTextureBuilderSetWidth, libs, "gdk_gl_texture_builder_set_width") }