gtkmm 4.14.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gdk::GLTexture Class Reference

A Gdk::Texture representing a GL texture object. More...

#include <gdkmm/gltexture.h>

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

Public Types

using SlotGLReleased = sigc::slot< void()>
 For instance, void on_gl_resources_released();. More...
 
- 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

 GLTexture (GLTexture && src) noexcept
 
GLTextureoperator= (GLTexture && src) noexcept
 
 ~GLTexture () noexcept override
 
GdkGLTexture * gobj ()
 Provides access to the underlying C GObject. More...
 
const GdkGLTexture * gobj () const
 Provides access to the underlying C GObject. More...
 
GdkGLTexture * gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
void release ()
 Releases the GL resources held by a Gdk::GLTexture. More...
 
- Public Member Functions inherited from Gdk::Texture
 Texture (Texture && src) noexcept
 
Textureoperator= (Texture && src) noexcept
 
 ~Texture () noexcept override
 
GdkTexture * gobj ()
 Provides access to the underlying C GObject. More...
 
const GdkTexture * gobj () const
 Provides access to the underlying C GObject. More...
 
GdkTexture * gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
int get_width () const
 Returns the width of texture, in pixels. More...
 
int get_height () const
 Returns the height of the texture, in pixels. More...
 
MemoryFormat get_format () const
 Gets the memory format most closely associated with the data of the texture. More...
 
void download (guchar *data, gsize stride) const
 Downloads the texture into local memory. More...
 
bool save_to_png (const Glib::ustring & filename) const
 Store the given texture to the filename as a PNG file. More...
 
Glib::RefPtr< Glib::Bytes > save_to_png_bytes () const
 Store the given texture in memory as a PNG file. More...
 
bool save_to_tiff (const std::string & filename) const
 Store the given texture to the filename as a TIFF file. More...
 
Glib::RefPtr< Glib::Bytes > save_to_tiff_bytes () const
 Store the given texture in memory as a TIFF file. More...
 
Glib::PropertyProxy_ReadOnly< int > property_width () const
 The width of the texture, in pixels. More...
 
Glib::PropertyProxy_ReadOnly< int > property_height () const
 The height of the texture, in pixels. More...
 
- Public Member Functions inherited from Gdk::Paintable
 Paintable (Paintable && src) noexcept
 
Paintableoperator= (Paintable && src) noexcept
 
 ~Paintable () noexcept override
 
GdkPaintable * gobj ()
 Provides access to the underlying C GObject. More...
 
const GdkPaintable * gobj () const
 Provides access to the underlying C GObject. More...
 
void snapshot (const Glib::RefPtr< Gdk::Snapshot > & snapshot, double width, double height)
 Snapshots the given paintable with the given width and height. More...
 
Glib::RefPtr< const Paintableget_current_image () const
 Gets an immutable paintable for the current contents displayed by paintable. More...
 
Flags get_flags () const
 Get flags for the paintable. More...
 
int get_intrinsic_width () const
 Gets the preferred width the paintable would like to be displayed at. More...
 
int get_intrinsic_height () const
 Gets the preferred height the paintable would like to be displayed at. More...
 
double get_intrinsic_aspect_ratio () const
 Gets the preferred aspect ratio the paintable would like to be displayed at. More...
 
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. More...
 
void invalidate_contents ()
 Called by implementations of Gdk::Paintable to invalidate their contents. More...
 
void invalidate_size ()
 Called by implementations of Gdk::Paintable to invalidate their size. More...
 
Glib::SignalProxy< void()> signal_invalidate_contents ()
 
Glib::SignalProxy< void()> signal_invalidate_size ()
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...
 
static Glib::RefPtr< Texturecreate (const Glib::RefPtr< GLContext > & context, guint id, int width, int height, const SlotGLReleased & slot={})
 Creates a new texture for an existing GL texture. More...
 
- 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. More...
 
static Glib::RefPtr< Texturecreate_for_pixbuf (const Glib::RefPtr< Pixbuf > & pixbuf)
 Creates a new texture object representing the Gdk::Pixbuf. More...
 
static Glib::RefPtr< Texturecreate_from_resource (const std::string & resource_path)
 Creates a new texture by loading an image from a resource. More...
 
static Glib::RefPtr< Texturecreate_from_file (const Glib::RefPtr< Gio::File > & file)
 Creates a new texture by loading an image from a file. More...
 
static Glib::RefPtr< Texturecreate_from_filename (const std::string & path)
 Creates a new texture by loading an image from a file. More...
 
static Glib::RefPtr< Texturecreate_from_bytes (const Glib::RefPtr< const Glib::Bytes > & bytes)
 Creates a new texture by loading an image from memory,. More...
 
- 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. More...
 

Protected Member Functions

 GLTexture ()
 
- Protected Member Functions inherited from Gdk::Texture
 Texture ()
 
- Protected Member Functions inherited from Gdk::Paintable
 Paintable ()
 You should derive from this class to use it. More...
 
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 Functions

(Note that these are not member functions.)

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

Detailed Description

A Gdk::Texture representing a GL texture object.

Since gtkmm 3.94:

Member Typedef Documentation

◆ SlotGLReleased

using Gdk::GLTexture::SlotGLReleased = sigc::slot<void()>

For instance, void on_gl_resources_released();.

Constructor & Destructor Documentation

◆ GLTexture() [1/2]

Gdk::GLTexture::GLTexture ( GLTexture &&  src)
noexcept

◆ ~GLTexture()

Gdk::GLTexture::~GLTexture ( )
overridenoexcept

◆ GLTexture() [2/2]

Gdk::GLTexture::GLTexture ( )
protected

Member Function Documentation

◆ create()

static Glib::RefPtr< Texture > Gdk::GLTexture::create ( const Glib::RefPtr< GLContext > &  context,
guint  id,
int  width,
int  height,
const SlotGLReleased slot = {} 
)
static

Creates a new texture for an existing GL texture.

Note that the GL texture must not be modified until slot is called, which will happen when the GdkTexture object is finalized, or due to an explicit call of release().

Deprecated: 4.12: Gdk::GLTextureBuilder supersedes this function and provides extended functionality for creating GL textures.

Deprecated:
Gdk::GLTextureBuilder supercedes this function and provides extended functionality for creating GL textures.
Parameters
contextA Gdk::GLContext.
idThe ID of a texture that was created with context.
widthThe nominal width of the texture.
heightThe nominal height of the texture.
slotA destroy notify that will be called when the GL resources are released.
Returns
A newly-created Gdk::Texture.

◆ get_type()

static GType Gdk::GLTexture::get_type ( )
static

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

◆ gobj() [1/2]

GdkGLTexture * Gdk::GLTexture::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GdkGLTexture * Gdk::GLTexture::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

GdkGLTexture * Gdk::GLTexture::gobj_copy ( )

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

◆ operator=()

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

◆ release()

void Gdk::GLTexture::release ( )

Releases the GL resources held by a Gdk::GLTexture.

The texture contents are still available via the Gdk::Texture::download() function, after this function has been called.

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gdk::GLTexture > wrap ( GdkGLTexture *  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.