gtkmm: Gdk::MemoryTextureBuilder Class Reference

gtkmm 4.22.0

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gdk::MemoryTextureBuilder Class Reference

Gdk::MemoryTextureBuilder is a builder used to construct Gdk::Texture objects from system memory provided via Glib::Bytes. More...

`#include <gdkmm/memorytexturebuilder.h>`

Inheritance diagram for Gdk::MemoryTextureBuilder:
[legend]

## Public Member Functions
| MemoryTextureBuilder (MemoryTextureBuilder && src) noexcept
MemoryTextureBuilder & | operator= (MemoryTextureBuilder && src) noexcept
| ~MemoryTextureBuilder () noexcept override
GdkMemoryTextureBuilder * | gobj ()
| Provides access to the underlying C GObject.
const GdkMemoryTextureBuilder * | gobj () const
| Provides access to the underlying C GObject.
GdkMemoryTextureBuilder * | 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< Glib::Bytes > | get_bytes () const
| Gets the bytes previously set via set_bytes() or nullptr if none was set.
void | set_bytes (const Glib::RefPtr< const Glib::Bytes > & context)
| Sets the data to be shown but the texture.
gsize | get_stride () const
| Gets the stride previously set via set_stride().
void | set_stride (gsize stride)
| Sets the rowstride of the bytes used.
gsize | get_stride_for_plane (unsigned int plane) const
| Gets the stride previously set via set_stride_for_plane().
void | set_stride_for_plane (unsigned int plane, gsize stride)
| Sets the stride of the texture for plane.
gsize | get_offset (unsigned int plane) const
| Gets the offset previously set via set_offset().
void | set_offset (unsigned int plane, gsize offset)
| Sets the offset of the texture for plane.
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 bytes.
Glib::RefPtr< ColorState > | get_color_state () const
| Gets the colorstate previously set via set_color_state().
void | set_color_state (const Glib::RefPtr< const ColorState > & color_state)
| Sets the colorstate describing the data.
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 > & region)
| Sets the region to be updated by this texture.
Glib::RefPtr< Texture > | build ()
| Builds a new Gdk::Texture with the values set up in the builder.
Glib::PropertyProxy< Glib::RefPtr< Glib::Bytes > > | property_bytes ()
| The bytes holding the data.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Glib::Bytes > > | property_bytes () const
| The bytes holding the data.
Glib::PropertyProxy< Glib::RefPtr< ColorState > > | property_color_state ()
| The colorstate describing the data.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ColorState > > | property_color_state () const
| The colorstate describing the data.
Glib::PropertyProxy< MemoryFormat > | property_format ()
| The format of the data.
Glib::PropertyProxy_ReadOnly< MemoryFormat > | property_format () const
| The format of the data.
Glib::PropertyProxy< int > | property_height ()
| The height of the texture.
Glib::PropertyProxy_ReadOnly< int > | property_height () const
| The height of the texture.
Glib::PropertyProxy< gsize > | property_stride ()
| The rowstride of the texture.
Glib::PropertyProxy_ReadOnly< gsize > | property_stride () const
| The rowstride 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.
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data_with_c_callback (const Quark &key, void *data, GDestroyNotify notify)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
PropertyType | get_property (const Glib::ustring &property_name) const
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const

## 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< MemoryTextureBuilder > | create ()

## Protected Member Functions
| MemoryTextureBuilder ()
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gdk::MemoryTextureBuilder > | wrap (GdkMemoryTextureBuilder * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

Gdk::MemoryTextureBuilder is a builder used to construct Gdk::Texture objects from system memory provided via Glib::Bytes.

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

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

Since gtkmm 4.16

## Constructor & Destructor Documentation

## ◆ MemoryTextureBuilder() [1/2]

Gdk::MemoryTextureBuilder::MemoryTextureBuilder | ( | MemoryTextureBuilder && | src | ) |
| noexcept

## ◆ ~MemoryTextureBuilder()

Gdk::MemoryTextureBuilder::~MemoryTextureBuilder | ( |  | ) |
| overridenoexcept

## ◆ MemoryTextureBuilder() [2/2]

Gdk::MemoryTextureBuilder::MemoryTextureBuilder | ( |  | ) |
| protected

## Member Function Documentation

## ◆ build()

Glib::RefPtr< Texture > Gdk::MemoryTextureBuilder::build | ( |  | ) |

Builds a new Gdk::Texture with the values set up in the builder.

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.16

Returns
  A newly built Gdk::Texture.

## ◆ create()

Glib::RefPtr< MemoryTextureBuilder > Gdk::MemoryTextureBuilder::create | ( |  | ) |
| static

## ◆ get_bytes()

Glib::RefPtr< Glib::Bytes > Gdk::MemoryTextureBuilder::get_bytes | ( |  | ) | const

Gets the bytes previously set via set_bytes() or nullptr if none was set.

Since gtkmm 4.16

Returns
  The bytes.

## ◆ get_color_state()

Glib::RefPtr< ColorState > Gdk::MemoryTextureBuilder::get_color_state | ( |  | ) | const

Gets the colorstate previously set via set_color_state().

Since gtkmm 4.16

Returns
  The colorstate.

## ◆ get_format()

MemoryFormat Gdk::MemoryTextureBuilder::get_format | ( |  | ) | const

Gets the format previously set via set_format().

Since gtkmm 4.16

Returns
  The format.

## ◆ get_height()

int Gdk::MemoryTextureBuilder::get_height | ( |  | ) | const

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

Since gtkmm 4.16

Returns
  The height.

## ◆ get_offset()

gsize Gdk::MemoryTextureBuilder::get_offset | ( | unsigned int | plane | ) | const

Gets the offset previously set via set_offset().

Since gtkmm 4.20

Parameters

  plane | A plane.

Returns
  The offset associated to a plane.

## ◆ get_stride()

gsize Gdk::MemoryTextureBuilder::get_stride | ( |  | ) | const

Gets the stride previously set via set_stride().

Since gtkmm 4.16

Returns
  The stride.

## ◆ get_stride_for_plane()

gsize Gdk::MemoryTextureBuilder::get_stride_for_plane | ( | unsigned int | plane | ) | const

Gets the stride previously set via set_stride_for_plane().

Since gtkmm 4.20

Parameters

  plane | A plane.

Returns
  The stride associated to a plane.

## ◆ get_type()

GType Gdk::MemoryTextureBuilder::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::MemoryTextureBuilder::get_update_region | ( |  | ) |

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

Since gtkmm 4.16

Returns
  The update region.

## ◆ get_update_region() [2/2]

::Cairo::RefPtr< const ::Cairo::Region > Gdk::MemoryTextureBuilder::get_update_region | ( |  | ) | const

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

Since gtkmm 4.16

Returns
  The update region.

## ◆ get_update_texture() [1/2]

Glib::RefPtr< Texture > Gdk::MemoryTextureBuilder::get_update_texture | ( |  | ) |

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

Since gtkmm 4.16

Returns
  The update texture.

## ◆ get_update_texture() [2/2]

Glib::RefPtr< const Texture > Gdk::MemoryTextureBuilder::get_update_texture | ( |  | ) | const

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

Since gtkmm 4.16

Returns
  The update texture.

## ◆ get_width()

int Gdk::MemoryTextureBuilder::get_width | ( |  | ) | const

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

Since gtkmm 4.16

Returns
  The width.

## ◆ gobj() [1/2]

GdkMemoryTextureBuilder * Gdk::MemoryTextureBuilder::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GdkMemoryTextureBuilder * Gdk::MemoryTextureBuilder::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GdkMemoryTextureBuilder * Gdk::MemoryTextureBuilder::gobj_copy | ( |  | ) |

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

## ◆ operator=()

MemoryTextureBuilder & Gdk::MemoryTextureBuilder::operator= | ( | MemoryTextureBuilder && | src | ) |
| noexcept

## ◆ property_bytes() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Glib::Bytes > > Gdk::MemoryTextureBuilder::property_bytes | ( |  | ) |

The bytes holding the data.

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_bytes() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Glib::Bytes > > Gdk::MemoryTextureBuilder::property_bytes | ( |  | ) | const

The bytes holding the data.

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

Glib::PropertyProxy< Glib::RefPtr< ColorState > > Gdk::MemoryTextureBuilder::property_color_state | ( |  | ) |

The colorstate describing the data.

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::MemoryTextureBuilder::property_color_state | ( |  | ) | const

The colorstate describing the data.

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

Glib::PropertyProxy< MemoryFormat > Gdk::MemoryTextureBuilder::property_format | ( |  | ) |

The format of the data.

Since gtkmm 4.16

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::MemoryTextureBuilder::property_format | ( |  | ) | const

The format of the data.

Since gtkmm 4.16

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

Glib::PropertyProxy< int > Gdk::MemoryTextureBuilder::property_height | ( |  | ) |

The height of the texture.

Since gtkmm 4.16

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::MemoryTextureBuilder::property_height | ( |  | ) | const

The height of the texture.

Since gtkmm 4.16

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

Glib::PropertyProxy< gsize > Gdk::MemoryTextureBuilder::property_stride | ( |  | ) |

The rowstride of the texture.

The rowstride is the number of bytes between the first pixel in a row of image data, and the first pixel in the next row.

Since gtkmm 4.16

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_stride() [2/2]

Glib::PropertyProxy_ReadOnly< gsize > Gdk::MemoryTextureBuilder::property_stride | ( |  | ) | const

The rowstride of the texture.

The rowstride is the number of bytes between the first pixel in a row of image data, and the first pixel in the next row.

Since gtkmm 4.16

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::MemoryTextureBuilder::property_update_region | ( |  | ) |

The update region for property_update_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_update_region() [2/2]

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

The update region for property_update_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_update_texture() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Texture > > Gdk::MemoryTextureBuilder::property_update_texture | ( |  | ) |

The texture property_update_region() is an update for.

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_update_texture() [2/2]

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

The texture property_update_region() is an update for.

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

Glib::PropertyProxy< int > Gdk::MemoryTextureBuilder::property_width | ( |  | ) |

The width of the texture.

Since gtkmm 4.16

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::MemoryTextureBuilder::property_width | ( |  | ) | const

The width of the texture.

Since gtkmm 4.16

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

void Gdk::MemoryTextureBuilder::set_bytes | ( | const Glib::RefPtr< const Glib::Bytes > & | context | ) |

Sets the data to be shown but the texture.

The bytes must be set before calling build().

Since gtkmm 4.16

Parameters

  context | The bytes the texture shows or nullptr to unset.

## ◆ set_color_state()

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

Sets the colorstate describing the data.

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_state | The colorstate describing the data.

## ◆ set_format()

void Gdk::MemoryTextureBuilder::set_format | ( | MemoryFormat | format | ) |

Sets the format of the bytes.

The default is Gdk::MemoryFormat::R8G8B8A8_PREMULTIPLIED.

Since gtkmm 4.16

Parameters

  format | The texture's format.

## ◆ set_height()

void Gdk::MemoryTextureBuilder::set_height | ( | int | height | ) |

Sets the height of the texture.

The height must be set before calling build() and conform to size requirements of the provided format.

Since gtkmm 4.16

Parameters

  height | The texture's height or 0 to unset.

## ◆ set_offset()

void Gdk::MemoryTextureBuilder::set_offset | ( | unsigned int | plane,
|  | gsize | offset )

Sets the offset of the texture for plane.

Since gtkmm 4.20

Parameters

  plane | A plane.
  offset | The texture's offset for plane.

## ◆ set_stride()

void Gdk::MemoryTextureBuilder::set_stride | ( | gsize | stride | ) |

Sets the rowstride of the bytes used.

The rowstride must be set before calling build().

Since gtkmm 4.16

Parameters

  stride | The stride or 0 to unset.

## ◆ set_stride_for_plane()

void Gdk::MemoryTextureBuilder::set_stride_for_plane | ( | unsigned int | plane,
|  | gsize | stride )

Sets the stride of the texture for plane.

Since gtkmm 4.20

Parameters

  plane | A plane.
  stride | The texture's stride for plane.

## ◆ set_update_region()

void Gdk::MemoryTextureBuilder::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.16

Parameters

  region | The region to update.

## ◆ set_update_texture()

void Gdk::MemoryTextureBuilder::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.16

Parameters

  texture | The texture to update.

## ◆ set_width()

void Gdk::MemoryTextureBuilder::set_width | ( | int | width | ) |

Sets the width of the texture.

The width must be set before calling build() and conform to size requirements of the provided format.

Since gtkmm 4.16

Parameters

  width | The texture's width or 0 to unset.

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gdk::MemoryTextureBuilder > wrap | ( | GdkMemoryTextureBuilder * | object,
|  | bool | take_copy = false )
| related

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

Parameters

  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.

Returns
  A C++ instance that wraps this C instance.