Gdk.TextureDownloader

Fields

None

Methods

class

new (texture)

copy ()

download_bytes ()

download_into (data, stride)

free ()

get_format ()

get_texture ()

set_format (format)

set_texture (texture)

Details

class Gdk.TextureDownloader

The GdkTextureDownloader is used to download the contents of a [class`Gdk`.Texture].

It is intended to be created as a short-term object for a single download, but can be used for multipe 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.

New in version 4.10.

classmethod new(texture)[source]
Parameters:

texture (Gdk.Texture) – texture to download

Returns:

A new texture downloader

Return type:

Gdk.TextureDownloader

Creates a new texture downloader for texture.

New in version 4.10.

copy()[source]
Returns:

A copy of the downloader

Return type:

Gdk.TextureDownloader

Creates a copy of the downloader.

This function is meant for language bindings.

New in version 4.10.

download_bytes()[source]
Returns:

The downloaded pixels

out_stride:

The stride of the resulting data in bytes

Return type:

(GLib.Bytes, out_stride: 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 [method`Gdk`.TextureDownloader.download_into] once allocation succeeded.

New in version 4.10.

download_into(data, stride)[source]
Parameters:
  • data (bytes) – pointer to enough memory to be filled with the downloaded data of the texture

  • stride (int) – rowstride in bytes

Downloads the texture into local memory.

New in version 4.10.

free()[source]

Frees the given downloader and all its associated resources.

New in version 4.10.

get_format()[source]
Returns:

The format of the download

Return type:

Gdk.MemoryFormat

Gets the format that the data will be downloaded in.

New in version 4.10.

get_texture()[source]
Returns:

The texture to download

Return type:

Gdk.Texture

Gets the texture that the downloader will download.

New in version 4.10.

set_format(format)[source]
Parameters:

format (Gdk.MemoryFormat) – the format to use

Sets the format the downloader will download.

By default, GDK_MEMORY_DEFAULT is set.

New in version 4.10.

set_texture(texture)[source]
Parameters:

texture (Gdk.Texture) – the new texture to download

Changes the texture the downloader will download.

New in version 4.10.