Gtk.OffscreenWindow
Gtk.OffscreenWindow — A toplevel to manage offscreen rendering of child widgets
Object Hierarchy:
GObject
╰── GInitiallyUnowned
╰── Gtk.Widget
╰── Gtk.Container
╰── Gtk.Bin
╰── Gtk.Window
╰── Gtk.OffscreenWindow
Functions:
- new
() -> Gtk.Widget - get_surface
(self) -> cairo.Surface - get_pixbuf
(self) -> GdkPixbuf.Pixbuf
Description:
Gtk.OffscreenWindow is strictly intended to be used for obtaining snapshots of widgets that are not part of a normal widget hierarchy.
Since Gtk.OffscreenWindow is a toplevel widget you cannot obtain snapshots of a full window with it since you cannot pack a toplevel widget in another toplevel.
The idea is to take a widget and manually set the state of it, add it to a Gtk.OffscreenWindow and then retrieve the snapshot as a #cairo_surface_t or Gdk.Pixbuf.
Gtk.OffscreenWindow derives from GtkWindow only as an implementation detail. Applications should not use any API specific to Gtk.Window to operate on this object. It should be treated as a Gtk.Bin that has no parent widget.
When contained offscreen widgets are redrawn, Gtk.OffscreenWindow will emit a Gtk.Widget::“damage-event“ signal.
Function Details:
new()
new () -> Gtk.Widget
Creates a toplevel container widget that is used to retrievesnapshots of widgets without showing them on the screen.
Returns: A pointer to a Gtk.Widget
Since: 2.20
get_surface()
get_surface (self) -> cairo.Surface
Retrieves a snapshot of the contained widget in the form ofa cairo_surface_t. If you need to keep this around over windowresizes then you should add a reference to it.
Returns: A cairo_surface_t pointer to the offscreensurface, or
None.Since: 2.20
get_pixbuf()
get_pixbuf (self) -> GdkPixbuf.Pixbuf
Retrieves a snapshot of the contained widget in the form ofa GdkPixbuf. This is a new pixbuf with a reference count of 1,and the application should unreference it once it is no longerneeded.
Returns: A GdkPixbuf pointer, or
None.Since: 2.20