gtkmm  3.91.0
Public Member Functions | Related Functions | List of all members
Gtk::Snapshot Class Referencefinal

Auxiliary object for snapshots. More...

#include <gtkmm/snapshot.h>

Public Member Functions

void push (bool keep_coordinates, const Glib::ustring& name)
 Creates a new render node, appends it to the current render node of the snapshot, and makes it the new current render node. More...
 
void push_cross_fade (double progress, const Glib::ustring& name)
 Snapshots a cross-fade operation between two images with the given progress. More...
 
void pop ()
 Removes the top element from the stack of render nodes, and appends it to the node underneath it. More...
 
void offset (int x, int y)
 Appends a translation by ( x, y) to the current transformation. More...
 
void get_offset (int& x, int& y) const
 Queries the offset managed by snapshot. More...
 
::Cairo::RefPtr< ::Cairo::Contextappend_cairo (const graphene_rect_t* bounds, const Glib::ustring& name)
 Creates a new render node and appends it to the current render node of the snapshot, without changing the current node. More...
 
::Cairo::RefPtr< ::Cairo::Contextappend_cairo (const Gdk::Rectangle& bounds, const Glib::ustring& name)
 Creates a new render node and appends it to the current render node of the snapshot, without changing the current node. More...
 
bool clips_rect (const Gdk::Rectangle& bounds) const
 Tests whether the rectangle is entirely outside the clip region of snapshot. More...
 
void render_backgrount (const Glib::RefPtr< StyleContext >& context, double x, double y, double width, double height)
 Creates a render node for the CSS background according to context, and appends it to the current node of snapshot, without changing the current node. More...
 
void render_frame (const Glib::RefPtr< StyleContext >& context, double x, double y, double width, double height)
 Creates a render node for the CSS border according to context, and appends it to the current node of snapshot, without changing the current node. More...
 
void render_focus (const Glib::RefPtr< StyleContext >& context, double x, double y, double width, double height)
 Creates a render node for the focus outline according to context, and appends it to the current node of snapshot, without changing the current node. More...
 
void render_layout (const Glib::RefPtr< StyleContext >& context, double x, double y, const Glib::RefPtr< Pango::Layout >& layout)
 Creates a render node for rendering layout according to the style information in context, and appends it to the current node of snapshot, without changing the current node. More...
 
void render_insertion_cursor (const Glib::RefPtr< StyleContext >& context, double x, double y, const Glib::RefPtr< Pango::Layout >& layout, int index, Pango::Direction direction)
 Draws a text caret on cr at the specified index of layout. More...
 
void render_icon (const Glib::RefPtr< StyleContext >& context, const Glib::RefPtr< Gdk::Pixbuf >& pixbuf, double x, double y)
 Creates a render node for rendering pixbuf according to the style information in context, and appends it to the current node of snapshot, without changing the current node. More...
 
GtkSnapshot* gobj ()
 Provides access to the underlying C instance. More...
 
const GtkSnapshot* gobj () const
 Provides access to the underlying C instance. More...
 
 Snapshot ()=delete
 
 Snapshot (const Snapshot&)=delete
 
Snapshotoperator= (const Snapshot&)=delete
 

Related Functions

(Note that these are not member functions.)

Gtk::Snapshotwrap (GtkSnapshot* gobject)
 A C++ wrapper for the C object. More...
 

Detailed Description

Auxiliary object for snapshots.

Snapshot is an auxiliary object that assists in creating GskRenderNodes in the Gtk::WidgetCustomRenderer::snapshot_vfunc(). It functions in a similar way to a cairo context, and maintains a stack of render nodes and their associated transformations.

The node at the top of the stack is the the one that append_node() operates on. Use the push() and pop() functions to change the current node.

The only way to obtain a Snapshot object is as an argument to the Gtk::WidgetCustomRenderer::snapshot_vfunc().

Since gtkmm 3.90:

Constructor & Destructor Documentation

Gtk::Snapshot::Snapshot ( )
delete
Gtk::Snapshot::Snapshot ( const Snapshot )
delete

Member Function Documentation

::Cairo::RefPtr< ::Cairo::Context> Gtk::Snapshot::append_cairo ( const graphene_rect_t *  bounds,
const Glib::ustring name 
)

Creates a new render node and appends it to the current render node of the snapshot, without changing the current node.

Since gtkmm 3.90:
Parameters
boundsThe bounds for the new node.
nameThe name for the new node, or an empty string for no name.
Returns
A Cairo::Context suitable for drawing the contents of the newly created render node.
::Cairo::RefPtr< ::Cairo::Context> Gtk::Snapshot::append_cairo ( const Gdk::Rectangle bounds,
const Glib::ustring name 
)

Creates a new render node and appends it to the current render node of the snapshot, without changing the current node.

Since gtkmm 3.90:
Parameters
boundsThe bounds for the new node.
nameThe name for the new node, or an empty string for no name.
Returns
A Cairo::Context suitable for drawing the contents of the newly created render node.
bool Gtk::Snapshot::clips_rect ( const Gdk::Rectangle bounds) const

Tests whether the rectangle is entirely outside the clip region of snapshot.

Since gtkmm 3.90:
Parameters
boundsA rectangle.
Returns
true is bounds is entirely outside the clip region.
void Gtk::Snapshot::get_offset ( int &  x,
int &  y 
) const

Queries the offset managed by snapshot.

This offset is the accumulated sum of calls to offset().

Use this offset to determine how to offset nodes that you manually add to the snapshot using gtk_snapshot_append().

Note that other functions that add nodes for you, such as append_cairo() will add this offset for you.

Parameters
xReturn location for x offset.
yReturn location for y offset.
GtkSnapshot* Gtk::Snapshot::gobj ( )

Provides access to the underlying C instance.

const GtkSnapshot* Gtk::Snapshot::gobj ( ) const

Provides access to the underlying C instance.

void Gtk::Snapshot::offset ( int  x,
int  y 
)

Appends a translation by ( x, y) to the current transformation.

Since gtkmm 3.90:
Parameters
xHorizontal translation.
yVertical translation.
Snapshot& Gtk::Snapshot::operator= ( const Snapshot )
delete
void Gtk::Snapshot::pop ( )

Removes the top element from the stack of render nodes, and appends it to the node underneath it.

Since gtkmm 3.90:
void Gtk::Snapshot::push ( bool  keep_coordinates,
const Glib::ustring name 
)

Creates a new render node, appends it to the current render node of the snapshot, and makes it the new current render node.

Since gtkmm 3.90:
Parameters
keep_coordinatesIf true, the current offset and clip will be kept. Otherwise, the clip will be unset and the offset will be reset to (0, 0).
nameThe name for the new node, or an empty string for no name.
void Gtk::Snapshot::push_cross_fade ( double  progress,
const Glib::ustring name 
)

Snapshots a cross-fade operation between two images with the given progress.

Until the first call to pop(), the start image will be the snapshot. After that call, the end image will be recorded until the second call to pop().

Calling this function requires 2 calls to pop().

Since gtkmm 3.90:
Parameters
progressProgress between 0.0 and 1.0.
nameThe name of the pushed node, or an empty string for no name.
void Gtk::Snapshot::render_backgrount ( const Glib::RefPtr< StyleContext >&  context,
double  x,
double  y,
double  width,
double  height 
)

Creates a render node for the CSS background according to context, and appends it to the current node of snapshot, without changing the current node.

Since gtkmm 3.90:
Parameters
contextThe Gtk::StyleContext to use.
xX origin of the rectangle.
yY origin of the rectangle.
widthRectangle width.
heightRectangle height.
void Gtk::Snapshot::render_focus ( const Glib::RefPtr< StyleContext >&  context,
double  x,
double  y,
double  width,
double  height 
)

Creates a render node for the focus outline according to context, and appends it to the current node of snapshot, without changing the current node.

Since gtkmm 3.90:
Parameters
contextThe Gtk::StyleContext to use.
xX origin of the rectangle.
yY origin of the rectangle.
widthRectangle width.
heightRectangle height.
void Gtk::Snapshot::render_frame ( const Glib::RefPtr< StyleContext >&  context,
double  x,
double  y,
double  width,
double  height 
)

Creates a render node for the CSS border according to context, and appends it to the current node of snapshot, without changing the current node.

Since gtkmm 3.90:
Parameters
contextThe Gtk::StyleContext to use.
xX origin of the rectangle.
yY origin of the rectangle.
widthRectangle width.
heightRectangle height.
void Gtk::Snapshot::render_icon ( const Glib::RefPtr< StyleContext >&  context,
const Glib::RefPtr< Gdk::Pixbuf >&  pixbuf,
double  x,
double  y 
)

Creates a render node for rendering pixbuf according to the style information in context, and appends it to the current node of snapshot, without changing the current node.

Since gtkmm 3.90:
Parameters
contextThe Gtk::StyleContext to use.
pixbufThe Gdk::Pixbuf to render.
xX origin of the rectangle.
yY origin of the rectangle.
void Gtk::Snapshot::render_insertion_cursor ( const Glib::RefPtr< StyleContext >&  context,
double  x,
double  y,
const Glib::RefPtr< Pango::Layout > &  layout,
int  index,
Pango::Direction  direction 
)

Draws a text caret on cr at the specified index of layout.

Since gtkmm 3.90:
Parameters
contextA Gtk::StyleContext.
xX origin.
yY origin.
layoutThe Pango::Layout of the text.
indexThe index in the Pango::Layout.
directionThe Pango::Direction of the text.
void Gtk::Snapshot::render_layout ( const Glib::RefPtr< StyleContext >&  context,
double  x,
double  y,
const Glib::RefPtr< Pango::Layout > &  layout 
)

Creates a render node for rendering layout according to the style information in context, and appends it to the current node of snapshot, without changing the current node.

Since gtkmm 3.90:
Parameters
contextThe Gtk::StyleContext to use.
xX origin of the rectangle.
yY origin of the rectangle.
layoutThe Pango::Layout to render.

Friends And Related Function Documentation

Gtk::Snapshot* wrap ( GtkSnapshot *  gobject)
related

A C++ wrapper for the C object.

Parameters
gobjectThe C instance.
Returns
The C++ wrapper.
Since gtkmm 3.90: