diff tools/libgfx.h @ 1616:36d073c45327

Refactor the format handling a bit.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 15 May 2018 14:29:32 +0300
parents c29adf5ce240
children a549d33d543a
line wrap: on
line diff
--- a/tools/libgfx.h	Tue May 15 12:38:55 2018 +0300
+++ b/tools/libgfx.h	Tue May 15 14:29:32 2018 +0300
@@ -25,8 +25,6 @@
     DM_IMGFMT_ILBM,
     DM_IMGFMT_RAW,
     DM_IMGFMT_ARAW,
-
-    DM_IMGFMT_LAST
 };
 
 
@@ -97,7 +95,9 @@
 typedef struct
 {
     char *fext;
-    char *desc;
+    char *name;
+    int  fmtid;  // DM_IMGFMT_*
+    int  flags;  // DM_FMT_* flags
     int  (*probe)(const Uint8 *buf, const size_t len);
     int  (*read)(const char *filename, DMImage **pimg);
     int  (*readFILE)(DMResource *fp, DMImage **pimg);
@@ -106,14 +106,15 @@
 } DMImageFormat;
 
 
-extern DMImageFormat dmImageFormatList[DM_IMGFMT_LAST];
+extern const DMImageFormat dmImageFormatList[];
+extern const int ndmImageFormatList;
 extern int dmGFXErrorMode;
 
 
 DMImage * dmImageAlloc(const int width, const int height, const int format, const int bpp);
 void      dmImageFree(DMImage *img);
 int       dmImageGetBytesPerPixel(const int format);
-int       dmImageProbeGeneric(const Uint8 *buf, const size_t len, DMImageFormat **fmt, int *index);
+int       dmImageProbeGeneric(const Uint8 *buf, const size_t len, const DMImageFormat **fmt, int *index);
 
 BOOL dmCompareColor(const DMColor *c1, const DMColor *c2, BOOL alpha);