gtkmm: Gtk::Snapshot Class Reference

gtkmm 3.91.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

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::Context > | 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. More...
::Cairo::RefPtr< ::Cairo::Context > | 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. 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
Snapshot& | operator= (const Snapshot&)=delete

## Related Functions
(Note that these are not member functions.)
Gtk::Snapshot* | wrap (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::WidgetCustomSnapshot::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 Gtk::WidgetCustomSnapshot::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

  bounds | The bounds for the new node.
  name | The 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

  bounds | The bounds for the new node.
  name | The 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

  bounds | A 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

  x | Return location for x offset.
  y | Return 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

  x | Horizontal translation.
  y | Vertical 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_coordinates | If `true`, the current offset and clip will be kept. Otherwise, the clip will be unset and the offset will be reset to (0, 0).
  name | The 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

  progress | Progress between 0.0 and 1.0.
  name | The 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

  context | The Gtk::StyleContext to use.
  x | X origin of the rectangle.
  y | Y origin of the rectangle.
  width | Rectangle width.
  height | Rectangle 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

  context | The Gtk::StyleContext to use.
  x | X origin of the rectangle.
  y | Y origin of the rectangle.
  width | Rectangle width.
  height | Rectangle 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

  context | The Gtk::StyleContext to use.
  x | X origin of the rectangle.
  y | Y origin of the rectangle.
  width | Rectangle width.
  height | Rectangle 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

  context | The Gtk::StyleContext to use.
  pixbuf | The Gdk::Pixbuf to render.
  x | X origin of the rectangle.
  y | Y 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

  context | A Gtk::StyleContext.
  x | X origin.
  y | Y origin.
  layout | The Pango::Layout of the text.
  index | The index in the Pango::Layout.
  direction | The 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

  context | The Gtk::StyleContext to use.
  x | X origin of the rectangle.
  y | Y origin of the rectangle.
  layout | The Pango::Layout to render.

## Friends And Related Function Documentation

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

A C++ wrapper for the C object.

Parameters

  gobject | The C instance.

Returns
  The C++ wrapper.

Since gtkmm 3.90: