changeset 2157:9a9493809b3a

Rename DM_COLFMT_* constants to DM_PIXFMT_* and the 'format' field of DMImage and DMImageWriteSpec to 'pixfmt' to be more precise about their meaning.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 04 Jun 2019 16:27:09 +0300
parents e6ec7fad9ce2
children e363dc852383
files tools/gfxconv.c tools/lib64gfx.c tools/libgfx.c tools/libgfx.h
diffstat 4 files changed, 100 insertions(+), 100 deletions(-) [+]
line wrap: on
line diff
--- a/tools/gfxconv.c	Tue Jun 04 16:18:41 2019 +0300
+++ b/tools/gfxconv.c	Tue Jun 04 16:27:09 2019 +0300
@@ -144,7 +144,7 @@
     .nplanes = 0,
     .bpp = 8,
     .planar = FALSE,
-    .format = 0,
+    .pixfmt = 0,
     .compression = FCMP_BEST,
 };
 
@@ -1068,7 +1068,7 @@
         goto error;
     }
 
-    if ((dst = *pdst = dmImageAlloc(src->width, src->height, src->format, src->bpp)) == NULL)
+    if ((dst = *pdst = dmImageAlloc(src->width, src->height, src->pixfmt, src->bpp)) == NULL)
     {
         res = dmError(DMERR_MALLOC,
             "Could not allocate memory for remapped image.\n");
@@ -1435,7 +1435,7 @@
     // Perform color remapping
     DMImage *image = pimage;
     BOOL allocated = FALSE;
-    if (optRemapColors && pimage->format == DM_COLFMT_PALETTE)
+    if (optRemapColors && pimage->pixfmt == DM_PIXFMT_PALETTE)
     {
         if ((res = dmRemapImageColors(&image, pimage)) != DMERR_OK)
             return res;
@@ -1446,11 +1446,11 @@
     // Determine number of planes, if paletted
     if (spec->nplanes == 0)
     {
-        if (image->format == DM_COLFMT_PALETTE &&
+        if (image->pixfmt == DM_PIXFMT_PALETTE &&
             image->pal != NULL)
             spec->nplanes = dmGetNPlanesFromNColors(image->pal->ncolors);
         else
-        if (image->format == DM_COLFMT_GRAYSCALE)
+        if (image->pixfmt == DM_PIXFMT_GRAYSCALE)
             spec->nplanes = image->bpp;
     }
 
@@ -1464,16 +1464,16 @@
     {
         case DM_IMGFMT_PNG:
             if (optUsePalette)
-                spec->format = (image->format == DM_COLFMT_GRAYSCALE) ? DM_COLFMT_GRAYSCALE : DM_COLFMT_PALETTE;
+                spec->pixfmt = (image->pixfmt == DM_PIXFMT_GRAYSCALE) ? DM_PIXFMT_GRAYSCALE : DM_PIXFMT_PALETTE;
             else
-                spec->format = DM_COLFMT_RGBA;
+                spec->pixfmt = DM_PIXFMT_RGBA;
             break;
 
         case DM_IMGFMT_PPM:
-            if (optUsePalette && image->format == DM_COLFMT_GRAYSCALE)
-                spec->format = DM_COLFMT_GRAYSCALE;
+            if (optUsePalette && image->pixfmt == DM_PIXFMT_GRAYSCALE)
+                spec->pixfmt = DM_PIXFMT_GRAYSCALE;
             else
-                spec->format = DM_COLFMT_RGB;
+                spec->pixfmt = DM_PIXFMT_RGB;
             break;
 
         case DM_IMGFMT_RAW:
@@ -1511,7 +1511,7 @@
             break;
 
         default:
-            spec->format = optUsePalette ? DM_COLFMT_PALETTE : DM_COLFMT_RGB;
+            spec->pixfmt = optUsePalette ? DM_PIXFMT_PALETTE : DM_PIXFMT_RGB;
             break;
     }
 
@@ -1523,12 +1523,12 @@
         if (info)
         {
             char *str;
-            switch (image->format)
+            switch (image->pixfmt)
             {
-                case DM_COLFMT_PALETTE   : str = "indexed/paletted"; break;
-                case DM_COLFMT_RGB       : str = "24bit RGB"; break;
-                case DM_COLFMT_RGBA      : str = "32bit RGBA"; break;
-                case DM_COLFMT_GRAYSCALE : str = "grayscale"; break;
+                case DM_PIXFMT_PALETTE   : str = "indexed/paletted"; break;
+                case DM_PIXFMT_RGB       : str = "24bit RGB"; break;
+                case DM_PIXFMT_RGBA      : str = "32bit RGBA"; break;
+                case DM_PIXFMT_GRAYSCALE : str = "grayscale"; break;
                 default                  : str = "???"; break;
             }
             dmMsg(2, "Using %s output.\n", str);
@@ -1806,7 +1806,7 @@
                 goto error;
             }
 
-            outImage = dmImageAlloc(outWidthPX, outHeight, DM_COLFMT_PALETTE, -1);
+            outImage = dmImageAlloc(outWidthPX, outHeight, DM_PIXFMT_PALETTE, -1);
             dmMsg(1, "Outputting sequence of %d images @ %d x %d -> %d x %d.\n",
                 optItemCount,
                 outImage->width, outImage->height,
@@ -1827,7 +1827,7 @@
             if (optItemCount % optPlanedWidth)
                 outIHeight++;
 
-            outImage = dmImageAlloc(outWidthPX * outIWidth, outIHeight * outHeight, DM_COLFMT_PALETTE, -1);
+            outImage = dmImageAlloc(outWidthPX * outIWidth, outIHeight * outHeight, DM_PIXFMT_PALETTE, -1);
         }
 
         if ((err = dmSetDefaultC64Palette(outImage)) != DMERR_OK)
--- a/tools/lib64gfx.c	Tue Jun 04 16:18:41 2019 +0300
+++ b/tools/lib64gfx.c	Tue Jun 04 16:27:09 2019 +0300
@@ -1430,7 +1430,7 @@
 
     // Allocate image structure
     if ((*pdst = dst = dmImageAlloc(
-        src->fmt->width, src->fmt->height, DM_COLFMT_PALETTE, -1)) == NULL)
+        src->fmt->width, src->fmt->height, DM_PIXFMT_PALETTE, -1)) == NULL)
         return DMERR_MALLOC;
 
     // Set partial palette information
--- a/tools/libgfx.c	Tue Jun 04 16:18:41 2019 +0300
+++ b/tools/libgfx.c	Tue Jun 04 16:27:09 2019 +0300
@@ -123,10 +123,10 @@
 {
     switch (format)
     {
-        case DM_COLFMT_GRAYSCALE : return 1;
-        case DM_COLFMT_PALETTE   : return 1;
-        case DM_COLFMT_RGB       : return 3;
-        case DM_COLFMT_RGBA      : return 4;
+        case DM_PIXFMT_GRAYSCALE : return 1;
+        case DM_PIXFMT_PALETTE   : return 1;
+        case DM_PIXFMT_RGB       : return 3;
+        case DM_PIXFMT_RGBA      : return 4;
         default                  : return -1;
     }
 }
@@ -146,7 +146,7 @@
 
     img->width   = width;
     img->height  = height;
-    img->format  = format;
+    img->pixfmt  = format;
     img->bpp     = (bpp <= 0) ? dmImageGetBitsPerPixel(format) : bpp;
     img->pitch   = (width * img->bpp) / 8;
     img->size    = img->pitch * img->height;
@@ -337,7 +337,7 @@
 
     // Allocate memory for row buffer
     rowWidth = img->width * spec->scaleX;
-    rowSize = rowWidth * dmImageGetBytesPerPixel(spec->format);
+    rowSize = rowWidth * dmImageGetBytesPerPixel(spec->pixfmt);
 
     if ((row = dmMalloc(rowSize + 16)) == NULL)
     {
@@ -353,21 +353,21 @@
                 *ptr3 = ptr2 + rowWidth,
                 *ptr4 = ptr3 + rowWidth;
 
-        if (img->format == DM_COLFMT_GRAYSCALE)
+        if (img->pixfmt == DM_PIXFMT_GRAYSCALE)
         {
             for (x = 0; x < img->width; x++)
             {
                 Uint8 c = img->data[(y * img->pitch) + (x * img->bpp) / 8];
 
-                switch (spec->format)
+                switch (spec->pixfmt)
                 {
-                    case DM_COLFMT_PALETTE:
-                    case DM_COLFMT_GRAYSCALE:
+                    case DM_PIXFMT_PALETTE:
+                    case DM_PIXFMT_GRAYSCALE:
                         for (xscale = 0; xscale < spec->scaleX; xscale++)
                             *ptr1++ = c;
                         break;
 
-                    case DM_COLFMT_RGBA:
+                    case DM_PIXFMT_RGBA:
                         if (spec->planar)
                         {
                             for (xscale = 0; xscale < spec->scaleX; xscale++)
@@ -390,7 +390,7 @@
                         }
                         break;
 
-                    case DM_COLFMT_RGB:
+                    case DM_PIXFMT_RGB:
                         if (spec->planar)
                         {
                             for (xscale = 0; xscale < spec->scaleX; xscale++)
@@ -418,7 +418,7 @@
             }
         }
         else
-        if (img->format == DM_COLFMT_PALETTE)
+        if (img->pixfmt == DM_PIXFMT_PALETTE)
         {
             for (x = 0; x < img->width; x++)
             {
@@ -431,15 +431,15 @@
                     goto done;
                 }
 
-                switch (spec->format)
+                switch (spec->pixfmt)
                 {
-                    case DM_COLFMT_PALETTE:
-                    case DM_COLFMT_GRAYSCALE:
+                    case DM_PIXFMT_PALETTE:
+                    case DM_PIXFMT_GRAYSCALE:
                         for (xscale = 0; xscale < spec->scaleX; xscale++)
                             *ptr1++ = c;
                         break;
 
-                    case DM_COLFMT_RGBA:
+                    case DM_PIXFMT_RGBA:
                         qr = img->pal->colors[c].r;
                         qg = img->pal->colors[c].g;
                         qb = img->pal->colors[c].b;
@@ -467,7 +467,7 @@
                         }
                         break;
 
-                    case DM_COLFMT_RGB:
+                    case DM_PIXFMT_RGB:
                         qr = img->pal->colors[c].r;
                         qg = img->pal->colors[c].g;
                         qb = img->pal->colors[c].b;
@@ -499,15 +499,15 @@
             }
         }
         else
-        if (img->format == DM_COLFMT_RGB ||
-            img->format == DM_COLFMT_RGBA)
+        if (img->pixfmt == DM_PIXFMT_RGB ||
+            img->pixfmt == DM_PIXFMT_RGBA)
         {
             Uint8 *sp = img->data + (y * img->pitch);
 
             for (x = 0; x < img->width; x++, sp += img->bpp / 8)
-            switch (spec->format)
+            switch (spec->pixfmt)
             {
-                 case DM_COLFMT_RGBA:
+                 case DM_PIXFMT_RGBA:
                     if (spec->planar)
                     {
                         for (xscale = 0; xscale < spec->scaleX; xscale++)
@@ -530,7 +530,7 @@
                     }
                     break;
 
-                case DM_COLFMT_RGB:
+                case DM_PIXFMT_RGB:
                     if (spec->planar)
                     {
                         for (xscale = 0; xscale < spec->scaleX; xscale++)
@@ -586,7 +586,7 @@
         return dmferror(fp);
 
     if (spec->fmtid == DM_IMGFMT_ARAW &&
-        img->format == DM_COLFMT_PALETTE &&
+        img->pixfmt == DM_PIXFMT_PALETTE &&
         img->pal != NULL)
     {
         if (dmfprintf(fp,
@@ -771,8 +771,8 @@
     char *tmpFmt;
 
     // Check if we can do this
-    if ((spec->format == DM_COLFMT_PALETTE || spec->format == DM_COLFMT_GRAYSCALE) &&
-        img->format != spec->format)
+    if ((spec->pixfmt == DM_PIXFMT_PALETTE || spec->pixfmt == DM_PIXFMT_GRAYSCALE) &&
+        img->pixfmt != spec->pixfmt)
     {
         return dmError(DMERR_NOT_SUPPORTED,
             "Conversion of non-indexed image to indexed not supported yet.\n");
@@ -780,16 +780,16 @@
 
     memcpy(&tmpSpec, spec, sizeof(DMImageWriteSpec));
 
-    switch (spec->format)
+    switch (spec->pixfmt)
     {
-        case DM_COLFMT_RGB:
-        case DM_COLFMT_RGBA:
-        case DM_COLFMT_PALETTE:
-            tmpSpec.format = DM_COLFMT_RGB;
+        case DM_PIXFMT_RGB:
+        case DM_PIXFMT_RGBA:
+        case DM_PIXFMT_PALETTE:
+            tmpSpec.pixfmt = DM_PIXFMT_RGB;
             tmpFmt = "6";
             break;
 
-        case DM_COLFMT_GRAYSCALE:
+        case DM_PIXFMT_GRAYSCALE:
             tmpFmt = "5";
             break;
 
@@ -802,8 +802,8 @@
     char *tmp = dm_strdup_printf(
         "P%s\n%d %d\n255\n",
         tmpFmt,
-        img->width * spec->scaleX,
-        img->height * spec->scaleY);
+        img->width * tmpSpec.scaleX,
+        img->height * tmpSpec.scaleY);
 
     if (tmp == NULL)
         return DMERR_MALLOC;
@@ -878,8 +878,8 @@
 
     switch (hdr1[1])
     {
-        case '6': itype = DM_COLFMT_RGB; break;
-        case '5': itype = DM_COLFMT_GRAYSCALE; break;
+        case '6': itype = DM_PIXFMT_RGB; break;
+        case '5': itype = DM_PIXFMT_GRAYSCALE; break;
         default:
             res = dmError(DMERR_NOT_SUPPORTED,
                 "PPM: Unsupported PPM/PNM/PGM subtype.\n");
@@ -981,8 +981,8 @@
     int fmt, res;
 
     // Check if we can do this
-    if ((spec->format == DM_COLFMT_PALETTE || spec->format == DM_COLFMT_GRAYSCALE) &&
-        img->format != spec->format)
+    if ((spec->pixfmt == DM_PIXFMT_PALETTE || spec->pixfmt == DM_PIXFMT_GRAYSCALE) &&
+        img->pixfmt != spec->pixfmt)
     {
         return dmError(DMERR_NOT_SUPPORTED,
             "Conversion of non-indexed image to indexed not supported yet.\n");
@@ -1020,16 +1020,16 @@
     png_set_write_fn(png_ptr, fp, dmPNGWriteData, dmPNGWriteFlush);
 
     // Write PNG header info
-    switch (spec->format)
+    switch (spec->pixfmt)
     {
-        case DM_COLFMT_PALETTE   : fmt = PNG_COLOR_TYPE_PALETTE; break;
-        case DM_COLFMT_GRAYSCALE : fmt = PNG_COLOR_TYPE_GRAY; break;
-        case DM_COLFMT_RGB       : fmt = PNG_COLOR_TYPE_RGB; break;
-        case DM_COLFMT_RGBA      : fmt = PNG_COLOR_TYPE_RGB_ALPHA; break;
+        case DM_PIXFMT_PALETTE   : fmt = PNG_COLOR_TYPE_PALETTE; break;
+        case DM_PIXFMT_GRAYSCALE : fmt = PNG_COLOR_TYPE_GRAY; break;
+        case DM_PIXFMT_RGB       : fmt = PNG_COLOR_TYPE_RGB; break;
+        case DM_PIXFMT_RGBA      : fmt = PNG_COLOR_TYPE_RGB_ALPHA; break;
         default:
             res = dmError(DMERR_NOT_SUPPORTED,
                 "PNG: Unsupported image format %d.\n",
-                spec->format);
+                spec->pixfmt);
             goto error;
     }
 
@@ -1050,7 +1050,7 @@
         8, fmt);
 
     // Palette
-    if (spec->format == DM_COLFMT_PALETTE)
+    if (spec->pixfmt == DM_PIXFMT_PALETTE)
     {
         png_colorp palette = png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH * sizeof(png_color));
 
@@ -1171,20 +1171,20 @@
             if (bit_depth < 8)
                 png_set_expand_gray_1_2_4_to_8(png_ptr);
 
-            itype = DM_COLFMT_GRAYSCALE;
+            itype = DM_PIXFMT_GRAYSCALE;
             break;
 
         case PNG_COLOR_TYPE_PALETTE:
             png_set_packing(png_ptr);
-            itype = DM_COLFMT_PALETTE;
+            itype = DM_PIXFMT_PALETTE;
             break;
 
         case PNG_COLOR_TYPE_RGB:
-            itype = DM_COLFMT_RGB;
+            itype = DM_PIXFMT_RGB;
             break;
 
         case PNG_COLOR_TYPE_RGBA:
-            itype = DM_COLFMT_RGBA;
+            itype = DM_PIXFMT_RGBA;
             break;
 
         default:
@@ -1427,14 +1427,14 @@
     spec.planar = TRUE;
 
     // XXX: 24bit PCX does not work yet ..
-    if ((img->format != DM_COLFMT_PALETTE && img->format != DM_COLFMT_GRAYSCALE) ||
-        (spec.format != DM_COLFMT_PALETTE && spec.format != DM_COLFMT_GRAYSCALE))
+    if ((img->pixfmt != DM_PIXFMT_PALETTE && img->pixfmt != DM_PIXFMT_GRAYSCALE) ||
+        (spec.pixfmt != DM_PIXFMT_PALETTE && spec.pixfmt != DM_PIXFMT_GRAYSCALE))
     {
         return dmError(DMERR_NOT_SUPPORTED,
             "24bit PCX not supported yet.\n");
     }
 
-    if (spec.format == DM_COLFMT_PALETTE && img->pal == NULL)
+    if (spec.pixfmt == DM_PIXFMT_PALETTE && img->pal == NULL)
     {
         return dmError(DMERR_NULLPTR,
             "Image spec says paletted/indexed image, but palette pointer is NULL.\n");
@@ -1447,8 +1447,8 @@
 
     // Create PCX header
     dmMemset(&hdr, 0, sizeof(hdr));
-    if (spec.format == DM_COLFMT_PALETTE ||
-        spec.format == DM_COLFMT_GRAYSCALE)
+    if (spec.pixfmt == DM_PIXFMT_PALETTE ||
+        spec.pixfmt == DM_PIXFMT_GRAYSCALE)
     {
         const int ncolors = img->pal->ncolors > DMPCX_PAL_COLORS ? DMPCX_PAL_COLORS : img->pal->ncolors;
         for (int i = 0; i < ncolors; i++)
@@ -1472,7 +1472,7 @@
 
     // TODO XXX .. maybe actually compute these asdf
     hdr.bitsPerPlane = 8;
-    hdr.nplanes      = dmImageGetBytesPerPixel(spec.format);
+    hdr.nplanes      = dmImageGetBytesPerPixel(spec.pixfmt);
 
     res = img->width * spec.scaleX;
     hdr.bpl = res / 2;
@@ -1487,7 +1487,7 @@
 
     dmMsg(2, "PCX: nplanes=%d, bpp=%d, bpl=%d, colfmt=%d, planar=%s\n",
         hdr.nplanes, hdr.bitsPerPlane, hdr.bpl,
-        spec.format,
+        spec.pixfmt,
         spec.planar ? "yes" : "no"
         );
 
@@ -1548,8 +1548,8 @@
     res = dmWriteImageData(img, (void *) &pcx, dmWritePCXRow, &spec);
 
     // Write VGA palette
-    if (spec.format == DM_COLFMT_PALETTE ||
-        spec.format == DM_COLFMT_GRAYSCALE)
+    if (spec.pixfmt == DM_PIXFMT_PALETTE ||
+        spec.pixfmt == DM_PIXFMT_GRAYSCALE)
     {
         dmMsg(2, "PCX: Writing palette of %d active entries.\n", img->pal->ncolors);
 
@@ -1706,7 +1706,7 @@
 
     // Allocate image
     if ((*pimg = img = dmImageAlloc(hdr.xmax - hdr.xmin + 1, hdr.ymax - hdr.ymin + 1,
-        isPaletted ? DM_COLFMT_PALETTE : DM_COLFMT_RGB,
+        isPaletted ? DM_PIXFMT_PALETTE : DM_PIXFMT_RGB,
         // XXX TODO? When/if we ever handle < 8bit indexed correctly, we can use the actual bpp
         // isPaletted ? (hdr.bitsPerPlane * hdr.nplanes) : -1
         -1
@@ -2356,7 +2356,7 @@
 
                 // Allocate image
                 if ((*pimg = dmImageAlloc(iff.bmhd.w, iff.bmhd.h,
-                    iff.bmhd.nplanes <= 8 ? DM_COLFMT_PALETTE : DM_COLFMT_RGBA,
+                    iff.bmhd.nplanes <= 8 ? DM_PIXFMT_PALETTE : DM_PIXFMT_RGBA,
                     // XXX TODO? When/if we ever handle < 8bit indexed correctly, we can use the actual bpp
                     //iff->bmhd.nplanes <= 8 ? iff->bmhd.nplanes : -1
                     -1
@@ -2412,7 +2412,7 @@
     }
 
     // Check if we should have a palette
-    if (*pimg != NULL && (*pimg)->format == DM_COLFMT_PALETTE)
+    if (*pimg != NULL && (*pimg)->pixfmt == DM_PIXFMT_PALETTE)
     {
         // Check that we DO have a palette ..
         if (iff.pal == NULL || iff.pal->ncolors == 0)
@@ -2638,8 +2638,8 @@
     int res = DMERR_OK;
 
     // XXX: Non-paletted IFF not supported!
-    if ((img->format != DM_COLFMT_PALETTE && img->format != DM_COLFMT_GRAYSCALE) ||
-        (spec->format != DM_COLFMT_PALETTE && spec->format != DM_COLFMT_GRAYSCALE))
+    if ((img->pixfmt != DM_PIXFMT_PALETTE && img->pixfmt != DM_PIXFMT_GRAYSCALE) ||
+        (spec->pixfmt != DM_PIXFMT_PALETTE && spec->pixfmt != DM_PIXFMT_GRAYSCALE))
     {
         return dmError(DMERR_NOT_SUPPORTED,
             "Non-paletted IFF is not supported.\n");
@@ -2719,7 +2719,7 @@
     //
     // CMAP
     //
-    if (spec->format == DM_COLFMT_PALETTE &&
+    if (spec->pixfmt == DM_PIXFMT_PALETTE &&
         img->pal != NULL &&
         img->pal->ncolors > 0)
     {
@@ -2881,48 +2881,48 @@
 #ifdef DM_USE_LIBPNG
     {
         "png", "Portable Network Graphics",
-        DM_IMGFMT_PNG, DM_FMT_RDWR | DM_COLFMT_ANY,
+        DM_IMGFMT_PNG, DM_FMT_RDWR | DM_PIXFMT_ANY,
         fmtProbePNG, dmReadPNGImage, dmWritePNGImage,
     },
 #endif
     {
         "ppm", "Portable PixMap",
-        DM_IMGFMT_PPM, DM_FMT_RDWR | DM_COLFMT_GRAYSCALE | DM_COLFMT_RGB,
+        DM_IMGFMT_PPM, DM_FMT_RDWR | DM_PIXFMT_GRAYSCALE | DM_PIXFMT_RGB,
         fmtProbePPM, dmReadPPMImage, dmWritePPMImage,
     },
     {
         "pcx", "Z-Soft Paintbrush",
-        DM_IMGFMT_PCX, DM_FMT_RDWR | DM_COLFMT_PALETTE | DM_COLFMT_RGB,
+        DM_IMGFMT_PCX, DM_FMT_RDWR | DM_PIXFMT_PALETTE | DM_PIXFMT_RGB,
         fmtProbePCX, dmReadPCXImage, dmWritePCXImage,
     },
     {
         "ilbm", "IFF ILBM (interleaved/old DP2)",
-        DM_IMGFMT_IFF_ILBM, DM_FMT_RDWR | DM_COLFMT_PALETTE,
+        DM_IMGFMT_IFF_ILBM, DM_FMT_RDWR | DM_PIXFMT_PALETTE,
         fmtProbeIFF_ILBM, dmReadIFFImage, dmWriteIFFImage,
     },
     {
         "pbm", "IFF PBM (DP2e)",
-        DM_IMGFMT_IFF_PBM, DM_FMT_RDWR | DM_COLFMT_PALETTE,
+        DM_IMGFMT_IFF_PBM, DM_FMT_RDWR | DM_PIXFMT_PALETTE,
         fmtProbeIFF_PBM, dmReadIFFImage, dmWriteIFFImage,
     },
     {
         "acbm", "IFF ACBM (Amiga Basic)",
-        DM_IMGFMT_IFF_ACBM, DM_FMT_RDWR | DM_COLFMT_PALETTE,
+        DM_IMGFMT_IFF_ACBM, DM_FMT_RDWR | DM_PIXFMT_PALETTE,
         fmtProbeIFF_ACBM, dmReadIFFImage, dmWriteIFFImage,
     },
     {
         "raw", "Plain bitplaned (planar or non-planar) RAW",
-        DM_IMGFMT_RAW, DM_FMT_WR | DM_COLFMT_PALETTE,
+        DM_IMGFMT_RAW, DM_FMT_WR | DM_PIXFMT_PALETTE,
         NULL, NULL, dmWriteRAWImage,
     },
     {
         "araw", "IFFMaster Amiga RAW",
-        DM_IMGFMT_ARAW, DM_FMT_WR | DM_COLFMT_PALETTE,
+        DM_IMGFMT_ARAW, DM_FMT_WR | DM_PIXFMT_PALETTE,
         NULL, NULL, dmWriteRAWImage,
     },
     {
         "cdump", "'C' dump (image data only)",
-        DM_IMGFMT_CDUMP, DM_FMT_WR | DM_COLFMT_ANY,
+        DM_IMGFMT_CDUMP, DM_FMT_WR | DM_PIXFMT_ANY,
         NULL, NULL, dmWriteCDumpImage,
     }
 };
--- a/tools/libgfx.h	Tue Jun 04 16:18:41 2019 +0300
+++ b/tools/libgfx.h	Tue Jun 04 16:27:09 2019 +0300
@@ -34,12 +34,12 @@
 // Color formats (these can be used along with DM_FMT_*)
 enum
 {
-    DM_COLFMT_PALETTE    = 0x0010,
-    DM_COLFMT_GRAYSCALE  = 0x0020,
-    DM_COLFMT_RGB        = 0x0040,
-    DM_COLFMT_RGBA       = 0x0080,
+    DM_PIXFMT_PALETTE    = 0x0010,
+    DM_PIXFMT_GRAYSCALE  = 0x0020,
+    DM_PIXFMT_RGB        = 0x0040,
+    DM_PIXFMT_RGBA       = 0x0080,
 
-    DM_COLFMT_ANY        = 0x00f0,
+    DM_PIXFMT_ANY        = 0x00f0,
 };
 
 
@@ -84,7 +84,7 @@
 // Bitmapped image struct
 typedef struct
 {
-    int format;     // one of types specified by DM_COLFMT_*
+    int pixfmt;     // one of types specified by DM_PIXFMT_*
     int width, height;
     int pitch;      // bytes per scanline
     int bpp;        // bits per pixel
@@ -102,7 +102,7 @@
 typedef struct
 {
     int  fmtid;               // DM_IMGFMT_* of target format (a bit of a kludge here)
-    int  format;              // Target color format DM_COLFMT_*
+    int  pixfmt;              // Target color format DM_PIXFMT_*
     int  scaleX, scaleY;      // Integer scale factors (1..)
 
     int  nplanes, bpp, mask;  // number of planes, bits per PLANE, masking
@@ -116,7 +116,7 @@
     char *fext;
     char *name;
     int  fmtid;  // DM_IMGFMT_*
-    int  flags;  // DM_FMT_* and DM_COLFMT_* flags
+    int  flags;  // DM_FMT_* and DM_PIXFMT_* flags
     int  (*probe)(const Uint8 *buf, const size_t len);
     int  (*read)(DMResource *fp, DMImage **pimg);
     int  (*write)(DMResource *fp, const DMImage *pimg, const DMImageWriteSpec *spec);