Mercurial > hg > dmlib
comparison tools/lib64gfx.h @ 1505:3265175b24d2
Change the passing of RLE compression/decompression parameters to be in a dedicated struct.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 11 May 2018 20:18:14 +0300 |
parents | c7b9ef56319b |
children | 776aa43b2c57 |
comparison
equal
deleted
inserted
replaced
1504:15c77c6fbb5e | 1505:3265175b24d2 |
---|---|
49 #define C64_VIDBANK_SIZE (16*1024) | 49 #define C64_VIDBANK_SIZE (16*1024) |
50 #define C64_MAX_SPRITES (C64_VIDBANK_SIZE / C64_SPR_SIZE) | 50 #define C64_MAX_SPRITES (C64_VIDBANK_SIZE / C64_SPR_SIZE) |
51 #define C64_MAX_CHARS 256 | 51 #define C64_MAX_CHARS 256 |
52 | 52 |
53 | 53 |
54 #define DM_RLE_MARKER 1 | |
55 #define DM_RLE_MASK 2 | |
56 | |
57 | |
58 #define DM_GET_ADDR_LO(addr) ((addr) & 0xff) | 54 #define DM_GET_ADDR_LO(addr) ((addr) & 0xff) |
59 #define DM_GET_ADDR_HI(addr) (((addr) >> 8) & 0xff) | 55 #define DM_GET_ADDR_HI(addr) (((addr) >> 8) & 0xff) |
60 | 56 |
61 | 57 |
62 // Different supported C64 bitmap "modes" | 58 // Different supported C64 bitmap "modes" |
155 DT_CHAR_CONFIG, | 151 DT_CHAR_CONFIG, |
156 | 152 |
157 DT_LAST, | 153 DT_LAST, |
158 }; | 154 }; |
159 | 155 |
156 | |
160 #define D64_MAX_ENCDEC_OPS 64 | 157 #define D64_MAX_ENCDEC_OPS 64 |
158 | |
161 | 159 |
162 typedef struct _DMC64ImageFormat DMC64ImageFormat; | 160 typedef struct _DMC64ImageFormat DMC64ImageFormat; |
163 | 161 |
164 typedef struct _DMC64EncDecOp | 162 typedef struct _DMC64EncDecOp |
165 { | 163 { |
196 | 194 |
197 DMC64EncDecOp encdecOps[D64_MAX_ENCDEC_OPS]; | 195 DMC64EncDecOp encdecOps[D64_MAX_ENCDEC_OPS]; |
198 } DMC64ImageFormat; | 196 } DMC64ImageFormat; |
199 | 197 |
200 | 198 |
199 #define DM_COMP_RLE_MARKER 1 | |
200 #define DM_COMP_RLE_MASK 2 | |
201 | |
202 | |
203 typedef struct | |
204 { | |
205 int type; | |
206 Uint8 rleMarker, rleMask1, rleMask2, rleMinCount, rleMaxCount; | |
207 } DMCompParams; | |
208 | |
209 | |
201 // | 210 // |
202 // Global variables | 211 // Global variables |
203 // | 212 // |
204 extern DMColor dmDefaultC64Palette[C64_NCOLORS]; | 213 extern DMColor dmDefaultC64Palette[C64_NCOLORS]; |
205 extern const DMC64ImageFormat dmC64ImageFormats[]; | 214 extern const DMC64ImageFormat dmC64ImageFormats[]; |
235 int dmC64EncodeBMP(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt); | 244 int dmC64EncodeBMP(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt); |
236 | 245 |
237 int dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageFormat *fmt); | 246 int dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageFormat *fmt); |
238 int dmC64ConvertGenericImage2BMP(DMC64Image *dst, const DMImage *src, const DMC64ImageFormat *fmt); | 247 int dmC64ConvertGenericImage2BMP(DMC64Image *dst, const DMImage *src, const DMC64ImageFormat *fmt); |
239 | 248 |
240 void dmGenericRLEAnalyze(const DMGrowBuf *buf, Uint8 *rleMarker, const int rleType); | 249 void dmGenericRLEAnalyze(const DMGrowBuf *buf, Uint8 *rleMarker, const int rleType); |
241 | 250 |
242 int dmDecodeGenericRLE(DMGrowBuf *dst, const Uint8 *src, const Uint8 *srcEnd, | 251 int dmDecodeGenericRLE(DMGrowBuf *dst, const Uint8 *src, const Uint8 *srcEnd, const DMCompParams *cfg); |
243 const Uint8 rleMarker, const Uint8 rleMask1, const Uint8 rleMask2, const int rleType); | 252 int dmDecodeGenericRLEAlloc(DMGrowBuf *dst, const Uint8 *src, const Uint8 *srcEnd, const DMCompParams *cfg); |
244 int dmDecodeGenericRLEAlloc(DMGrowBuf *dst, const Uint8 *src, const Uint8 *srcEnd, | 253 |
245 const Uint8 rleMarker, const Uint8 rleMask1, const Uint8 rleMask2, const int rleType); | 254 int dmEncodeGenericRLE(DMGrowBuf *dst, const Uint8 *src, const Uint8 *srcEnd, const DMCompParams *cfg); |
246 | 255 int dmEncodeGenericRLEAlloc(DMGrowBuf *dst, const Uint8 *src, const Uint8 *srcEnd, const DMCompParams *cfg); |
247 int dmEncodeGenericRLE(DMGrowBuf *dst, const Uint8 *src, const Uint8 *srcEnd, | |
248 const Uint8 rleMarker, const Uint8 rleMinCount, const Uint8 rleMaxCount, const int rleType); | |
249 int dmEncodeGenericRLEAlloc(DMGrowBuf *dst, const Uint8 *src, const Uint8 *srcEnd, | |
250 const Uint8 rleMarker, const Uint8 rleMinCount, const Uint8 rleMaxCount, const int rleType); | |
251 | 256 |
252 | 257 |
253 // | 258 // |
254 // Inline helper functions for pixel format decoding | 259 // Inline helper functions for pixel format decoding |
255 // | 260 // |