From 629cb019b8641c1278309bb3aa53463c4a4ac66f Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Wed, 28 Oct 2009 14:14:58 +0300 Subject: Public release --- plugin-img.h | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 plugin-img.h (limited to 'plugin-img.h') 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 +# include +# include +# include +# include + +# 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 -- cgit v1.2.3