gtkmm 4.17.0
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Related Symbols | List of all members
Gdk::MemoryTexture Class Reference

A Gdk::Texture representing image data in memory. More...

#include <gdkmm/memorytexture.h>

Inheritance diagram for Gdk::MemoryTexture:
Inheritance graph
[legend]

Public Types

enum class  Format {
  Format::B8G8R8A8_PREMULTIPLIED ,
  Format::A8R8G8B8_PREMULTIPLIED ,
  Format::R8G8B8A8_PREMULTIPLIED ,
  Format::B8G8R8A8 ,
  Format::A8R8G8B8 ,
  Format::R8G8B8A8 ,
  Format::A8B8G8R8 ,
  Format::R8G8B8 ,
  Format::B8G8R8 ,
  Format::R16G16B16 ,
  Format::R16G16B16A16_PREMULTIPLIED ,
  Format::R16G16B16A16 ,
  Format::R16G16B16_FLOAT ,
  Format::R16G16B16A16_FLOAT_PREMULTIPLIED ,
  Format::R16G16B16A16_FLOAT ,
  Format::R32G32B32_FLOAT ,
  Format::R32G32B32A32_FLOAT_PREMULTIPLIED ,
  Format::R32G32B32A32_FLOAT ,
  Format::G8A8_PREMULTIPLIED ,
  Format::G8A8 ,
  Format::G8 ,
  Format::G16A16_PREMULTIPLIED ,
  Format::G16A16 ,
  Format::G16 ,
  Format::A8 ,
  Format::A16 ,
  Format::A16_FLOAT ,
  Format::A32_FLOAT ,
  Format::A8B8G8R8_PREMULTIPLIED ,
  Format::B8G8R8X8 ,
  Format::X8R8G8B8 ,
  Format::R8G8B8X8 ,
  Format::X8B8G8R8 ,
  Format::N_FORMATS
}
 Gdk::MemoryFormat describes formats that image data can have in memory. More...
 
- Public Types inherited from Glib::Object
typedef void(*)(gpointer data DestroyNotify)
 
- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify
 
- Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify func_destroy_notify
 
- Public Types inherited from Gdk::Paintable
enum class  Flags {
  Flags::STATIC_SIZE = 1 << 0 ,
  Flags::STATIC_CONTENTS = 1 << 1
}
 Flags about a paintable object. More...
 

Public Member Functions

 MemoryTexture (MemoryTexture &&src) noexcept
 
MemoryTextureoperator= (MemoryTexture &&src) noexcept
 
 ~MemoryTexture () noexcept override
 
GdkMemoryTexturegobj ()
 Provides access to the underlying C GObject.
 
const GdkMemoryTexturegobj () const
 Provides access to the underlying C GObject.
 
GdkMemoryTexturegobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
 
- Public Member Functions inherited from Gdk::Texture
 Texture (Texture &&src) noexcept
 
Textureoperator= (Texture &&src) noexcept
 
 ~Texture () noexcept override
 
GdkTexturegobj ()
 Provides access to the underlying C GObject.
 
const GdkTexturegobj () const
 Provides access to the underlying C GObject.
 
GdkTexturegobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
 
int get_width () const
 Returns the width of texture, in pixels.
 
int get_height () const
 Returns the height of the texture, in pixels.
 
MemoryFormat get_format () const
 Gets the memory format most closely associated with the data of the texture.
 
Glib::RefPtr< ColorStateget_color_state () const
 Returns the color state associated with the texture.
 
void download (guchar *data, gsize stride) const
 Downloads the texture into local memory.
 
bool save_to_png (const Glib::ustring &filename) const
 Store the given texture to the filename as a PNG file.
 
Glib::RefPtr< Glib::Bytessave_to_png_bytes () const
 Store the given texture in memory as a PNG file.
 
bool save_to_tiff (const std::string &filename) const
 Store the given texture to the filename as a TIFF file.
 
Glib::RefPtr< Glib::Bytessave_to_tiff_bytes () const
 Store the given texture in memory as a TIFF file.
 
Glib::PropertyProxy_ReadOnly< int > property_width () const
 The width of the texture, in pixels.
 
Glib::PropertyProxy_ReadOnly< int > property_height () const
 The height of the texture, in pixels.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ColorState > > property_color_state () const
 The color state of the texture.
 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
voidget_data (const QueryQuark &key)
 
void set_data (const Quark &key, void *data)
 
void set_data_with_c_callback (const Quark &key, void *data, GDestroyNotify notify)
 
void set_data (const Quark &key, void *data, DestroyNotify notify)
 
void remove_data (const QueryQuark &quark)
 
voidsteal_data (const QueryQuark &quark)
 
Glib::RefPtr< Glib::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 
PropertyType get_property (const Glib::ustring &property_name) const
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
 
void freeze_notify ()
 
void thaw_notify ()
 
virtual void reference () const
 
virtual void unreference () const
 
GObjectgobj ()
 
const GObjectgobj () const
 
GObjectgobj_copy () const
 
- Public Member Functions inherited from sigc::trackable
 trackable () noexcept
 
 trackable (const trackable &src) noexcept
 
 trackable (trackable &&src) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (notifiable *data) const
 
- Public Member Functions inherited from Gdk::Paintable
 Paintable (Paintable &&src) noexcept
 
Paintableoperator= (Paintable &&src) noexcept
 
 ~Paintable () noexcept override
 
GdkPaintablegobj ()
 Provides access to the underlying C GObject.
 
const GdkPaintablegobj () const
 Provides access to the underlying C GObject.
 
void snapshot (const Glib::RefPtr< Gdk::Snapshot > & snapshot, double width, double height)
 Snapshots the given paintable with the given width and height.
 
Glib::RefPtr< const Paintableget_current_image () const
 Gets an immutable paintable for the current contents displayed by paintable.
 
Flags get_flags () const
 Get flags for the paintable.
 
int get_intrinsic_width () const
 Gets the preferred width the paintable would like to be displayed at.
 
int get_intrinsic_height () const
 Gets the preferred height the paintable would like to be displayed at.
 
double get_intrinsic_aspect_ratio () const
 Gets the preferred aspect ratio the paintable would like to be displayed at.
 
void compute_concrete_size (double specified_width, double specified_height, double default_width, double default_height, double &concrete_width, double &concrete_height) const
 Compute a concrete size for the Gdk::Paintable.
 
void invalidate_contents ()
 Called by implementations of Gdk::Paintable to invalidate their contents.
 
void invalidate_size ()
 Called by implementations of Gdk::Paintable to invalidate their size.
 
Glib::SignalProxy< void()> signal_invalidate_contents ()
 
Glib::SignalProxy< void()> signal_invalidate_size ()
 
- Public Member Functions inherited from Glib::Interface
 Interface ()
 
 Interface (Interface &&src) noexcept
 
Interfaceoperator= (Interface &&src) noexcept
 
 Interface (const Glib::Interface_Class &interface_class)
 
 Interface (GObject *castitem)
 
 ~Interface () noexcept override
 
 Interface (const Interface &)=delete
 
Interfaceoperator= (const Interface &)=delete
 
GObjectgobj ()
 
const GObjectgobj () const
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 
static Glib::RefPtr< Texturecreate (int width, int height, Format format, const Glib::RefPtr< const Glib::Bytes > & bytes, gsize stride)
 Creates a new texture for a blob of image data.
 
- Static Public Member Functions inherited from Gdk::Texture
static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 
static Glib::RefPtr< Texturecreate_for_pixbuf (const Glib::RefPtr< Pixbuf > &pixbuf)
 Creates a new texture object representing the Gdk::Pixbuf.
 
static Glib::RefPtr< Texturecreate_from_resource (const std::string &resource_path)
 Creates a new texture by loading an image from a resource.
 
static Glib::RefPtr< Texturecreate_from_file (const Glib::RefPtr< Gio::File > & file)
 Creates a new texture by loading an image from a file.
 
static Glib::RefPtr< Texturecreate_from_filename (const std::string & path)
 Creates a new texture by loading an image from a file.
 
static Glib::RefPtr< Texturecreate_from_bytes (const Glib::RefPtr< const Glib::Bytes > & bytes)
 Creates a new texture by loading an image from memory,.
 
- Static Public Member Functions inherited from Gdk::Paintable
static void add_interface (GType gtype_implementer)
 
static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 

Static Public Attributes

static const Format DEFAULT_FORMAT = static_cast<Format>(GDK_MEMORY_DEFAULT)
 Default memory format used by GTK.
 

Protected Member Functions

 MemoryTexture ()
 
- Protected Member Functions inherited from Gdk::Texture
 Texture ()
 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams &construct_params)
 
 Object (GObject *castitem)
 
 ~Object () noexcept override
 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 
 ObjectBase (const char *custom_type_name)
 
 ObjectBase (const std::type_info &custom_type_info)
 
 ObjectBase (ObjectBase &&src) noexcept
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 
- Protected Member Functions inherited from Gdk::Paintable
 Paintable ()
 You should derive from this class to use it.
 
virtual void snapshot_vfunc (const Glib::RefPtr< Gdk::Snapshot > &snapshot, double width, double height)
 
virtual Glib::RefPtr< Paintableget_current_image_vfunc () const
 
virtual Flags get_flags_vfunc () const
 
virtual int get_intrinsic_width_vfunc () const
 
virtual int get_intrinsic_height_vfunc () const
 
virtual double get_intrinsic_aspect_ratio_vfunc () const
 

Related Symbols

(Note that these are not member symbols.)

Glib::RefPtr< Gdk::MemoryTexturewrap (GdkMemoryTexture *object, bool take_copy=false)
 A Glib::wrap() method for this object.
 

Detailed Description

A Gdk::Texture representing image data in memory.

Since gtkmm 3.98:

Constructor & Destructor Documentation

◆ MemoryTexture() [1/2]

Gdk::MemoryTexture::MemoryTexture ( MemoryTexture &&  src)
noexcept

◆ ~MemoryTexture()

Gdk::MemoryTexture::~MemoryTexture ( )
overridenoexcept

◆ MemoryTexture() [2/2]

Gdk::MemoryTexture::MemoryTexture ( )
protected

Member Function Documentation

◆ create()

static Glib::RefPtr< Texture > Gdk::MemoryTexture::create ( int  width,
int  height,
Format  format,
const Glib::RefPtr< const Glib::Bytes > &  bytes,
gsize  stride 
)
static

Creates a new texture for a blob of image data.

The Glib::Bytes must contain stride × height pixels in the given format.

Parameters
widthThe width of the texture.
heightThe height of the texture.
formatThe format of the data.
bytesThe Glib::Bytes containing the pixel data.
strideRowstride for the data.
Returns
A newly-created Gdk::Texture.

◆ get_type()

static GType Gdk::MemoryTexture::get_type ( )
static

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

◆ gobj() [1/2]

GdkMemoryTexture * Gdk::MemoryTexture::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GdkMemoryTexture * Gdk::MemoryTexture::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

GdkMemoryTexture * Gdk::MemoryTexture::gobj_copy ( )

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

◆ operator=()

MemoryTexture & Gdk::MemoryTexture::operator= ( MemoryTexture &&  src)
noexcept

Friends And Related Symbol Documentation

◆ wrap()

Glib::RefPtr< Gdk::MemoryTexture > wrap ( GdkMemoryTexture 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

◆ DEFAULT_FORMAT

const Format Gdk::MemoryTexture::DEFAULT_FORMAT = static_cast<Format>(GDK_MEMORY_DEFAULT)
static

Default memory format used by GTK.

It is the format provided by Gdk::Texture::download(). It is equal to Cairo::Surface::Format::ARGB32.

Be aware that unlike the Format values, this format is different for different endianness.