AppStream-glib Reference Manual: AsScreenshot

## AsScreenshot AsScreenshot — Object representing a single screenshot |

## Stability Level

Stable, unless otherwise indicated

## Functions

AsScreenshot * | as_screenshot_new ()
AsScreenshotKind | as_screenshot_kind_from_string ()
const gchar * | as_screenshot_kind_to_string ()
AsScreenshotKind | as_screenshot_get_kind ()
const gchar * | as_screenshot_get_caption ()
GPtrArray * | as_screenshot_get_images ()
AsImage * | as_screenshot_get_image ()
AsImage * | as_screenshot_get_source ()
void | as_screenshot_set_kind ()
void | as_screenshot_set_caption ()
void | as_screenshot_add_image ()

## Types and Values

enum | AsScreenshotKind

## Object Hierarchy

        GObject
        ╰── AsScreenshot

## Includes

    #include <appstream-glib.h>

## Description

Screenshots have a localized caption and also contain a number of images of different resolution.

See also: AsImage

## Functions

### as_screenshot_new ()

    AsScreenshot *
    as_screenshot_new (void);

Creates a new AsScreenshot.

#### Returns

a AsScreenshot.

[transfer full]

Since 0.1.0

### as_screenshot_kind_from_string ()

    AsScreenshotKind
    as_screenshot_kind_from_string (const gchar *kind);

Converts the text representation to an enumerated value.

#### Parameters

kind | the string. |

#### Returns

a `AsScreenshotKind`, or `AS_SCREENSHOT_KIND_UNKNOWN` if not known.

[transfer full]

Since 0.1.0

### as_screenshot_kind_to_string ()

    const gchar *
    as_screenshot_kind_to_string (AsScreenshotKind kind);

Converts the enumerated value to an text representation.

#### Parameters

kind | the AsScreenshotKind. |

#### Returns

string version of `kind`

Since 0.1.0

### as_screenshot_get_kind ()

    AsScreenshotKind
    as_screenshot_get_kind (AsScreenshot *screenshot);

Gets the screenshot kind.

#### Parameters

screenshot | a AsScreenshot instance. |

#### Returns

a AsScreenshotKind

Since 0.1.0

### as_screenshot_get_caption ()

    const gchar *
    as_screenshot_get_caption (AsScreenshot *screenshot,
                               const gchar *locale);

Gets the image caption for a specific locale.

#### Parameters

screenshot | a AsScreenshot instance. |
locale | the locale, or `NULL`. e.g. "en_GB" |

#### Returns

the caption

Since 0.1.0

### as_screenshot_get_images ()

    GPtrArray *
    as_screenshot_get_images (AsScreenshot *screenshot);

Gets the image sizes included in the screenshot.

#### Parameters

screenshot | a AsScreenshot instance. |

#### Returns

an array.

[element-type AsImage][transfer none]

Since 0.1.0

### as_screenshot_get_image ()

    AsImage *
    as_screenshot_get_image (AsScreenshot *screenshot,
                             guint width,
                             guint height);

Gets the AsImage closest to the target size. The AsImage may not actually be the requested size, and the application may have to pad / rescale the image to make it fit.

#### Parameters

screenshot | a AsScreenshot instance. |
width | target width |
height | target height |

#### Returns

an AsImage, or `NULL`.

[transfer none]

Since 0.2.2

### as_screenshot_get_source ()

    AsImage *
    as_screenshot_get_source (AsScreenshot *screenshot);

Gets the source image (the unscaled version) for the screenshot

#### Parameters

screenshot | a AsScreenshot instance. |

#### Returns

an AsImage, or `NULL`.

[transfer none]

Since 0.1.6

### as_screenshot_set_kind ()

    void
    as_screenshot_set_kind (AsScreenshot *screenshot,
                            AsScreenshotKind kind);

Sets the screenshot kind.

#### Parameters

screenshot | a AsScreenshot instance. |
kind | the AsScreenshotKind. |

Since 0.1.0

### as_screenshot_set_caption ()

    void
    as_screenshot_set_caption (AsScreenshot *screenshot,
                               const gchar *locale,
                               const gchar *caption,
                               gsize caption_len);

Sets a caption on the screenshot for a specific locale.

#### Parameters

screenshot | a AsScreenshot instance. |
locale | the locale, or `NULL`. e.g. "en_GB" |
caption | the caption text. |
caption_len | the size of `caption` , or -1 if `NULL`-terminated. |

Since 0.1.0

### as_screenshot_add_image ()

    void
    as_screenshot_add_image (AsScreenshot *screenshot,
                             AsImage *image);

Adds an image to the screenshot.

#### Parameters

screenshot | a AsScreenshot instance. |
image | a AsImage instance. |

Since 0.1.0

## Types and Values

### enum AsScreenshotKind

The screenshot type.

#### Members

AS_SCREENSHOT_KIND_UNKNOWN | Type invalid or not known |
AS_SCREENSHOT_KIND_NORMAL | Optional screenshot |
AS_SCREENSHOT_KIND_DEFAULT | Screenshot to show by default |