gtk/docs/reference/gdk-pixbuf/tmpl/module_interface.sgml
Soeren Sandmann d2aa626845 remove unused codepath.
Fri Oct  4 21:21:47 2002  Soeren Sandmann  <sandmann@daimi.au.dk>

	* gtk/gtkhandlebox.c (gtk_handle_box_paint): remove unused
	codepath.

	* gtk/gtkmenuitem.c (gtk_real_menu_item_{de,}select): call
	gtk_widget_queue_draw() instead of gtk_widget_draw().
2002-10-04 19:46:36 +00:00

99 lines
3.8 KiB
Plaintext

<!-- ##### SECTION Title ##### -->
Module Interface
<!-- ##### SECTION Short_Description ##### -->
Extending &gdk-pixbuf;
<!-- ##### SECTION Long_Description ##### -->
<para>
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 <function>fill_info</function> and
a #GdkPixbufModuleFillVtableFunc function named
<function>fill_vtable</function>.
</para>
<para>
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 <function>fill_info</function>
function. An external utility, <command>gdk-pixbuf-query-loaders</command>, 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 &gdk-pixbuf; to obtain
the list of available loaders and their signatures.
</para>
<para>
Modules may only implement a subset of the functionality available via
#GdkPixbufModule. If a particular functionality is not implemented, the
<function>fill_vtable</function> 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 &gdk-pixbuf; can
supply a generic #load implementation wrapping the incremental loading.
</para>
<para>
Installing a module is a two-step process:
<itemizedlist>
<listitem><para>copy the module file(s) to the loader directory (normally
<filename><replaceable>libdir</replaceable>/gtk-2.0/<replaceable>version</replaceable>/loaders</filename>,
unless overridden by the environment variable
<envar>GDK_PIXBUF_MODULEDIR</envar>)
</para></listitem>
<listitem><para>call <command>gdk-pixbuf-query-loaders</command> to update the
module file (normally
<filename><replaceable>sysconfdir</replaceable>/gtk-2.0/gdk-pixbuf.loaders</filename>,
unless overridden by the environment variable
<envar>GDK_PIXBUF_MODULE_FILE</envar>)
</para></listitem>
</itemizedlist>
</para>
<para>
The &gdk-pixbuf; interfaces needed for implementing modules are contained in
<filename>gdk-pixbuf-io.h</filename> (and
<filename>gdk-pixbuf-animation.h</filename> if the module supports animations).
They are not covered by the same stability guarantees as the regular
&gdk-pixbuf; API. To underline this fact, they are protected by
<literal>#ifdef GDK_PIXBUF_ENABLE_BACKEND</literal>.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### STRUCT GdkPixbufModule ##### -->
<para>
A #GdkPixbufModule contains the necessary functions to load and save
images in a certain file format.
</para>
<para>
A #GdkPixbufModule can be loaded dynamically from a #GModule.
Each loadable module must contain a #GdkPixbufModuleFillVtableFunc function
named <function>fill_vtable</function>, which will get called when the module
is loaded and must set the function pointers of the #GdkPixbufModule.
</para>
@module_name: the name of the module, usually the same as the
usual file extension for images of this type, eg. "xpm", "jpeg" or "png".
@module_path: the path from which the module is loaded.
@module: the loaded #GModule.
@info: a #GdkPixbufFormat holding information about the module.
@load: loads an image from a file.
@load_xpm_data: loads an image from data in memory.
@begin_load: begins an incremental load.
@stop_load: stops an incremental load.
@load_increment: continues an incremental load.
@load_animation: loads an animation from a file.
@save: saves a #GdkPixbuf to a file.
@_reserved1:
@_reserved2:
@_reserved3:
@_reserved4:
@_reserved5:
@_reserved6: