Gdk.TextureDownloader¶
record (struct)
Used to download the contents of a Texture.
It is intended to be created as a short-term object for a single download, but can be used for multiple downloads of different textures or with different settings.
GdkTextureDownloader can be used to convert data between different formats.
Create a GdkTexture for the existing format and then download it in a
different format.
Constructors¶
new¶
Creates a new texture downloader for texture.
By default, the downloader will convert the data to the default memory format, and to the sRGB color state.
Parameters:
texture— texture to download
Methods¶
copy¶
Creates a copy of the downloader.
This function is meant for language bindings.
download_bytes¶
Downloads the given texture pixels into a GBytes. The rowstride will
be stored in the stride value.
This function will abort if it tries to download a large texture and
fails to allocate memory. If you think that may happen, you should handle
memory allocation yourself and use TextureDownloader.download_into
once allocation succeeded.
This function cannot be used with a multiplanar format. Use
TextureDownloader.download_bytes_with_planes for that purpose.
download_bytes_with_planes¶
Downloads the given texture pixels into a GBytes. The offsets and
strides of the resulting buffer will be stored in the respective values.
If the format does have less than 4 planes, the remaining offsets and strides will be
set to 0.
download_into¶
Downloads the texture into local memory.
This function cannot be used with a multiplanar format.
Parameters:
data— pointer to enough memory to be filled with the downloaded data of the texturestride— rowstride in bytes
free¶
Frees the given downloader and all its associated resources.
get_color_state¶
Gets the color state that the data will be downloaded in.
get_format¶
Gets the format that the data will be downloaded in.
get_texture¶
Gets the texture that the downloader will download.
set_color_state¶
Sets the color state the downloader will convert the data to.
By default, the sRGB colorstate returned by ColorState.get_srgb
is used.
Parameters:
color_state— the color state to use
set_format¶
Sets the format the downloader will download.
By default, GDK_MEMORY_DEFAULT is set.
Parameters:
format— the format to use
set_texture¶
Changes the texture the downloader will download.
Parameters:
texture— the new texture to download