gtkmm 4.13.3
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gdk::GLTextureBuilder Class Reference

Gdk::GLTextureBuilder is a buider used to construct Gdk::Texture objects from GL textures. More...

#include <gdkmm/gltexturebuilder.h>

Inheritance diagram for Gdk::GLTextureBuilder:
Inheritance graph
[legend]

Public Types

using SlotGLTextureReleased = sigc::slot< void()>
 For instance, void on_gl_texture_released();. More...
 

Public Member Functions

 GLTextureBuilder (GLTextureBuilder && src) noexcept
 
GLTextureBuilderoperator= (GLTextureBuilder && src) noexcept
 
 ~GLTextureBuilder () noexcept override
 
GdkGLTextureBuilder * gobj ()
 Provides access to the underlying C GObject. More...
 
const GdkGLTextureBuilder * gobj () const
 Provides access to the underlying C GObject. More...
 
GdkGLTextureBuilder * gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
Glib::RefPtr< GLContextget_context ()
 Gets the context previously set via set_context() or nullptr if none was set. More...
 
Glib::RefPtr< const GLContextget_context () const
 Gets the context previously set via set_context() or nullptr if none was set. More...
 
void set_context (const Glib::RefPtr< GLContext > & context)
 Sets the context to be used for the texture. More...
 
guint get_id () const
 Gets the texture id previously set via set_id() or 0 if the id wasn't set. More...
 
void set_id (guint id)
 Sets the texture id of the texture. More...
 
int get_width () const
 Gets the width previously set via set_width() or 0 if the width wasn't set. More...
 
void set_width (int width)
 Sets the width of the texture. More...
 
int get_height () const
 Gets the height previously set via set_height() or 0 if the height wasn't set. More...
 
void set_height (int height)
 Sets the height of the texture. More...
 
MemoryFormat get_format () const
 Gets the format previously set via set_format(). More...
 
void set_format (MemoryFormat format)
 Sets the format of the texture. More...
 
bool get_has_mipmap () const
 Gets whether the texture has a mipmap. More...
 
void set_has_mipmap (bool has_mipmap=true)
 Sets whether the texture has a mipmap. More...
 
void * get_sync () const
 Gets the Lsync previously set via set_sync(). More...
 
void set_sync (void * sync)
 Sets the GLSync object to use for the texture. More...
 
Glib::RefPtr< Textureget_update_texture ()
 Gets the texture previously set via set_update_texture() or nullptr if none was set. More...
 
Glib::RefPtr< const Textureget_update_texture () const
 Gets the texture previously set via set_update_texture() or nullptr if none was set. More...
 
void set_update_texture (const Glib::RefPtr< Texture > & texture)
 Sets the texture to be updated by this texture. More...
 
::Cairo::RefPtr< ::Cairo::Region > get_update_region ()
 Gets the region previously set via set_update_region() or nullptr if none was set. More...
 
::Cairo::RefPtr< const ::Cairo::Region > get_update_region () const
 Gets the region previously set via set_update_region() or nullptr if none was set. More...
 
void set_update_region (const ::Cairo::RefPtr< ::Cairo::Region > & region)
 Sets the region to be updated by this texture. More...
 
Glib::RefPtr< Texturebuild (const SlotGLTextureReleased & slot={})
 Builds a new Gdk::Texture with the values set up in the builder. More...
 
Glib::PropertyProxy< Glib::RefPtr< GLContext > > property_context ()
 The context owning the texture. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< GLContext > > property_context () const
 The context owning the texture. More...
 
Glib::PropertyProxy< MemoryFormatproperty_format ()
 The format when downloading the texture. More...
 
Glib::PropertyProxy_ReadOnly< MemoryFormatproperty_format () const
 The format when downloading the texture. More...
 
Glib::PropertyProxy< bool > property_has_mipmap ()
 If the texture has a mipmap. More...
 
Glib::PropertyProxy_ReadOnly< bool > property_has_mipmap () const
 If the texture has a mipmap. More...
 
Glib::PropertyProxy< int > property_height ()
 The height of the texture. More...
 
Glib::PropertyProxy_ReadOnly< int > property_height () const
 The height of the texture. More...
 
Glib::PropertyProxy< guint > property_id ()
 The texture ID to use. More...
 
Glib::PropertyProxy_ReadOnly< guint > property_id () const
 The texture ID to use. More...
 
Glib::PropertyProxy< ::Cairo::RefPtr< ::Cairo::Region > > property_update_region ()
 The update region for property_update_texture(). More...
 
Glib::PropertyProxy_ReadOnly< ::Cairo::RefPtr< ::Cairo::Region > > property_update_region () const
 The update region for property_update_texture(). More...
 
Glib::PropertyProxy< Glib::RefPtr< Texture > > property_update_texture ()
 The texture property_update_region() is an update for. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Texture > > property_update_texture () const
 The texture property_update_region() is an update for. More...
 
Glib::PropertyProxy< int > property_width ()
 The width of the texture. More...
 
Glib::PropertyProxy_ReadOnly< int > property_width () const
 The width of the texture. More...
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...
 
static Glib::RefPtr< GLTextureBuildercreate ()
 

Protected Member Functions

 GLTextureBuilder ()
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gdk::GLTextureBuilderwrap (GdkGLTextureBuilder * object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Detailed Description

Gdk::GLTextureBuilder is a buider used to construct Gdk::Texture objects from GL textures.

The operation is quite simple: Create a texture builder, set all the necessary properties - keep in mind that property_context(), property_id(), property_width(), and property_height() are mandatory - and then call build() to create the new texture.

Gdk::GLTextureBuilder can be used for quick one-shot construction of textures as well as kept around and reused to construct multiple textures.

Since gtkmm 4.12:

Member Typedef Documentation

◆ SlotGLTextureReleased

For instance, void on_gl_texture_released();.

Constructor & Destructor Documentation

◆ GLTextureBuilder() [1/2]

Gdk::GLTextureBuilder::GLTextureBuilder ( GLTextureBuilder &&  src)
noexcept

◆ ~GLTextureBuilder()

Gdk::GLTextureBuilder::~GLTextureBuilder ( )
overridenoexcept

◆ GLTextureBuilder() [2/2]

Gdk::GLTextureBuilder::GLTextureBuilder ( )
protected

Member Function Documentation

◆ build()

Glib::RefPtr< Texture > Gdk::GLTextureBuilder::build ( const SlotGLTextureReleased slot = {})

Builds a new Gdk::Texture 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 release(). It should release all GL resources associated with the texture, such as the property_id() and the property_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.

Since gtkmm 4.12:
Parameters
slotDestroy function to be called when the texture is released.
Returns
A newly built Gdk::Texture.

◆ create()

static Glib::RefPtr< GLTextureBuilder > Gdk::GLTextureBuilder::create ( )
static

◆ get_context() [1/2]

Glib::RefPtr< GLContext > Gdk::GLTextureBuilder::get_context ( )

Gets the context previously set via set_context() or nullptr if none was set.

Since gtkmm 4.12:
Returns
The context.

◆ get_context() [2/2]

Glib::RefPtr< const GLContext > Gdk::GLTextureBuilder::get_context ( ) const

Gets the context previously set via set_context() or nullptr if none was set.

Since gtkmm 4.12:
Returns
The context.

◆ get_format()

MemoryFormat Gdk::GLTextureBuilder::get_format ( ) const

Gets the format previously set via set_format().

Since gtkmm 4.12:
Returns
The format.

◆ get_has_mipmap()

bool Gdk::GLTextureBuilder::get_has_mipmap ( ) const

Gets whether the texture has a mipmap.

Since gtkmm 4.12:
Returns
Whether the texture has a mipmap.

◆ get_height()

int Gdk::GLTextureBuilder::get_height ( ) const

Gets the height previously set via set_height() or 0 if the height wasn't set.

Since gtkmm 4.12:
Returns
The height.

◆ get_id()

guint Gdk::GLTextureBuilder::get_id ( ) const

Gets the texture id previously set via set_id() or 0 if the id wasn't set.

Since gtkmm 4.12:
Returns
The id.

◆ get_sync()

void * Gdk::GLTextureBuilder::get_sync ( ) const

Gets the Lsync previously set via set_sync().

Since gtkmm 4.12:
Returns
The LSync.

◆ get_type()

static GType Gdk::GLTextureBuilder::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ get_update_region() [1/2]

::Cairo::RefPtr< ::Cairo::Region > Gdk::GLTextureBuilder::get_update_region ( )

Gets the region previously set via set_update_region() or nullptr if none was set.

Since gtkmm 4.12:
Returns
The region.

◆ get_update_region() [2/2]

::Cairo::RefPtr< const ::Cairo::Region > Gdk::GLTextureBuilder::get_update_region ( ) const

Gets the region previously set via set_update_region() or nullptr if none was set.

Since gtkmm 4.12:
Returns
The region.

◆ get_update_texture() [1/2]

Glib::RefPtr< Texture > Gdk::GLTextureBuilder::get_update_texture ( )

Gets the texture previously set via set_update_texture() or nullptr if none was set.

Since gtkmm 4.12:
Returns
The texture.

◆ get_update_texture() [2/2]

Glib::RefPtr< const Texture > Gdk::GLTextureBuilder::get_update_texture ( ) const

Gets the texture previously set via set_update_texture() or nullptr if none was set.

Since gtkmm 4.12:
Returns
The texture.

◆ get_width()

int Gdk::GLTextureBuilder::get_width ( ) const

Gets the width previously set via set_width() or 0 if the width wasn't set.

Since gtkmm 4.12:
Returns
The width.

◆ gobj() [1/2]

GdkGLTextureBuilder * Gdk::GLTextureBuilder::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GdkGLTextureBuilder * Gdk::GLTextureBuilder::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

GdkGLTextureBuilder * Gdk::GLTextureBuilder::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

◆ operator=()

GLTextureBuilder & Gdk::GLTextureBuilder::operator= ( GLTextureBuilder &&  src)
noexcept

◆ property_context() [1/2]

Glib::PropertyProxy< Glib::RefPtr< GLContext > > Gdk::GLTextureBuilder::property_context ( )

The context owning the texture.

Since gtkmm 4.12:
Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_context() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< GLContext > > Gdk::GLTextureBuilder::property_context ( ) const

The context owning the texture.

Since gtkmm 4.12:
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_format() [1/2]

Glib::PropertyProxy< MemoryFormat > Gdk::GLTextureBuilder::property_format ( )

The format when downloading the texture.

Since gtkmm 4.12:

Default value: Gdk::MemoryFormat::R8G8B8A8_PREMULTIPLIED

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_format() [2/2]

Glib::PropertyProxy_ReadOnly< MemoryFormat > Gdk::GLTextureBuilder::property_format ( ) const

The format when downloading the texture.

Since gtkmm 4.12:

Default value: Gdk::MemoryFormat::R8G8B8A8_PREMULTIPLIED

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_has_mipmap() [1/2]

Glib::PropertyProxy< bool > Gdk::GLTextureBuilder::property_has_mipmap ( )

If the texture has a mipmap.

Since gtkmm 4.12:

Default value: false

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_has_mipmap() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gdk::GLTextureBuilder::property_has_mipmap ( ) const

If the texture has a mipmap.

Since gtkmm 4.12:

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_height() [1/2]

Glib::PropertyProxy< int > Gdk::GLTextureBuilder::property_height ( )

The height of the texture.

Since gtkmm 4.12:

Default value: 0

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_height() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gdk::GLTextureBuilder::property_height ( ) const

The height of the texture.

Since gtkmm 4.12:

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_id() [1/2]

Glib::PropertyProxy< guint > Gdk::GLTextureBuilder::property_id ( )

The texture ID to use.

Since gtkmm 4.12:

Default value: 0

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_id() [2/2]

Glib::PropertyProxy_ReadOnly< guint > Gdk::GLTextureBuilder::property_id ( ) const

The texture ID to use.

Since gtkmm 4.12:

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_update_region() [1/2]

Glib::PropertyProxy< ::Cairo::RefPtr< ::Cairo::Region > > Gdk::GLTextureBuilder::property_update_region ( )

The update region for property_update_texture().

Since gtkmm 4.12:
Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_update_region() [2/2]

Glib::PropertyProxy_ReadOnly< ::Cairo::RefPtr< ::Cairo::Region > > Gdk::GLTextureBuilder::property_update_region ( ) const

The update region for property_update_texture().

Since gtkmm 4.12:
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_update_texture() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Texture > > Gdk::GLTextureBuilder::property_update_texture ( )

The texture property_update_region() is an update for.

Since gtkmm 4.12:
Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_update_texture() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Texture > > Gdk::GLTextureBuilder::property_update_texture ( ) const

The texture property_update_region() is an update for.

Since gtkmm 4.12:
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_width() [1/2]

Glib::PropertyProxy< int > Gdk::GLTextureBuilder::property_width ( )

The width of the texture.

Since gtkmm 4.12:

Default value: 0

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_width() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gdk::GLTextureBuilder::property_width ( ) const

The width of the texture.

Since gtkmm 4.12:

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ set_context()

void Gdk::GLTextureBuilder::set_context ( const Glib::RefPtr< GLContext > &  context)

Sets the context to be used for the texture.

This is the context that owns the texture.

The context must be set before calling build().

Since gtkmm 4.12:
Parameters
contextThe context the texture beongs to or nullptr to unset.

◆ set_format()

void Gdk::GLTextureBuilder::set_format ( MemoryFormat  format)

Sets the format of the texture.

The default is Gdk::MemoryFormat::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_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::MemoryFormat::R16G16B16A16_PREMULTIPLIED is expected to be stored as GL_RGBA16 texture, and Gdk::MemoryFormat::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.

Since gtkmm 4.12:
Parameters
formatThe texture's format.

◆ set_has_mipmap()

void Gdk::GLTextureBuilder::set_has_mipmap ( bool  has_mipmap = true)

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.

Since gtkmm 4.12:
Parameters
has_mipmapWhether the texture has a mipmap.

◆ set_height()

void Gdk::GLTextureBuilder::set_height ( int  height)

Sets the height of the texture.

The height must be set before calling build().

Since gtkmm 4.12:
Parameters
heightThe texture's height or 0 to unset.

◆ set_id()

void Gdk::GLTextureBuilder::set_id ( guint  id)

Sets the texture id of the texture.

The texture id must remain unmodified until the texture was finalized. See build() for a longer discussion.

The id must be set before calling build().

Since gtkmm 4.12:
Parameters
idThe texture id to be used for creating the texture.

◆ set_sync()

void Gdk::GLTextureBuilder::set_sync ( void *  sync)

Sets the GLSync object to use for the texture.

GTK will wait on this object before using the created Gdk::Texture.

The destroy function that is passed to 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.

Since gtkmm 4.12:
Parameters
syncThe GLSync object.

◆ set_update_region()

void Gdk::GLTextureBuilder::set_update_region ( const ::Cairo::RefPtr< ::Cairo::Region > &  region)

Sets the region to be updated by this texture.

Together with property_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.

Since gtkmm 4.12:
Parameters
regionThe region to update.

◆ set_update_texture()

void Gdk::GLTextureBuilder::set_update_texture ( const Glib::RefPtr< Texture > &  texture)

Sets the texture to be updated by this texture.

See set_update_region() for an explanation.

Since gtkmm 4.12:
Parameters
textureThe texture to update.

◆ set_width()

void Gdk::GLTextureBuilder::set_width ( int  width)

Sets the width of the texture.

The width must be set before calling build().

Since gtkmm 4.12:
Parameters
widthThe texture's width or 0 to unset.

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gdk::GLTextureBuilder > wrap ( GdkGLTextureBuilder *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.