Screenshot: libportal Reference Manual

## Screenshot Screenshot — take a screenshot |

## Functions

void | xdp_portal_take_screenshot ()
char * | xdp_portal_take_screenshot_finish ()
void | xdp_portal_pick_color ()
GVariant * | xdp_portal_pick_color_finish ()

## Description

These functions let the application take a screenshot or pick a color.

The underlying portal is org.freedesktop.portal.Screenshot.

## Functions

### xdp_portal_take_screenshot ()

    void
    xdp_portal_take_screenshot (XdpPortal *portal,
                                XdpParent *parent,
                                gboolean modal,
                                gboolean interactive,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer data);

Takes a screenshot.

When the request is done, `callback` will be called. You can then call `xdp_portal_take_screenshot_finish()` to get the results.

#### Parameters

portal | a XdpPortal |
parent | parent window information. | [nullable]
modal | whether to presend a modal dialog |
interactive | whether the dialog should offer options |
cancellable | optional GCancellable. | [nullable]
callback | a callback to call when the request is done. | [scope async]
data | data to pass to `callback` . | [closure]

### xdp_portal_take_screenshot_finish ()

    char *
    xdp_portal_take_screenshot_finish (XdpPortal *portal,
                                       GAsyncResult *result,
                                       GError **error);

Finishes a screenshot request, and returns the result in the form of a URI pointing to an image file.

#### Parameters

portal | a XdpPortal |
result | a GAsyncResult |
error | return location for an error |

#### Returns

URI pointing to an image file.

[transfer full][nullable]

### xdp_portal_pick_color ()

    void
    xdp_portal_pick_color (XdpPortal *portal,
                           XdpParent *parent,
                           GCancellable *cancellable,
                           GAsyncReadyCallback callback,
                           gpointer data);

Lets the user pick a color from the screen.

When the request is done, `callback` will be called. You can then call `xdp_portal_pick_color_finish()` to get the results.

#### Parameters

portal | a XdpPortal |
parent | parent window information. | [nullable]
cancellable | optional GCancellable. | [nullable]
callback | a callback to call when the request is done. | [scope async]
data | data to pass to `callback` . | [closure]

### xdp_portal_pick_color_finish ()

    GVariant *
    xdp_portal_pick_color_finish (XdpPortal *portal,
                                  GAsyncResult *result,
                                  GError **error);

Finishes a pick-color request, and returns the result in the form of a GVariant of the form (ddd), containing red, green and blue components in the range [0,1].

#### Parameters

portal | a XdpPortal |
result | a GAsyncResult |
error | return location for an error |

#### Returns

GVariant containing the color.

[transfer full]

## Types and Values