CtkOffscreenWindow

CtkOffscreenWindow — A toplevel to manage offscreen rendering of child widgets

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── CtkWidget
            ╰── CtkContainer
                ╰── CtkBin
                    ╰── CtkWindow
                        ╰── CtkOffscreenWindow

Implemented Interfaces

CtkOffscreenWindow implements AtkImplementorIface and CtkBuildable.

Includes

#include <ctk/ctk.h>

Description

CtkOffscreenWindow is strictly intended to be used for obtaining snapshots of widgets that are not part of a normal widget hierarchy. Since CtkOffscreenWindow 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 CtkOffscreenWindow and then retrieve the snapshot as a cairo_surface_t or GdkPixbuf.

CtkOffscreenWindow derives from CtkWindow only as an implementation detail. Applications should not use any API specific to CtkWindow to operate on this object. It should be treated as a CtkBin that has no parent widget.

When contained offscreen widgets are redrawn, CtkOffscreenWindow will emit a “damage-event” signal.

Functions

ctk_offscreen_window_new ()

CtkWidget *
ctk_offscreen_window_new (void);

Creates a toplevel container widget that is used to retrieve snapshots of widgets without showing them on the screen.

Returns

A pointer to a CtkWidget

Since: 2.20


ctk_offscreen_window_get_surface ()

cairo_surface_t *
ctk_offscreen_window_get_surface (CtkOffscreenWindow *offscreen);

Retrieves a snapshot of the contained widget in the form of a cairo_surface_t. If you need to keep this around over window resizes then you should add a reference to it.

Parameters

offscreen

the CtkOffscreenWindow contained widget.

 

Returns

A cairo_surface_t pointer to the offscreen surface, or NULL.

[nullable][transfer none]

Since: 2.20


ctk_offscreen_window_get_pixbuf ()

GdkPixbuf *
ctk_offscreen_window_get_pixbuf (CtkOffscreenWindow *offscreen);

Retrieves a snapshot of the contained widget in the form of a GdkPixbuf. This is a new pixbuf with a reference count of 1, and the application should unreference it once it is no longer needed.

Parameters

offscreen

the CtkOffscreenWindow contained widget.

 

Returns

A GdkPixbuf pointer, or NULL.

[nullable][transfer full]

Since: 2.20

Types and Values

struct CtkOffscreenWindow

struct CtkOffscreenWindow;

struct CtkOffscreenWindowClass

struct CtkOffscreenWindowClass {
  CtkWindowClass parent_class;
};

Members