Module Interface

Name

Module Interface -- Extending gdk-pixbuf

Synopsis


#include <gdk-pixbuf/gdk-pixbuf.h>


void        (*ModuleFillVtableFunc)         (GdkPixbufModule *module);
void        (*ModulePreparedNotifyFunc)     (GdkPixbuf *pixbuf,
                                             GdkPixbufAnimation *anim,
                                             gpointer user_data);
void        (*ModuleUpdatedNotifyFunc)      (GdkPixbuf *pixbuf,
                                             int x,
                                             int y,
                                             int width,
                                             int height,
                                             gpointer user_data);
struct      GdkPixbufModule;

Description

Details

ModuleFillVtableFunc ()

void        (*ModuleFillVtableFunc)         (GdkPixbufModule *module);

Defines the type of the function used to set the vtable of a GdkPixbufModule when it is loaded.


ModulePreparedNotifyFunc ()

void        (*ModulePreparedNotifyFunc)     (GdkPixbuf *pixbuf,
                                             GdkPixbufAnimation *anim,
                                             gpointer user_data);

Defines the type of the function that gets called once the initial setup of pixbuf is done.

GdkPixbufLoader uses a function of this type to emit the "area_prepared" signal.


ModuleUpdatedNotifyFunc ()

void        (*ModuleUpdatedNotifyFunc)      (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 pixbuf is updated.

GdkPixbufLoader uses a function of this type to emit the "area_updated" signal.


struct GdkPixbufModule

struct GdkPixbufModule {
	char *module_name;
	gboolean (* format_check) (guchar *buffer, int size);
	GModule *module;
        GdkPixbuf *(* load) (FILE    *f,
                             GError **error);
        GdkPixbuf *(* load_xpm_data) (const char **data);

        /* Incremental loading */

        gpointer (* begin_load)     (ModulePreparedNotifyFunc prepare_func,
                                     ModuleUpdatedNotifyFunc 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);

        gboolean (* save) (FILE      *f,
                           GdkPixbuf *pixbuf,
                           gchar    **param_keys,
                           gchar    **param_values,
                           GError   **error);
};

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 ModuleFillVtableFunc function named gdk_pixbuf__module_name_fill_vtable. It will get called when the module is loaded and must set the function pointers of the GdkPixbufModule.