PixbufFormat

If GdkPixBuf 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 fill_info and a GdkPixbufModuleFillVtableFunc function named fill_vtable.

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 fill_info function. An external utility, gdk-pixbuf-query-loaders, uses this to create a text file containing a list of all available loaders and their signatures. This file is then read at runtime by GdkPixBuf to obtain the list of available loaders and their signatures.

Modules may only implement a subset of the functionality available via GdkPixbufModule. If a particular functionality is not implemented, the fill_vtable function will simply not set the corresponding function pointers of the GdkPixbufModule structure. If a module supports incremental loading (i.e. provides begin_load, stop_load and load_increment), it doesn't have to implement load, since GdkPixBuf can supply a generic load implementation wrapping the incremental loading.

Installing a module is a two-step process:

copy the module file(s) to the loader directory (normally libdir/gtk-2.0/version/loaders, unless overridden by the environment variable GDK_PIXBUF_MODULEDIR)

call gdk-pixbuf-query-loaders to update the module file (normally sysconfdir/gtk-2.0/gdk-pixbuf.loaders, unless overridden by the environment variable GDK_PIXBUF_MODULE_FILE)

The GdkPixBuf interfaces needed for implementing modules are contained in gdk-pixbuf-io.h (and gdk-pixbuf-animation.h if the module supports animations). They are not covered by the same stability guarantees as the regular GdkPixBuf API. To underline this fact, they are protected by #ifdef GDK_PIXBUF_ENABLE_BACKEND.

Constructors

this
this(GdkPixbufFormat* gdkPixbufFormat)

Sets our main struct and passes it to the parent class

Members

Functions

copy
PixbufFormat copy()

Creates a copy of format Since 2.22

free
void free()

Frees the resources allocated when copying a GdkPixbufFormat using gdk_pixbuf_format_copy() Since 2.22

getDescription
string getDescription()

Returns a description of the format. Since 2.2

getExtensions
string[] getExtensions()

Returns the filename extensions typically used for files in the given format. Since 2.2

getLicense
string getLicense()

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 g_free() when it's no longer needed. Since 2.6

getMimeTypes
string[] getMimeTypes()

Returns the mime types supported by the format. Since 2.2

getName
string getName()

Returns the name of the format. Since 2.2

getPixbufFormatStruct
GdkPixbufFormat* getPixbufFormatStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

isDisabled
int isDisabled()

Returns whether this image format is disabled. See gdk_pixbuf_format_set_disabled(). Since 2.6

isScalable
int isScalable()

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

isWritable
int isWritable()

Returns whether pixbufs can be saved in the given format. Since 2.2

setDisabled
void setDisabled(int 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 gdk_pixbuf_format_get_license(). Since 2.6

Static functions

gdkPixbufGetFormats
ListSG gdkPixbufGetFormats()

Obtains the available information about the image formats supported by GdkPixbuf. Since 2.2

gdkPixbufSetOption
int gdkPixbufSetOption(Pixbuf pixbuf, string key, string value)

Attaches a key/value pair as an option to a GdkPixbuf. If key already exists in the list of options attached to pixbuf, the new value is ignored and FALSE is returned. Since 2.2

Variables

gdkPixbufFormat
GdkPixbufFormat* gdkPixbufFormat;

the main Gtk struct

Meta