Gdk.MemoryTextureBuilder¶
class — extends GObject.Object
Constructs 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 the properties MemoryTextureBuilder.bytes,
MemoryTextureBuilder.stride, MemoryTextureBuilder.width,
and MemoryTextureBuilder.height are mandatory - and then call
MemoryTextureBuilder.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¶
new¶
Creates a new texture builder.
Methods¶
build¶
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.
get_bytes¶
Gets the bytes previously set via MemoryTextureBuilder.set_bytes
or None if none was set.
get_color_state¶
Gets the colorstate previously set via MemoryTextureBuilder.set_color_state.
get_format¶
Gets the format previously set via MemoryTextureBuilder.set_format.
get_height¶
Gets the height previously set via MemoryTextureBuilder.set_height
or 0 if the height wasn't set.
get_offset¶
Gets the offset previously set via MemoryTextureBuilder.set_offset.
Parameters:
plane— a plane
get_stride¶
Gets the stride previously set via MemoryTextureBuilder.set_stride.
get_stride_for_plane¶
Gets the stride previously set via MemoryTextureBuilder.set_stride_for_plane.
Parameters:
plane— a plane
get_update_region¶
Gets the region previously set via MemoryTextureBuilder.set_update_region
or None if none was set.
get_update_texture¶
Gets the texture previously set via MemoryTextureBuilder.set_update_texture
or None if none was set.
get_width¶
Gets the width previously set via MemoryTextureBuilder.set_width
or 0 if the width wasn't set.
set_bytes¶
Sets the data to be shown but the texture.
The bytes must be set before calling MemoryTextureBuilder.build.
Parameters:
bytes— The bytes the texture shows orNoneto unset
set_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.
Parameters:
color_state— The colorstate describing the data
set_format¶
Sets the format of the bytes.
The default is GDK_MEMORY_R8G8B8A8_PREMULTIPLIED.
Parameters:
format— The texture's format
set_height¶
Sets the height of the texture.
The height must be set before calling MemoryTextureBuilder.build
and conform to size requirements of the provided format.
Parameters:
height— The texture's height or 0 to unset
set_offset¶
Sets the offset of the texture for plane.
Parameters:
plane— a planeoffset— the texture's offset forplane
set_stride¶
Sets the rowstride of the bytes used.
The rowstride must be set before calling MemoryTextureBuilder.build.
Parameters:
stride— the stride or 0 to unset
set_stride_for_plane¶
Sets the stride of the texture for plane.
Parameters:
plane— a planestride— the texture's stride forplane
set_update_region¶
Sets the region to be updated by this texture.
Together with MemoryTextureBuilder.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.
Parameters:
region— the region to update
set_update_texture¶
Sets the texture to be updated by this texture.
See MemoryTextureBuilder.set_update_region for an explanation.
Parameters:
texture— the texture to update
set_width¶
Sets the width of the texture.
The width must be set before calling MemoryTextureBuilder.build
and conform to size requirements of the provided format.
Parameters:
width— The texture's width or 0 to unset
Properties¶
bytes¶
The bytes holding the data.
color_state¶
The colorstate describing the data.
format¶
The format of the data.
height¶
The height of the texture.
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.
update_region¶
The update region for MemoryTextureBuilder.update-texture.
update_texture¶
The texture MemoryTextureBuilder.update-region is an update for.
width¶
The width of the texture.