Synopsis#include <gdk-pixbuf/gdk-pixbuf.h> gboolean gdk_pixbuf_set_option (GdkPixbuf *pixbuf, const gchar *key, const gchar *value); GSList* gdk_pixbuf_get_formats (void); gchar* gdk_pixbuf_format_get_name (GdkPixbufFormat *format); gchar* gdk_pixbuf_format_get_description (GdkPixbufFormat *format); gchar** gdk_pixbuf_format_get_mime_types (GdkPixbufFormat *format); gchar** gdk_pixbuf_format_get_extensions (GdkPixbufFormat *format); gboolean gdk_pixbuf_format_is_writable (GdkPixbufFormat *format); gboolean gdk_pixbuf_format_is_scalable (GdkPixbufFormat *format); gboolean gdk_pixbuf_format_is_disabled (GdkPixbufFormat *format); void gdk_pixbuf_format_set_disabled (GdkPixbufFormat *format, gboolean disabled); gchar* gdk_pixbuf_format_get_license (GdkPixbufFormat *format); GdkPixbufFormat; enum GdkPixbufFormatFlags; GdkPixbufModulePattern; void (*GdkPixbufModuleFillVtableFunc) (GdkPixbufModule *module); void (*GdkPixbufModuleFillInfoFunc) (GdkPixbufFormat *info); void (*GdkPixbufModuleSizeFunc) (gint *width, gint *height, gpointer user_data); void (*GdkPixbufModulePreparedFunc) (GdkPixbuf *pixbuf, GdkPixbufAnimation *anim, gpointer user_data); void (*GdkPixbufModuleUpdatedFunc) (GdkPixbuf *pixbuf, int x, int y, int width, int height, gpointer user_data); GdkPixbufModule; GdkPixbufAnimationClass; GdkPixbufAnimationIterClass; Description
If gdk-pixbuf has been compiled with GModule support, it can be extended by
modules which can load (and perhaps also save) new image and animation
formats. Each loadable module must export a
GdkPixbufModuleFillInfoFunc function named
In order to make format-checking work before actually loading the modules
(which may require dlopening image libraries), modules export their
signatures (and other information) via the
Modules may only implement a subset of the functionality available via
GdkPixbufModule. If a particular functionality is not implemented, the
Installing a module is a two-step process:
The gdk-pixbuf interfaces needed for implementing modules are contained in
Detailsgdk_pixbuf_set_option ()gboolean gdk_pixbuf_set_option (GdkPixbuf *pixbuf, const gchar *key, const gchar *value);
Attaches a key/value pair as an option to a GdkPixbuf. If
Since 2.2 gdk_pixbuf_get_formats ()GSList* gdk_pixbuf_get_formats (void); Obtains the available information about the image formats supported by GdkPixbuf.
Since 2.2 gdk_pixbuf_format_get_name ()gchar* gdk_pixbuf_format_get_name (GdkPixbufFormat *format); Returns the name of the format.
Since 2.2 gdk_pixbuf_format_get_description ()gchar* gdk_pixbuf_format_get_description (GdkPixbufFormat *format); Returns a description of the format.
Since 2.2 gdk_pixbuf_format_get_mime_types ()gchar** gdk_pixbuf_format_get_mime_types (GdkPixbufFormat *format); Returns the mime types supported by the format.
Since 2.2 gdk_pixbuf_format_get_extensions ()gchar** gdk_pixbuf_format_get_extensions (GdkPixbufFormat *format); Returns the filename extensions typically used for files in the given format.
Since 2.2 gdk_pixbuf_format_is_writable ()gboolean gdk_pixbuf_format_is_writable (GdkPixbufFormat *format); Returns whether pixbufs can be saved in the given format.
Since 2.2 gdk_pixbuf_format_is_scalable ()gboolean gdk_pixbuf_format_is_scalable (GdkPixbufFormat *format); Returns whether this image format is scalable. If a file is in a scalable format, it is preferable to load it at the desired size, rather than loading it at the default size and scaling the resulting pixbuf to the desired size.
Since 2.6 gdk_pixbuf_format_is_disabled ()gboolean gdk_pixbuf_format_is_disabled (GdkPixbufFormat *format);
Returns whether this image format is disabled. See
Since 2.6 gdk_pixbuf_format_set_disabled ()void gdk_pixbuf_format_set_disabled (GdkPixbufFormat *format, gboolean disabled);
Disables or enables an image format. If a format is disabled,
gdk-pixbuf won't use the image loader for this format to load
images. Applications can use this to avoid using image loaders
with an inappropriate license, see
Since 2.6 gdk_pixbuf_format_get_license ()gchar* gdk_pixbuf_format_get_license (GdkPixbufFormat *format);
Returns information about the license of the image loader for the format. The
returned string should be a shorthand for a wellknown license, e.g. "LGPL",
"GPL", "QPL", "GPL/QPL", or "other" to indicate some other license. This
string should be freed with
Since 2.6 GdkPixbufFormattypedef struct { gchar *name; GdkPixbufModulePattern *signature; gchar *domain; gchar *description; gchar **mime_types; gchar **extensions; guint32 flags; gboolean disabled; gchar *license; } GdkPixbufFormat;
A GdkPixbufFormat contains information about the image format accepted by a
module. Only modules should access the fields directly, applications should
use the
Since 2.2 enum GdkPixbufFormatFlagstypedef enum /*< skip >*/ { GDK_PIXBUF_FORMAT_WRITABLE = 1 << 0, GDK_PIXBUF_FORMAT_SCALABLE = 1 << 1, GDK_PIXBUF_FORMAT_THREADSAFE = 1 << 2 } GdkPixbufFormatFlags; Flags which allow a module to specify further details about the supported operations. Since 2.2 GdkPixbufModulePatterntypedef struct { char *prefix; char *mask; int relevance; } GdkPixbufModulePattern;
The signature of a module is a set of prefixes. Prefixes are encoded as
pairs of ordinary strings, where the second string, called the mask, if
not Starting with gdk-pixbuf 2.8, the first byte of the mask may be '*', indicating an unanchored pattern that matches not only at the beginning, but also in the middle. Versions prior to 2.8 will interpret the '*' like an 'x'.
The signature of a module is stored as an array of
GdkPixbufModulePatterns. The array is terminated by a pattern
where the GdkPixbufModulePattern *signature[] = { { "abcdx", " !x z", 100 }, { "bla", NULL, 90 }, { NULL, NULL, 0 } };The example matches e.g. "auud\0" with relevance 100, and "blau" with relevance 90.
Since 2.2 GdkPixbufModuleFillVtableFunc ()void (*GdkPixbufModuleFillVtableFunc) (GdkPixbufModule *module); Defines the type of the function used to set the vtable of a GdkPixbufModule when it is loaded.
Since 2.2 GdkPixbufModuleFillInfoFunc ()void (*GdkPixbufModuleFillInfoFunc) (GdkPixbufFormat *info); Defines the type of the function used to fill a GdkPixbufFormat structure with information about a module.
Since 2.2 GdkPixbufModuleSizeFunc ()void (*GdkPixbufModuleSizeFunc) (gint *width, gint *height, gpointer user_data); Defines the type of the function that gets called once the size of the loaded image is known.
The function is expected to set
If the function sets
Since 2.2 GdkPixbufModulePreparedFunc ()void (*GdkPixbufModulePreparedFunc) (GdkPixbuf *pixbuf, GdkPixbufAnimation *anim, gpointer user_data);
Defines the type of the function that gets called once the initial
setup of GdkPixbufLoader uses a function of this type to emit the "area_prepared" signal.
Since 2.2 GdkPixbufModuleUpdatedFunc ()void (*GdkPixbufModuleUpdatedFunc) (GdkPixbuf *pixbuf, int x, int y, int width, int height, gpointer user_data);
Defines the type of the function that gets called every time a region
of GdkPixbufLoader uses a function of this type to emit the "area_updated" signal.
Since 2.2 GdkPixbufModuletypedef struct { char *module_name; char *module_path; GModule *module; GdkPixbufFormat *info; GdkPixbuf *(* load) (FILE *f, GError **error); GdkPixbuf *(* load_xpm_data) (const char **data); /* Incremental loading */ gpointer (* begin_load) (GdkPixbufModuleSizeFunc size_func, GdkPixbufModulePreparedFunc prepare_func, GdkPixbufModuleUpdatedFunc update_func, gpointer user_data, GError **error); gboolean (* stop_load) (gpointer context, GError **error); gboolean (* load_increment) (gpointer context, const guchar *buf, guint size, GError **error); /* Animation loading */ GdkPixbufAnimation *(* load_animation) (FILE *f, GError **error); /* Saving */ gboolean (* save) (FILE *f, GdkPixbuf *pixbuf, gchar **param_keys, gchar **param_values, GError **error); gboolean (*save_to_callback) (GdkPixbufSaveFunc save_func, gpointer user_data, GdkPixbuf *pixbuf, gchar **option_keys, gchar **option_values, GError **error); } GdkPixbufModule; A GdkPixbufModule contains the necessary functions to load and save images in a certain file format.
A GdkPixbufModule can be loaded dynamically from a GModule.
Each loadable module must contain a GdkPixbufModuleFillVtableFunc function
named
GdkPixbufAnimationClasstypedef struct { GObjectClass parent_class; gboolean (*is_static_image) (GdkPixbufAnimation *anim); GdkPixbuf* (*get_static_image) (GdkPixbufAnimation *anim); void (*get_size) (GdkPixbufAnimation *anim, int *width, int *height); GdkPixbufAnimationIter* (*get_iter) (GdkPixbufAnimation *anim, const GTimeVal *start_time); } GdkPixbufAnimationClass; Modules supporting animations must derive a type from GdkPixbufAnimation, providing suitable implementations of the virtual functions.
GdkPixbufAnimationIterClasstypedef struct { GObjectClass parent_class; int (*get_delay_time) (GdkPixbufAnimationIter *iter); GdkPixbuf* (*get_pixbuf) (GdkPixbufAnimationIter *iter); gboolean (*on_currently_loading_frame) (GdkPixbufAnimationIter *iter); gboolean (*advance) (GdkPixbufAnimationIter *iter, const GTimeVal *current_time); } GdkPixbufAnimationIterClass; Modules supporting animations must derive a type from GdkPixbufAnimationIter, providing suitable implementations of the virtual functions.
|