gtkmm: Gdk::TextureDownloader Class Reference

gtkmm 4.16.0

Public Member Functions | Static Public Member Functions | Protected Attributes | Related Symbols | List of all members
Gdk::TextureDownloader Class Reference

The Gdk::TextureDownloader is used to download the contents of a Gdk::Texture. More...

`#include <gdkmm/texturedownloader.h>`

## Public Member Functions
| TextureDownloader ()
| TextureDownloader (GdkTextureDownloader * gobject, bool make_a_copy=true)
| TextureDownloader (const TextureDownloader & other)
TextureDownloader & | operator= (const TextureDownloader & other)
| TextureDownloader (TextureDownloader && other) noexcept
TextureDownloader & | operator= (TextureDownloader && other) noexcept
| ~TextureDownloader () noexcept
void | swap (TextureDownloader & other) noexcept
GdkTextureDownloader * | gobj ()
| Provides access to the underlying C instance.
const GdkTextureDownloader * | gobj () const
| Provides access to the underlying C instance.
GdkTextureDownloader * | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
| TextureDownloader (const Glib::RefPtr< Texture > & texture)
| Creates a new texture downloader for texture.
void | set_texture (const Glib::RefPtr< Texture > & texture)
| Changes the texture the downloader will download.
Glib::RefPtr< Texture > | get_texture ()
| Gets the texture that the downloader will download.
Glib::RefPtr< const Texture > | get_texture () const
| Gets the texture that the downloader will download.
void | set_format (MemoryFormat format)
| Sets the format the downloader will download.
MemoryFormat | get_format () const
| Gets the format that the data will be downloaded in.
Glib::RefPtr< ColorState > | get_color_state () const
| Gets the color state that the data will be downloaded in.
void | set_color_state (const Glib::RefPtr< const ColorState > & color_state)
| Sets the color state the downloader will convert the data to.
void | download_into (guchar *data, gsize stride) const
| Downloads the texture into local memory.
Glib::RefPtr< Glib::Bytes > | download_bytes (gsize & out_stride) const
| Downloads the given texture pixels into a `Glib::Bytes`.

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Attributes
GdkTextureDownloader * | gobject_

## Related Symbols
(Note that these are not member symbols.)
void | swap (TextureDownloader & lhs, TextureDownloader & rhs) noexcept
Gdk::TextureDownloader | wrap (GdkTextureDownloader * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

The Gdk::TextureDownloader is used to download the contents of a 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.

Gdk::TextureDownloader can be used to convert data between different formats. Create a Gdk::Texture for the existing format and then download it in a different format.

Since gtkmm 4.10

## Constructor & Destructor Documentation

## ◆ TextureDownloader() [1/5]

Gdk::TextureDownloader::TextureDownloader | ( |  | ) |

## ◆ TextureDownloader() [2/5]

Gdk::TextureDownloader::TextureDownloader | ( | GdkTextureDownloader * | gobject,
|  | bool | make_a_copy = true )
| explicit

## ◆ TextureDownloader() [3/5]

Gdk::TextureDownloader::TextureDownloader | ( | const TextureDownloader & | other | ) |

## ◆ TextureDownloader() [4/5]

Gdk::TextureDownloader::TextureDownloader | ( | TextureDownloader && | other | ) |
| noexcept

## ◆ ~TextureDownloader()

Gdk::TextureDownloader::~TextureDownloader | ( |  | ) |
| noexcept

## ◆ TextureDownloader() [5/5]

Gdk::TextureDownloader::TextureDownloader | ( | const Glib::RefPtr< Texture > & | texture | ) |
| explicit

Creates a new texture downloader for texture.

Since gtkmm 4.10

## Member Function Documentation

## ◆ download_bytes()

Glib::RefPtr< Glib::Bytes > Gdk::TextureDownloader::download_bytes | ( | gsize & | out_stride | ) | const

Downloads the given texture pixels into a `Glib::Bytes`.

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.

Since gtkmm 4.10

Parameters

  out_stride | The stride of the resulting data in bytes.

Returns
  The downloaded pixels.

## ◆ download_into()

void Gdk::TextureDownloader::download_into | ( | guchar * | data,
|  | gsize | stride ) const

Downloads the texture into local memory.

Since gtkmm 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()

Glib::RefPtr< ColorState > Gdk::TextureDownloader::get_color_state | ( |  | ) | const

Gets the color state that the data will be downloaded in.

Since gtkmm 4.16

Returns
  The color state of the download.

## ◆ get_format()

MemoryFormat Gdk::TextureDownloader::get_format | ( |  | ) | const

Gets the format that the data will be downloaded in.

Since gtkmm 4.10

Returns
  The format of the download.

## ◆ get_texture() [1/2]

Glib::RefPtr< Texture > Gdk::TextureDownloader::get_texture | ( |  | ) |

Gets the texture that the downloader will download.

Since gtkmm 4.10

Returns
  The texture to download.

## ◆ get_texture() [2/2]

Glib::RefPtr< const Texture > Gdk::TextureDownloader::get_texture | ( |  | ) | const

Gets the texture that the downloader will download.

Since gtkmm 4.10

Returns
  The texture to download.

## ◆ get_type()

static GType Gdk::TextureDownloader::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GdkTextureDownloader * Gdk::TextureDownloader::gobj | ( |  | ) |
| inline

Provides access to the underlying C instance.

## ◆ gobj() [2/2]

const GdkTextureDownloader * Gdk::TextureDownloader::gobj | ( |  | ) | const
| inline

Provides access to the underlying C instance.

## ◆ gobj_copy()

GdkTextureDownloader * Gdk::TextureDownloader::gobj_copy | ( |  | ) | const

Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.

## ◆ operator=() [1/2]

TextureDownloader & Gdk::TextureDownloader::operator= | ( | const TextureDownloader & | other | ) |

## ◆ operator=() [2/2]

TextureDownloader & Gdk::TextureDownloader::operator= | ( | TextureDownloader && | other | ) |
| noexcept

## ◆ set_color_state()

void Gdk::TextureDownloader::set_color_state | ( | const Glib::RefPtr< const ColorState > & | color_state | ) |

Sets the color state the downloader will convert the data to.

By default, the sRGB colorstate returned by color_state_get_srgb() is used.

Since gtkmm 4.16

Parameters

  color_state | The color state to use.

## ◆ set_format()

void Gdk::TextureDownloader::set_format | ( | MemoryFormat | format | ) |

Sets the format the downloader will download.

By default, GDK_MEMORY_DEFAULT is set.

Since gtkmm 4.10

Parameters

  format | The format to use.

## ◆ set_texture()

void Gdk::TextureDownloader::set_texture | ( | const Glib::RefPtr< Texture > & | texture | ) |

Changes the texture the downloader will download.

Since gtkmm 4.10

Parameters

  texture | The new texture to download.

## ◆ swap()

void Gdk::TextureDownloader::swap | ( | TextureDownloader & | other | ) |
| noexcept

## Friends And Related Symbol Documentation

## ◆ swap()

void swap | ( | TextureDownloader & | lhs,
|  | TextureDownloader & | rhs )
| related

Parameters

  lhs | The left-hand side
  rhs | The right-hand side

## ◆ wrap()

Gdk::TextureDownloader wrap | ( | GdkTextureDownloader * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.

## Member Data Documentation

## ◆ gobject_

GdkTextureDownloader* Gdk::TextureDownloader::gobject_
| protected