started adding indexed color support to imago2
[dos_imgv] / imago / src / imago2.h
index b6b5269..48bda1b 100644 (file)
@@ -37,6 +37,7 @@ enum img_fmt {
        IMG_FMT_RGBAF,
        IMG_FMT_BGRA32,
        IMG_FMT_RGB565,
+       IMG_FMT_IDX8,
 
        NUM_IMG_FMT
 };
@@ -49,6 +50,13 @@ struct img_pixmap {
        char *name;
 };
 
+struct img_colormap {
+       int ncolors;
+       struct {
+               unsigned char r, g, b;
+       } color[256];
+};
+
 struct img_io {
        void *uptr;     /* user-data */
 
@@ -160,6 +168,9 @@ void img_getpixel1f(struct img_pixmap *img, int x, int y, float *pix);
 void img_getpixel4i(struct img_pixmap *img, int x, int y, int *r, int *g, int *b, int *a);
 void img_getpixel4f(struct img_pixmap *img, int x, int y, float *r, float *g, float *b, float *a);
 
+/* For IMG_FMT_IDX8 pixmaps, returns a pointer to the colormap, null otherwise */
+struct img_colormap *img_colormap(struct img_pixmap *img);
+
 
 /* OpenGL helper functions */