comparison 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
comparison
equal deleted inserted replaced
1285:e4bda4909d72 1286:b812fad6f33e
44 DM_ERRMODE_RECOV_1, 44 DM_ERRMODE_RECOV_1,
45 DM_ERRMODE_RECOV_2, 45 DM_ERRMODE_RECOV_2,
46 }; 46 };
47 47
48 48
49 // Bitmapped image struct (can be one of types specified by DM_IFMT_*) 49 // Bitmapped image struct
50 typedef struct 50 typedef struct
51 { 51 {
52 int width, height, pitch; 52 int format; // one of types specified by DM_IFMT_*
53 BOOL constpal; 53 int width, height;
54 int ncolors, ctransp; 54 int pitch; // bytes per scanline
55 DMColor *pal; 55 int bpp; // bits per pixel
56
57 int ncolors; // number of colors in palette, if any
58 int ctransp; // transparency color index
59 BOOL constpal; // is the palette a const?
60 DMColor *pal; // pointer to palette struct, NULL if no palette
61
56 size_t size; 62 size_t size;
57 Uint8 *data; 63 Uint8 *data;
58 } DMImage; 64 } DMImage;
59 65
60 66
87 93
88 extern DMImageFormat dmImageFormatList[IMGFMT_LAST]; 94 extern DMImageFormat dmImageFormatList[IMGFMT_LAST];
89 extern int dmGFXErrorMode; 95 extern int dmGFXErrorMode;
90 96
91 97
92 DMImage * dmImageAlloc(int width, int height); 98 DMImage * dmImageAlloc(const int width, const int height, const int format, const int bpp);
93 void dmImageFree(DMImage *img); 99 void dmImageFree(DMImage *img);
94 int dmImageGetBytesPerPixel(int format); 100 int dmImageGetBytesPerPixel(const int format);
95 int dmImageProbeGeneric(const Uint8 *buf, const size_t len, DMImageFormat **fmt, int *index); 101 int dmImageProbeGeneric(const Uint8 *buf, const size_t len, DMImageFormat **fmt, int *index);
96 102
97 BOOL dmCompareColor(const DMColor *c1, const DMColor *c2, BOOL alpha); 103 BOOL dmCompareColor(const DMColor *c1, const DMColor *c2, BOOL alpha);
98 104
99 105