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.

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: Sequence[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

free() None

Frees the given downloader and all its associated resources.

Added in version 4.10.

get_format() MemoryFormat

Gets the format that the data will be downloaded in.

Added in version 4.10.

get_texture() Texture

Gets the texture that the downloader will download.

Added in version 4.10.

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

set_texture(texture: Texture) None

Changes the texture the downloader will download.

Added in version 4.10.

Parameters:

texture – the new texture to download