MemoryTextureBuilder#
Added in version 4.16.
Superclasses: Object
GdkMemoryTextureBuilder
is a builder used to construct Texture
objects
from system memory provided via Bytes
.
The operation is quite simple: Create a texture builder, set all the necessary
properties - keep in mind that the properties bytes
,
stride
, width
,
and height
are mandatory - and then call
build
to create the new texture.
GdkMemoryTextureBuilder
can be used for quick one-shot construction of
textures as well as kept around and reused to construct multiple textures.
Constructors#
- class MemoryTextureBuilder
- classmethod new() MemoryTextureBuilder #
Creates a new texture builder.
Added in version 4.16.
Methods#
- class MemoryTextureBuilder
- build() Texture #
Builds a new
GdkTexture
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.
Added in version 4.16.
- get_bytes() Bytes | None #
Gets the bytes previously set via
set_bytes()
orNone
if none was set.Added in version 4.16.
- get_color_state() ColorState #
Gets the colorstate previously set via
set_color_state()
.Added in version 4.16.
- get_format() MemoryFormat #
Gets the format previously set via
set_format()
.Added in version 4.16.
- get_height() int #
Gets the height previously set via
set_height()
or 0 if the height wasn’t set.Added in version 4.16.
- get_stride() int #
Gets the stride previously set via
set_stride()
.Added in version 4.16.
- get_update_region() Region | None #
Gets the region previously set via
set_update_region()
orNone
if none was set.Added in version 4.16.
- get_update_texture() Texture | None #
Gets the texture previously set via
set_update_texture()
orNone
if none was set.Added in version 4.16.
- get_width() int #
Gets the width previously set via
set_width()
or 0 if the width wasn’t set.Added in version 4.16.
- set_bytes(bytes: Bytes | None = None) None #
Sets the data to be shown but the texture.
The bytes must be set before calling
build
.Added in version 4.16.
- Parameters:
bytes – The bytes the texture shows or
None
to unset
- set_color_state(color_state: ColorState | None = None) None #
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.
Added in version 4.16.
- Parameters:
color_state – The colorstate describing the data
- set_format(format: MemoryFormat) None #
Sets the format of the bytes.
The default is
GDK_MEMORY_R8G8B8A8_PREMULTIPLIED
.Added in version 4.16.
- Parameters:
format – The texture’s format
- set_height(height: int) None #
Sets the height of the texture.
The height must be set before calling
build
.Added in version 4.16.
- Parameters:
height – The texture’s height or 0 to unset
- set_stride(stride: int) None #
Sets the rowstride of the bytes used.
The rowstride must be set before calling
build
.Added in version 4.16.
- Parameters:
stride – the stride or 0 to unset
- set_update_region(region: Region | None = None) None #
Sets the region to be updated by this texture.
Together with
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.
Added in version 4.16.
- Parameters:
region – the region to update
- set_update_texture(texture: Texture | None = None) None #
Sets the texture to be updated by this texture.
See
set_update_region
for an explanation.Added in version 4.16.
- Parameters:
texture – the texture to update
Properties#
- class MemoryTextureBuilder
-
- props.color_state: ColorState#
The type of the None singleton.
Added in version 4.16.
- props.format: MemoryFormat#
The type of the None singleton.
Added in version 4.16.
- props.update_region: Region#
The type of the None singleton.
Added in version 4.16.