| AppStream-glib Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include <appstream-glib.h> enum AsImageKind; enum AsImageSaveFlags; enum AsImageAlphaFlags; #define AS_IMAGE_LARGE_HEIGHT #define AS_IMAGE_LARGE_WIDTH #define AS_IMAGE_NORMAL_HEIGHT #define AS_IMAGE_NORMAL_WIDTH #define AS_IMAGE_THUMBNAIL_HEIGHT #define AS_IMAGE_THUMBNAIL_WIDTH AsImage * as_image_new (void); AsImageKind as_image_kind_from_string (const gchar *kind); const gchar * as_image_kind_to_string (AsImageKind kind); const gchar * as_image_get_url (AsImage *image); const gchar * as_image_get_md5 (AsImage *image); const gchar * as_image_get_basename (AsImage *image); guint as_image_get_width (AsImage *image); guint as_image_get_height (AsImage *image); AsImageKind as_image_get_kind (AsImage *image); GdkPixbuf * as_image_get_pixbuf (AsImage *image); void as_image_set_url (AsImage *image,const gchar *url,gssize url_len); void as_image_set_basename (AsImage *image,const gchar *basename); void as_image_set_width (AsImage *image,guint width); void as_image_set_height (AsImage *image,guint height); void as_image_set_kind (AsImage *image,AsImageKind kind); void as_image_set_pixbuf (AsImage *image,GdkPixbuf *pixbuf); AsImageAlphaFlags as_image_get_alpha_flags (AsImage *image); gboolean as_image_load_filename (AsImage *image,const gchar *filename,GError **error); GdkPixbuf * as_image_save_pixbuf (AsImage *image,guint width,guint height,AsImageSaveFlags flags); gboolean as_image_save_filename (AsImage *image,const gchar *filename,guint width,guint height,AsImageSaveFlags flags,GError **error);
Screenshot may have multiple versions of an image in different resolutions or aspect ratios. This object allows access to the location and size of a single image.
See also: AsScreenshot
typedef enum {
AS_IMAGE_KIND_UNKNOWN,
AS_IMAGE_KIND_SOURCE,
AS_IMAGE_KIND_THUMBNAIL,
} AsImageKind;
The image type.
typedef enum {
AS_IMAGE_SAVE_FLAG_NONE = 0, /* Since: 0.1.6 */
AS_IMAGE_SAVE_FLAG_PAD_16_9 = 1, /* Since: 0.1.6 */
AS_IMAGE_SAVE_FLAG_SHARPEN = 2, /* Since: 0.3.2 */
AS_IMAGE_SAVE_FLAG_BLUR = 4, /* Since: 0.3.2 */
} AsImageSaveFlags;
The flags used for saving images.
typedef enum {
AS_IMAGE_ALPHA_FLAG_NONE = 0, /* Since: 0.2.2 */
AS_IMAGE_ALPHA_FLAG_TOP = 1, /* Since: 0.2.2 */
AS_IMAGE_ALPHA_FLAG_BOTTOM = 2, /* Since: 0.2.2 */
AS_IMAGE_ALPHA_FLAG_LEFT = 4, /* Since: 0.2.2 */
AS_IMAGE_ALPHA_FLAG_RIGHT = 8, /* Since: 0.2.2 */
AS_IMAGE_ALPHA_FLAG_INTERNAL = 16, /* Since: 0.2.2 */
} AsImageAlphaFlags;
The flags used for reporting the alpha cutouts in the image.
| No padding detected | |
| Padding detected at the image top | |
| Padding detected at the image bottom | |
| Padding detected at the image left side | |
| Padding detected at the image right side | |
| Internal alpha cut out areas detected |
AsImage * as_image_new (void);
Creates a new AsImage.
Returns : |
a AsImage. [transfer full] |
Since 0.1.0
AsImageKind as_image_kind_from_string (const gchar *kind);
Converts the text representation to an enumerated value.
|
the string. |
Returns : |
a AsImageKind, or AS_IMAGE_KIND_UNKNOWN for unknown. [transfer full]
|
Since 0.1.0
const gchar * as_image_kind_to_string (AsImageKind kind);
Converts the enumerated value to an text representation.
|
the AsImageKind. |
Returns : |
string version of kind
|
Since 0.1.0
const gchar * as_image_get_url (AsImage *image);
Gets the full qualified URL for the image, usually pointing at some mirror.
|
a AsImage instance. |
Returns : |
URL |
Since 0.1.0
const gchar * as_image_get_md5 (AsImage *image);
Gets the string representation of the pixbuf hash value.
|
a AsImage instance. |
Returns : |
string representing the MD5 sum, or NULL if unset |
Since 0.1.6
const gchar * as_image_get_basename (AsImage *image);
Gets the suggested basename the image, including file extension.
|
a AsImage instance. |
Returns : |
filename |
Since 0.1.6
guint as_image_get_width (AsImage *image);
Gets the image width.
|
a AsImage instance. |
Returns : |
width in pixels |
Since 0.1.0
guint as_image_get_height (AsImage *image);
Gets the image height.
|
a AsImage instance. |
Returns : |
height in pixels |
Since 0.1.0
AsImageKind as_image_get_kind (AsImage *image);
Gets the image kind.
|
a AsImage instance. |
Returns : |
the AsImageKind |
Since 0.1.0
GdkPixbuf * as_image_get_pixbuf (AsImage *image);
Gets the image pixbuf if set.
|
a AsImage instance. |
Returns : |
the GdkPixbuf, or NULL. [transfer none]
|
Since 0.1.6
void as_image_set_url (AsImage *image,const gchar *url,gssize url_len);
Sets the fully-qualified mirror URL to use for the image.
|
a AsImage instance. |
|
the URL. |
|
the size of url, or -1 if NULL-terminated. |
Since 0.1.0
void as_image_set_basename (AsImage *image,const gchar *basename);
Sets the image basename filename.
|
a AsImage instance. |
|
the new filename basename. |
Since 0.1.6
void as_image_set_width (AsImage *image,guint width);
Sets the image width.
|
a AsImage instance. |
|
the width in pixels. |
Since 0.1.0
void as_image_set_height (AsImage *image,guint height);
Sets the image height.
|
a AsImage instance. |
|
the height in pixels. |
Since 0.1.0
void as_image_set_kind (AsImage *image,AsImageKind kind);
Sets the image kind.
|
a AsImage instance. |
|
the AsImageKind, e.g. AS_IMAGE_KIND_THUMBNAIL. |
Since 0.1.0
void as_image_set_pixbuf (AsImage *image,GdkPixbuf *pixbuf);
Sets the image pixbuf.
|
a AsImage instance. |
|
the GdkPixbuf, or NULL
|
Since 0.1.6
AsImageAlphaFlags as_image_get_alpha_flags (AsImage *image);
Gets the alpha flags for the image. The following image would have all flags set, where 'x' is alpha and '@' is non-alpha.
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
xx@@@@@@@@@@@@@@@@@@@@@@@xx
xx@@@@@@xxxxxx@@@@@@@@@@xx
xx@@@@@@xxxxxx@@@@@@@@@@xx
xx@@@@@@@@@@@@@@@@@@@@@@@xx
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
a AsImage instance. |
Returns : |
AsImageAlphaFlags, e.g. AS_IMAGE_ALPHA_FLAG_LEFT
|
Since 0.2.2
gboolean as_image_load_filename (AsImage *image,const gchar *filename,GError **error);
Reads a pixbuf from a file.
NOTE: This function also sets the suggested filename which can be retrieved
using as_image_get_basename(). This can be overridden if required.
|
a AsImage instance. |
|
filename to read from |
|
A GError or NULL. |
Returns : |
TRUE for success |
Since 0.1.6
GdkPixbuf * as_image_save_pixbuf (AsImage *image,guint width,guint height,AsImageSaveFlags flags);
Resamples a pixbuf to a specific size.
|
a AsImage instance. |
|
target width, or 0 for default |
|
target height, or 0 for default |
|
some AsImageSaveFlags values, e.g. AS_IMAGE_SAVE_FLAG_PAD_16_9
|
Returns : |
A GdkPixbuf of the specified size. [transfer full] |
Since 0.1.6
gboolean as_image_save_filename (AsImage *image,const gchar *filename,guint width,guint height,AsImageSaveFlags flags,GError **error);
Saves a pixbuf to a file.
|
a AsImage instance. |
|
filename to write to |
|
target width, or 0 for default |
|
target height, or 0 for default |
|
some AsImageSaveFlags values, e.g. AS_IMAGE_SAVE_FLAG_PAD_16_9
|
|
A GError or NULL. |
Returns : |
TRUE for success |
Since 0.1.6