gtkmm  4.16.0
Public Member Functions | Static Public Member Functions | Protected Attributes | Related Functions | 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)
 
TextureDownloaderoperator= (const TextureDownloader& other)
 
 TextureDownloader (TextureDownloader&& other) noexcept
 
TextureDownloaderoperator= (TextureDownloader&& other) noexcept
 
 ~TextureDownloader () noexcept
 
void swap (TextureDownloader& other) noexcept
 
GdkTextureDownloader* gobj ()
 Provides access to the underlying C instance. More...
 
const GdkTextureDownloader* gobj () const
 Provides access to the underlying C instance. More...
 
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. More...
 
 TextureDownloader (const Glib::RefPtr< Texture >& texture)
 Creates a new texture downloader for texture. More...
 
void set_texture (const Glib::RefPtr< Texture >& texture)
 Changes the texture the downloader will download. More...
 
Glib::RefPtr< Textureget_texture ()
 Gets the texture that the downloader will download. More...
 
Glib::RefPtr< const Textureget_texture () const
 Gets the texture that the downloader will download. More...
 
void set_format (MemoryFormat format)
 Sets the format the downloader will download. More...
 
MemoryFormat get_format () const
 Gets the format that the data will be downloaded in. More...
 
Glib::RefPtr< ColorStateget_color_state () const
 Gets the color state that the data will be downloaded in. More...
 
void set_color_state (const Glib::RefPtr< const ColorState >& color_state)
 Sets the color state the downloader will convert the data to. More...
 
void download_into (guchar*data, gsize stride) const
 Downloads the texture into local memory. More...
 
Glib::RefPtr< Glib::Bytes > download_bytes (gsize& out_stride) const
 Downloads the given texture pixels into a Glib::Bytes. More...
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...
 

Protected Attributes

GdkTextureDownloader* gobject_
 

Related Functions

(Note that these are not member functions.)

void swap (TextureDownloader& lhs, TextureDownloader& rhs) noexcept
 
Gdk::TextureDownloader wrap (GdkTextureDownloader* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

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

Gdk::TextureDownloader::TextureDownloader ( )
Gdk::TextureDownloader::TextureDownloader ( GdkTextureDownloader *  gobject,
bool  make_a_copy = true 
)
explicit
Gdk::TextureDownloader::TextureDownloader ( const TextureDownloader other)
Gdk::TextureDownloader::TextureDownloader ( TextureDownloader&&  other)
noexcept
Gdk::TextureDownloader::~TextureDownloader ( )
noexcept
Gdk::TextureDownloader::TextureDownloader ( const Glib::RefPtr< Texture >&  texture)
explicit

Creates a new texture downloader for texture.

Since gtkmm 4.10:

Member Function Documentation

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_strideThe stride of the resulting data in bytes.
Returns
The downloaded pixels.
void Gdk::TextureDownloader::download_into ( guchar *  data,
gsize  stride 
) const

Downloads the texture into local memory.

Since gtkmm 4.10:
Parameters
dataPointer to enough memory to be filled with the downloaded data of the texture.
strideRowstride in bytes.
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.
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.
Glib::RefPtr<Texture> Gdk::TextureDownloader::get_texture ( )

Gets the texture that the downloader will download.

Since gtkmm 4.10:
Returns
The texture to download.
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.
static GType Gdk::TextureDownloader::get_type ( )
static

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

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

Provides access to the underlying C instance.

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

Provides access to the underlying C instance.

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.

TextureDownloader& Gdk::TextureDownloader::operator= ( const TextureDownloader other)
TextureDownloader& Gdk::TextureDownloader::operator= ( TextureDownloader&&  other)
noexcept
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_stateThe color state to use.
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
formatThe format to use.
void Gdk::TextureDownloader::set_texture ( const Glib::RefPtr< Texture >&  texture)

Changes the texture the downloader will download.

Since gtkmm 4.10:
Parameters
textureThe new texture to download.
void Gdk::TextureDownloader::swap ( TextureDownloader other)
noexcept

Friends And Related Function Documentation

void swap ( TextureDownloader lhs,
TextureDownloader rhs 
)
related
Parameters
lhsThe left-hand side
rhsThe right-hand side
Gdk::TextureDownloader wrap ( GdkTextureDownloader *  object,
bool  take_copy = false 
)
related

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

Parameters
objectThe C instance.
take_copyFalse 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

GdkTextureDownloader* Gdk::TextureDownloader::gobject_
protected