+/* -*- mode: C; c-file-style: "linux" -*- */
/* GdkPixbuf library - XBM image loader
*
* Copyright (C) 1999 Mark Crichton
#include <config.h>
#include <stdlib.h>
#include <string.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdio.h>
-#include <ctype.h>
#include <errno.h>
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
typedef struct _XBMData XBMData;
struct _XBMData
{
- ModulePreparedNotifyFunc prepare_func;
- ModuleUpdatedNotifyFunc update_func;
+ GdkPixbufModulePreparedFunc prepare_func;
+ GdkPixbufModuleUpdatedFunc update_func;
gpointer user_data;
gchar *tempname;
} else {
/* trim high bits, check type and accumulate */
ch &= 0xff;
- if (isascii (ch) && isxdigit (ch)) {
- value = (value << 4) + hex_table[ch];
+ if (g_ascii_isxdigit (ch)) {
+ value = (value << 4) + g_ascii_xdigit_value (ch);
gotone++;
} else if ((hex_table[ch]) < 0 && gotone) {
done++;
*ptr=value;
}
}
+ break;
}
if (!bits)
return NULL;
}
+ if (x_hot != -1 && y_hot != -1) {
+ gchar hot[10];
+ g_snprintf (hot, 10, "%d", x_hot);
+ gdk_pixbuf_set_option (pixbuf, "x_hot", hot);
+ g_snprintf (hot, 10, "%d", y_hot);
+ gdk_pixbuf_set_option (pixbuf, "y_hot", hot);
+ }
+
pixels = gdk_pixbuf_get_pixels (pixbuf);
row_stride = gdk_pixbuf_get_rowstride (pixbuf);
}
pixels += row_stride;
}
+ g_free (data);
if (context) {
(* context->update_func) (pixbuf, 0, 0, w, h, context->user_data);
*/
static gpointer
-gdk_pixbuf__xbm_image_begin_load (ModulePreparedNotifyFunc prepare_func,
- ModuleUpdatedNotifyFunc update_func,
+gdk_pixbuf__xbm_image_begin_load (GdkPixbufModuleSizeFunc size_func,
+ GdkPixbufModulePreparedFunc prepare_func,
+ GdkPixbufModuleUpdatedFunc update_func,
gpointer user_data,
GError **error)
{
}
void
-gdk_pixbuf__xbm_fill_vtable (GdkPixbufModule *module)
+MODULE_ENTRY (xbm, fill_vtable) (GdkPixbufModule *module)
+{
+ module->load = gdk_pixbuf__xbm_image_load;
+ module->begin_load = gdk_pixbuf__xbm_image_begin_load;
+ module->stop_load = gdk_pixbuf__xbm_image_stop_load;
+ module->load_increment = gdk_pixbuf__xbm_image_load_increment;
+}
+
+void
+MODULE_ENTRY (xbm, fill_info) (GdkPixbufFormat *info)
{
- module->load = gdk_pixbuf__xbm_image_load;
- module->begin_load = gdk_pixbuf__xbm_image_begin_load;
- module->stop_load = gdk_pixbuf__xbm_image_stop_load;
- module->load_increment = gdk_pixbuf__xbm_image_load_increment;
+ static GdkPixbufModulePattern signature[] = {
+ { "#define ", NULL, 100 },
+ { "/*", NULL, 50 },
+ { NULL, NULL, 0 }
+ };
+ static gchar * mime_types[] = {
+ "image/x-xbitmap",
+ NULL
+ };
+ static gchar * extensions[] = {
+ "xbm",
+ NULL
+ };
+
+ info->name = "xbm";
+ info->signature = signature;
+ info->description = N_("The XBM image format");
+ info->mime_types = mime_types;
+ info->extensions = extensions;
+ info->flags = 0;
}