gtkmm 4.16.0
|
Gdk::GLTextureBuilder is a buider used to construct Gdk::Texture objects from GL textures. More...
#include <gdkmm/gltexturebuilder.h>
Public Types | |
using | SlotGLTextureReleased = sigc::slot< void()> |
For instance, void on_gl_texture_released();. | |
Public Member Functions | |
GLTextureBuilder (GLTextureBuilder &&src) noexcept | |
GLTextureBuilder & | operator= (GLTextureBuilder &&src) noexcept |
~GLTextureBuilder () noexcept override | |
GdkGLTextureBuilder * | gobj () |
Provides access to the underlying C GObject. | |
const GdkGLTextureBuilder * | gobj () const |
Provides access to the underlying C GObject. | |
GdkGLTextureBuilder * | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
Glib::RefPtr< GLContext > | get_context () |
Gets the context previously set via set_context() or nullptr if none was set. | |
Glib::RefPtr< const GLContext > | get_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. | |
void * | get_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< ColorState > | get_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< Texture > | get_update_texture () |
Gets the texture previously set via set_update_texture() or nullptr if none was set. | |
Glib::RefPtr< const Texture > | get_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 > ®ion) |
Sets the region to be updated by this texture. | |
Glib::RefPtr< Texture > | build (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< MemoryFormat > | property_format () |
The format when downloading the texture. | |
Glib::PropertyProxy_ReadOnly< MemoryFormat > | property_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< GLTextureBuilder > | create () |
Protected Member Functions | |
GLTextureBuilder () | |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gdk::GLTextureBuilder > | wrap (GdkGLTextureBuilder *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
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.
using Gdk::GLTextureBuilder::SlotGLTextureReleased = sigc::slot<void()> |
For instance, void on_gl_texture_released();.
|
noexcept |
|
overridenoexcept |
|
protected |
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.
slot | Destroy function to be called when the texture is released. |
Gdk::Texture
.
|
static |
Glib::RefPtr< ColorState > Gdk::GLTextureBuilder::get_color_state | ( | ) | const |
Gets the color state previously set via set_color_state().
Glib::RefPtr< GLContext > Gdk::GLTextureBuilder::get_context | ( | ) |
Gets the context previously set via set_context() or nullptr
if none was set.
Gets the context previously set via set_context() or nullptr
if none was set.
MemoryFormat Gdk::GLTextureBuilder::get_format | ( | ) | const |
bool Gdk::GLTextureBuilder::get_has_mipmap | ( | ) | const |
int Gdk::GLTextureBuilder::get_height | ( | ) | const |
Gets the height previously set via set_height() or 0 if the height wasn't set.
guint Gdk::GLTextureBuilder::get_id | ( | ) | const |
Gets the texture id previously set via set_id() or 0 if the id wasn't set.
void * Gdk::GLTextureBuilder::get_sync | ( | ) | const |
|
static |
Get the GType for this class, for use with the underlying GObject type system.
::Cairo::RefPtr< ::Cairo::Region > Gdk::GLTextureBuilder::get_update_region | ( | ) |
Gets the region previously set via set_update_region() or nullptr
if none was set.
::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.
Glib::RefPtr< Texture > Gdk::GLTextureBuilder::get_update_texture | ( | ) |
Gets the texture previously set via set_update_texture() or nullptr
if none was set.
Gets the texture previously set via set_update_texture() or nullptr
if none was set.
int Gdk::GLTextureBuilder::get_width | ( | ) | const |
Gets the width previously set via set_width() or 0 if the width wasn't set.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
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.
|
noexcept |
Glib::PropertyProxy< Glib::RefPtr< ColorState > > Gdk::GLTextureBuilder::property_color_state | ( | ) |
The color state of the texture.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ColorState > > Gdk::GLTextureBuilder::property_color_state | ( | ) | const |
The color state of the texture.
Glib::PropertyProxy< Glib::RefPtr< GLContext > > Gdk::GLTextureBuilder::property_context | ( | ) |
The context owning the texture.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< GLContext > > Gdk::GLTextureBuilder::property_context | ( | ) | const |
The context owning the texture.
Glib::PropertyProxy< MemoryFormat > Gdk::GLTextureBuilder::property_format | ( | ) |
The format when downloading the texture.
Default value: Gdk::MemoryFormat::R8G8B8A8_PREMULTIPLIED
Glib::PropertyProxy_ReadOnly< MemoryFormat > Gdk::GLTextureBuilder::property_format | ( | ) | const |
The format when downloading the texture.
Default value: Gdk::MemoryFormat::R8G8B8A8_PREMULTIPLIED
Glib::PropertyProxy< bool > Gdk::GLTextureBuilder::property_has_mipmap | ( | ) |
If the texture has a mipmap.
Default value: false
Glib::PropertyProxy_ReadOnly< bool > Gdk::GLTextureBuilder::property_has_mipmap | ( | ) | const |
If the texture has a mipmap.
Default value: false
Glib::PropertyProxy< int > Gdk::GLTextureBuilder::property_height | ( | ) |
The height of the texture.
Default value: 0
Glib::PropertyProxy_ReadOnly< int > Gdk::GLTextureBuilder::property_height | ( | ) | const |
The height of the texture.
Default value: 0
Glib::PropertyProxy< guint > Gdk::GLTextureBuilder::property_id | ( | ) |
The texture ID to use.
Default value: 0
Glib::PropertyProxy_ReadOnly< guint > Gdk::GLTextureBuilder::property_id | ( | ) | const |
The texture ID to use.
Default value: 0
Glib::PropertyProxy< ::Cairo::RefPtr< ::Cairo::Region > > Gdk::GLTextureBuilder::property_update_region | ( | ) |
The update region for property_update_texture().
Glib::PropertyProxy_ReadOnly< ::Cairo::RefPtr< ::Cairo::Region > > Gdk::GLTextureBuilder::property_update_region | ( | ) | const |
The update region for property_update_texture().
Glib::PropertyProxy< Glib::RefPtr< Texture > > Gdk::GLTextureBuilder::property_update_texture | ( | ) |
The texture property_update_region() is an update for.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Texture > > Gdk::GLTextureBuilder::property_update_texture | ( | ) | const |
The texture property_update_region() is an update for.
Glib::PropertyProxy< int > Gdk::GLTextureBuilder::property_width | ( | ) |
The width of the texture.
Default value: 0
Glib::PropertyProxy_ReadOnly< int > Gdk::GLTextureBuilder::property_width | ( | ) | const |
The width of the texture.
Default value: 0
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.
color_state | A Gdk::ColorState . |
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().
context | The context the texture belongs to or nullptr to unset. |
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.
format | The texture's format. |
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.
has_mipmap | Whether the texture has a mipmap. |
void Gdk::GLTextureBuilder::set_height | ( | int | height | ) |
Sets the height of the texture.
The height must be set before calling build().
height | The texture's height or 0 to unset. |
void Gdk::GLTextureBuilder::set_id | ( | guint | id | ) |
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.
sync | The GLSync object. |
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.
region | The region to update. |
Sets the texture to be updated by this texture.
See set_update_region() for an explanation.
texture | The texture to update. |
void Gdk::GLTextureBuilder::set_width | ( | int | width | ) |
Sets the width of the texture.
The width must be set before calling build().
width | The texture's width or 0 to unset. |
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |