Mercurial > hg > dmlib
diff src/libgfx.h @ 1286:b812fad6f33e
Work on libgfx.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 18 Aug 2017 15:20:44 +0300 |
parents | e4bda4909d72 |
children | 6c8b19d1d196 |
line wrap: on
line diff
--- a/src/libgfx.h Fri Aug 18 14:08:08 2017 +0300 +++ b/src/libgfx.h Fri Aug 18 15:20:44 2017 +0300 @@ -46,13 +46,19 @@ }; -// Bitmapped image struct (can be one of types specified by DM_IFMT_*) +// Bitmapped image struct typedef struct { - int width, height, pitch; - BOOL constpal; - int ncolors, ctransp; - DMColor *pal; + int format; // one of types specified by DM_IFMT_* + int width, height; + int pitch; // bytes per scanline + int bpp; // bits per pixel + + int ncolors; // number of colors in palette, if any + int ctransp; // transparency color index + BOOL constpal; // is the palette a const? + DMColor *pal; // pointer to palette struct, NULL if no palette + size_t size; Uint8 *data; } DMImage; @@ -89,9 +95,9 @@ extern int dmGFXErrorMode; -DMImage * dmImageAlloc(int width, int height); +DMImage * dmImageAlloc(const int width, const int height, const int format, const int bpp); void dmImageFree(DMImage *img); -int dmImageGetBytesPerPixel(int format); +int dmImageGetBytesPerPixel(const int format); int dmImageProbeGeneric(const Uint8 *buf, const size_t len, DMImageFormat **fmt, int *index); BOOL dmCompareColor(const DMColor *c1, const DMColor *c2, BOOL alpha);