gtkmm 4.16.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | 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();.
 

Public Member Functions

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

Static Public Member Functions

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

Protected Member Functions

 GLTextureBuilder ()
 

Related Symbols

(Note that these are not member symbols.)

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

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_color_state()

Glib::RefPtr< ColorState > Gdk::GLTextureBuilder::get_color_state ( ) const

Gets the color state previously set via set_color_state().

Since gtkmm 4.16:
Returns
The color state.

◆ 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_color_state() [1/2]

Glib::PropertyProxy< Glib::RefPtr< ColorState > > Gdk::GLTextureBuilder::property_color_state ( )

The color state of the texture.

Since gtkmm 4.16:
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_color_state() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ColorState > > Gdk::GLTextureBuilder::property_color_state ( ) const

The color state of the texture.

Since gtkmm 4.16:
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_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_color_state()

void Gdk::GLTextureBuilder::set_color_state ( const Glib::RefPtr< const ColorState > &  color_state)

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.

Since gtkmm 4.16:
Parameters
color_stateA Gdk::ColorState.

◆ 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 belongs 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 Symbol 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.