:right-sidebar: True TextureDownloader =================================================================== .. currentmodule:: gi.repository.Gdk .. versionadded:: 4.10 .. class:: TextureDownloader(**kwargs) :no-contents-entry: The ``GdkTextureDownloader`` is used to download the contents of a :obj:`~gi.repository.Gdk.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 ------------ .. rst-class:: interim-class .. class:: TextureDownloader :no-index: .. classmethod:: new(texture: ~gi.repository.Gdk.Texture) -> ~gi.repository.Gdk.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. .. versionadded:: 4.10 :param texture: texture to download Methods ------- .. rst-class:: interim-class .. class:: TextureDownloader :no-index: .. method:: download_bytes() -> ~typing.Tuple[~gi.repository.GLib.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 :obj:`~gi.repository.Gdk.TextureDownloader.download_into` once allocation succeeded. .. versionadded:: 4.10 .. method:: download_into(data: list[int], stride: int) -> None Downloads the ``texture`` into local memory. .. versionadded:: 4.10 :param data: pointer to enough memory to be filled with the downloaded data of the texture :param stride: rowstride in bytes .. method:: free() -> None Frees the given downloader and all its associated resources. .. versionadded:: 4.10 .. method:: get_color_state() -> ~gi.repository.Gdk.ColorState Gets the color state that the data will be downloaded in. .. versionadded:: 4.16 .. method:: get_format() -> ~gi.repository.Gdk.MemoryFormat Gets the format that the data will be downloaded in. .. versionadded:: 4.10 .. method:: get_texture() -> ~gi.repository.Gdk.Texture Gets the texture that the downloader will download. .. versionadded:: 4.10 .. method:: set_color_state(color_state: ~gi.repository.Gdk.ColorState) -> None Sets the color state the downloader will convert the data to. By default, the sRGB colorstate returned by :obj:`~gi.repository.ColorState.get_srgb` is used. .. versionadded:: 4.16 :param color_state: the color state to use .. method:: set_format(format: ~gi.repository.Gdk.MemoryFormat) -> None Sets the format the downloader will download. By default, GDK_MEMORY_DEFAULT is set. .. versionadded:: 4.10 :param format: the format to use .. method:: set_texture(texture: ~gi.repository.Gdk.Texture) -> None Changes the texture the downloader will download. .. versionadded:: 4.10 :param texture: the new texture to download