aboutsummaryrefslogtreecommitdiff
path: root/plugin-img.h
diff options
context:
space:
mode:
authorIgor Pashev <pashev@truth.pearl.pomorsu.ru>2009-10-28 14:14:58 +0300
committerIgor Pashev <pashev@truth.pearl.pomorsu.ru>2009-10-28 14:14:58 +0300
commit629cb019b8641c1278309bb3aa53463c4a4ac66f (patch)
tree3d705d349f47312da5605c4041054f7ae877c449 /plugin-img.h
downloadgimp-plugin-img-629cb019b8641c1278309bb3aa53463c4a4ac66f.tar.gz
Public release
Diffstat (limited to 'plugin-img.h')
-rw-r--r--plugin-img.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/plugin-img.h b/plugin-img.h
new file mode 100644
index 0000000..9d740e4
--- /dev/null
+++ b/plugin-img.h
@@ -0,0 +1,85 @@
+#ifndef __IMG_H__
+# define __IMG_H__
+
+# include <libgimp/gimp.h>
+# include <libgimp/gimpui.h>
+# include <errno.h>
+# include <string.h>
+# include <glib/gstdio.h>
+
+# define LOAD_PROC "file-img-load"
+# define SAVE_PROC "file-img-save"
+# define PLUG_IN_BINARY "file-img"
+
+/* Comment out to disable debug */
+# define DEBUG
+
+# ifdef DEBUG
+# define __DEBUG(x) {x}
+# define D(x) \
+{ \
+ printf("IMG plugin: "); \
+ printf x; \
+}
+# else
+# define __DEBUG(x)
+# define D(x)
+# endif
+
+/* FIXME: MIME type for these files */
+# define IMG_MIME "image/x-img"
+
+# define FMT_RGB565 0
+# define FMT_RGB 1
+# define FMT_RGBA 2
+
+extern const gchar *FMT[3];
+
+/* File structure:
+ * |------------------------|
+ * | File header |
+ * |------------------------|
+ * | [Color key for RGB] |
+ * |------------------------|
+ * | Image data |
+ * |- - - - - - - - - - - - |
+ *
+ * */
+
+/* ACHTUNG: byte order in the file is BIG-ENDIAN - lowest byte comes first */
+typedef struct _FileHeader
+{
+ guint8 fmt; /* 0 - RGB565, 1 - RGB, 2 - RGBA) */
+
+ /*
+ * ACHTUNG: do not align, or else sizeof(ftm)==4: __attribute__ ((packed))
+ */
+ guint32 nrows __attribute__ ((packed)); /* Number of rows of frames */
+ guint32 ncols __attribute__ ((packed)); /* Number of columns of frames */
+
+ guint32 width __attribute__ ((packed)); /* Image width (total) */
+ guint32 height __attribute__ ((packed)); /* Image height (total) */
+
+} FileHeader;
+
+typedef struct _ColorKey
+{
+ guint8 is; /* 0 - no color key, otherwise is one */
+ guint8 R __attribute__ ((packed));
+ guint8 G __attribute__ ((packed));
+ guint8 B __attribute__ ((packed));
+
+} ColorKey;
+
+/* Save params for GIMP_RUN_WITH_LAST_VALS
+ * for each image LOADED image or for plugin defaults *
+ * */
+
+# define PARASITE_ORIG_FILE "orig-file-info"
+typedef struct _ImageParasite
+{
+ guint32 format;
+ ColorKey ckey;
+} ImageParasite;
+
+#endif