TextureDownloader#
Added in version 4.10.
- class TextureDownloader(**kwargs)#
The GdkTextureDownloader
is 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#
- class TextureDownloader
- classmethod new(texture: Texture) TextureDownloader #
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.
Added in version 4.10.
- Parameters:
texture – texture to download
Methods#
- class TextureDownloader
- download_bytes() Tuple[Bytes, int] #
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
download_into
once allocation succeeded.Added in version 4.10.
- download_into(data: list[int], stride: int) None #
Downloads the
texture
into local memory.Added in version 4.10.
- Parameters:
data – pointer to enough memory to be filled with the downloaded data of the texture
stride – rowstride in bytes
- get_color_state() ColorState #
Gets the color state that the data will be downloaded in.
Added in version 4.16.
- get_format() MemoryFormat #
Gets the format that the data will be downloaded in.
Added in version 4.10.
- set_color_state(color_state: ColorState) None #
Sets the color state the downloader will convert the data to.
By default, the sRGB colorstate returned by
get_srgb
is used.Added in version 4.16.
- Parameters:
color_state – the color state to use
- set_format(format: MemoryFormat) None #
Sets the format the downloader will download.
By default, GDK_MEMORY_DEFAULT is set.
Added in version 4.10.
- Parameters:
format – the format to use