Class

PurpleImage

Description [src]

class Purple.Image : GObject.Object {
  parent_instance: GObject
}

PurpleImage object is a container for raw image data. It doesn’t manipulate image data, just stores it in its binary format - png, jpeg etc. Thus, it’s totally independent from the UI.

This class also provides certain file-related features, like: friendly filenames (not necessarily real filename for displaying); remote images (which data is not yet loaded) or guessing file format from its header.

Ancestors

Constructors

purple_image_new_from_bytes

Loads a raw image data as a new PurpleImage object.

purple_image_new_from_data

Creates a new PurpleImage object with contents of data buffer.

purple_image_new_from_file

Loads an image file as a new PurpleImage object. The path must exists, be readable and should point to a valid image file. If you don’t set be_eager parameter, there will be a risk that file will be removed from disk before you access its data.

purple_image_new_take_data

Creates a new PurpleImage object with contents of data buffer.

Functions

purple_image_store_get

Finds the image with a certain identifier within a store.

purple_image_store_get_from_uri

Checks, if the uri is pointing to any PurpleImage by referring to #PURPLE_IMAGE_STORE_PROTOCOL and returns the image, if it’s valid.

Instance methods

purple_image_generate_filename

Calculates almost-unique filename by computing checksum from file contents and appending a suitable extension. You should not assume the checksum is SHA-1, because it may change in the future.

purple_image_get_contents

Returns a new reference to the GBytes that contains the image data.

purple_image_get_data

Returns the pointer to the buffer containing image data.

purple_image_get_data_size

Returns the size of images data.

purple_image_get_extension

Guesses the image format based on its contents.

purple_image_get_friendly_filename

Returns the “friendly filename” for the image, to be displayed or used as a default name when saving a file to the disk. See #purple_image_set_friendly_filename.

purple_image_get_mimetype

Guesses the image mime-type based on its contents.

purple_image_get_path

Returns the physical path of the image file. It is set only, if the image is really backed by an existing file. In the other case it returns NULL.

purple_image_save

Saves an image to the disk.

purple_image_set_friendly_filename

Sets the “friendly filename” for the image. This don’t have to be a real name, because it’s used for displaying or as a default file name when the user wants to save the image to the disk.

purple_image_store_add

Permanently adds an image to the store. If the image is already in the store, it will return its current id.

purple_image_store_add_temporary

Adds an image to the store to be used in a short period of time. If the image is already in the store, it will just return its current id.

purple_image_store_add_weak

Adds an image to the store without increasing reference count. It will be removed from the store when image gets destroyed.

purple_image_store_get_uri

Generates an URI for the image, to be retrieved using

purple_image_store_get_from_uri.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Purple.Image:contents
No description available.
Purple.Image:path
No description available.
Purple.Image:size
No description available.

Signals

Signals inherited from GObject (1)
GObject.Object::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct PurpleImageClass {
  void (* purple_reserved1) (
void
  );
  void (* purple_reserved2) (
void
  );
  void (* purple_reserved3) (
void
  );
  void (* purple_reserved4) (
void
  );
  
}
Class members
purple_reserved1
void (* purple_reserved1) (
void
  )
  No description available.
purple_reserved2
void (* purple_reserved2) (
void
  )
  No description available.
purple_reserved3
void (* purple_reserved3) (
void
  )
  No description available.
purple_reserved4
void (* purple_reserved4) (
void
  )
  No description available.