AppStreamCompose.Image¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class AppStreamCompose.Image(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new()¶
- Return type:
Creates a new
AppStreamCompose.Image.
- classmethod new_from_data(data, len, dest_size, compressed, flags)¶
- Parameters:
len (
int) – Length of the data to load.dest_size (
int) – The size of the constructed pixbuf, or 0 for the native sizeflags (
AppStreamCompose.ImageLoadFlags) – aAppStreamCompose.ImageLoadFlags, e.g.AppStreamCompose.ImageLoadFlags.NONE
- Raises:
- Return type:
Creates a new
AppStreamCompose.Imagefrom data in memory.
- classmethod new_from_file(fname, dest_size, flags)¶
- Parameters:
fname (
str) – Name of the file to load.dest_size (
int) – The size of the constructed pixbuf, or 0 for the native sizeflags (
AppStreamCompose.ImageLoadFlags) – aAppStreamCompose.ImageLoadFlags, e.g.AppStreamCompose.ImageLoadFlags.NONE
- Raises:
- Return type:
Creates a new
AppStreamCompose.Imagefrom a file on the filesystem.
- classmethod supported_format_names()¶
-
Get a set of image format names we can currently read (via
GdkPixbuf.Pixbuf).
- get_pixbuf()¶
- Returns:
the
GdkPixbuf.Pixbuf, orNone- Return type:
Gets the image pixbuf if set.
- load_filename(filename, dest_size, src_size_min, flags)¶
- Parameters:
filename (
str) – filename to read fromdest_size (
int) – The size of the constructed pixbuf, or 0 for the native sizesrc_size_min (
int) – The smallest source size allowed, or 0 for noneflags (
AppStreamCompose.ImageLoadFlags) – aAppStreamCompose.ImageLoadFlags, e.g.AppStreamCompose.ImageLoadFlags.NONE
- Raises:
- Returns:
Truefor success- Return type:
Reads an image from a file.
- save_filename(filename, width, height, flags)¶
- Parameters:
filename (
str) – filename to write towidth (
int) – target width, or 0 for defaultheight (
int) – target height, or 0 for defaultflags (
AppStreamCompose.ImageSaveFlags) – someAppStreamCompose.ImageSaveFlagsvalues, e.g.AppStreamCompose.ImageSaveFlags.PAD_16_9
- Raises:
- Returns:
Truefor success- Return type:
Saves the image to a file.
- save_pixbuf(width, height, flags)¶
- Parameters:
width (
int) – target width, or 0 for defaultheight (
int) – target height, or 0 for defaultflags (
AppStreamCompose.ImageSaveFlags) – someAppStreamCompose.ImageSaveFlagsvalues, e.g.AppStreamCompose.ImageSaveFlags.PAD_16_9
- Returns:
A
GdkPixbuf.Pixbufof the specified size- Return type:
Resamples a pixbuf to a specific size.
- scale(new_width, new_height)¶
-
Scale the image to the given size.
- scale_to_fit(size)¶
- Parameters:
size (
int) – the maximum edge length.
Scale the image to fir in a square with the given edge length, and keep its aspect ratio.
- scale_to_height(new_height)¶
- Parameters:
new_height (
int) – the new height.
Scale the image to the given height, preserving its aspect ratio.
- scale_to_width(new_width)¶
- Parameters:
new_width (
int) – The new width.
Scale the image to the given width, preserving its aspect ratio.
- set_pixbuf(pixbuf)¶
- Parameters:
pixbuf (
GdkPixbuf.Pixbuf) – theGdkPixbuf.Pixbuf, orNone
Sets the image pixbuf.