Mercurial > hg > dmlib
changeset 2095:80786a28caf0
Mark image format flags with the color formats they support.
This information is not yet used.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 05 Mar 2019 09:57:32 +0200 |
parents | 4276b8c0fef0 |
children | 6b2bac1e3445 |
files | tools/libgfx.c tools/libgfx.h |
diffstat | 2 files changed, 17 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/libgfx.c Tue Mar 05 09:56:47 2019 +0200 +++ b/tools/libgfx.c Tue Mar 05 09:57:32 2019 +0200 @@ -2745,48 +2745,48 @@ #ifdef DM_USE_LIBPNG { "png", "Portable Network Graphics", - DM_IMGFMT_PNG, DM_FMT_RDWR, + DM_IMGFMT_PNG, DM_FMT_RDWR | DM_COLFMT_ANY, fmtProbePNG, dmReadPNGImage, dmWritePNGImage, }, #endif { "ppm", "Portable PixMap", - DM_IMGFMT_PPM, DM_FMT_RDWR, + DM_IMGFMT_PPM, DM_FMT_RDWR | DM_COLFMT_GRAYSCALE | DM_COLFMT_RGB, fmtProbePPM, dmReadPPMImage, dmWritePPMImage, }, { "pcx", "Z-Soft Paintbrush", - DM_IMGFMT_PCX, DM_FMT_RDWR, + DM_IMGFMT_PCX, DM_FMT_RDWR | DM_COLFMT_PALETTE | DM_COLFMT_RGB, fmtProbePCX, dmReadPCXImage, dmWritePCXImage, }, { "ilbm", "IFF ILBM (interleaved/old DP2)", - DM_IMGFMT_IFF_ILBM, DM_FMT_RDWR, + DM_IMGFMT_IFF_ILBM, DM_FMT_RDWR | DM_COLFMT_PALETTE, fmtProbeIFF_ILBM, dmReadIFFImage, dmWriteIFFImage, }, { "pbm", "IFF PBM (DP2e)", - DM_IMGFMT_IFF_PBM, DM_FMT_RDWR, + DM_IMGFMT_IFF_PBM, DM_FMT_RDWR | DM_COLFMT_PALETTE, fmtProbeIFF_PBM, dmReadIFFImage, dmWriteIFFImage, }, { "acbm", "IFF ACBM (Amiga Basic)", - DM_IMGFMT_IFF_ACBM, DM_FMT_RDWR, + DM_IMGFMT_IFF_ACBM, DM_FMT_RDWR | DM_COLFMT_PALETTE, fmtProbeIFF_ACBM, dmReadIFFImage, dmWriteIFFImage, }, { "raw", "Plain bitplaned (planar or non-planar) RAW", - DM_IMGFMT_RAW, DM_FMT_WR, + DM_IMGFMT_RAW, DM_FMT_WR | DM_COLFMT_PALETTE, NULL, NULL, dmWriteRAWImage, }, { "araw", "IFFMaster Amiga RAW", - DM_IMGFMT_ARAW, DM_FMT_WR, + DM_IMGFMT_ARAW, DM_FMT_WR | DM_COLFMT_PALETTE, NULL, NULL, dmWriteRAWImage, }, { "cdump", "'C' dump (image data only)", - DM_IMGFMT_CDUMP, DM_FMT_WR, + DM_IMGFMT_CDUMP, DM_FMT_WR | DM_COLFMT_ANY, NULL, NULL, dmWriteCDumpImage, } };
--- a/tools/libgfx.h Tue Mar 05 09:56:47 2019 +0200 +++ b/tools/libgfx.h Tue Mar 05 09:57:32 2019 +0200 @@ -31,12 +31,15 @@ }; +// Color formats (these can be used along with DM_FMT_*) enum { - DM_COLFMT_PALETTE, - DM_COLFMT_GRAYSCALE, - DM_COLFMT_RGB, - DM_COLFMT_RGBA, + DM_COLFMT_PALETTE = 0x0010, + DM_COLFMT_GRAYSCALE = 0x0020, + DM_COLFMT_RGB = 0x0040, + DM_COLFMT_RGBA = 0x0080, + + DM_COLFMT_ANY = 0x00f0, }; @@ -112,7 +115,7 @@ char *fext; char *name; int fmtid; // DM_IMGFMT_* - int flags; // DM_FMT_* flags + int flags; // DM_FMT_* and DM_COLFMT_* flags int (*probe)(const Uint8 *buf, const size_t len); int (*read)(DMResource *fp, DMImage **pimg); int (*write)(DMResource *fp, const DMImage *pimg, const DMImageConvSpec *spec);