Mercurial > hg > dmlib
comparison lib64gfx.h @ 410:e4b2f689aff6
Stdint -> SDL types conversion.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 03 Nov 2012 02:41:15 +0200 |
parents | 59244a7ae37f |
children | b6a1dc3bd2c3 |
comparison
equal
deleted
inserted
replaced
409:b529b7e8ff83 | 410:e4b2f689aff6 |
---|---|
61 | 61 |
62 | 62 |
63 // RGBx color struct | 63 // RGBx color struct |
64 typedef struct | 64 typedef struct |
65 { | 65 { |
66 uint8_t r, g, b, x; | 66 Uint8 r, g, b, x; |
67 } DMColor; | 67 } DMColor; |
68 | 68 |
69 | 69 |
70 // Bitmapped image struct (can be one of types specified by DM_IFMT_*) | 70 // Bitmapped image struct (can be one of types specified by DM_IFMT_*) |
71 typedef struct | 71 typedef struct |
72 { | 72 { |
73 int width, height, pitch; | 73 int width, height, pitch; |
74 BOOL constpal; | 74 BOOL constpal; |
75 int ncolors, ctrans; | 75 int ncolors, ctrans; |
76 DMColor *pal; | 76 DMColor *pal; |
77 uint8_t *data; | 77 Uint8 *data; |
78 } DMImage; | 78 } DMImage; |
79 | 79 |
80 | 80 |
81 // Different supported C64 bitmap "modes" | 81 // Different supported C64 bitmap "modes" |
82 enum | 82 enum |
100 | 100 |
101 typedef struct | 101 typedef struct |
102 { | 102 { |
103 BOOL multicolor, xexpand, yexpand; | 103 BOOL multicolor, xexpand, yexpand; |
104 int color, xc, yc; | 104 int color, xc, yc; |
105 uint8_t data[C64_SPR_HEIGHT][C64_SPR_WIDTH]; | 105 Uint8 data[C64_SPR_HEIGHT][C64_SPR_WIDTH]; |
106 } DMC64Sprite; | 106 } DMC64Sprite; |
107 | 107 |
108 | 108 |
109 typedef struct | 109 typedef struct |
110 { | 110 { |
112 laceType, // Interlace type (DM_C64ILACE_*) | 112 laceType, // Interlace type (DM_C64ILACE_*) |
113 fliType, // FLI type (if FLI used) | 113 fliType, // FLI type (if FLI used) |
114 fliLines, // FLI on every # line | 114 fliLines, // FLI on every # line |
115 laceBank2; | 115 laceBank2; |
116 | 116 |
117 uint8_t color[C64_SCR_MAX_BANK][C64_SCR_COLOR_SIZE], | 117 Uint8 color[C64_SCR_MAX_BANK][C64_SCR_COLOR_SIZE], |
118 bitmap[C64_SCR_MAX_BANK][C64_SCR_BITMAP_SIZE], | 118 bitmap[C64_SCR_MAX_BANK][C64_SCR_BITMAP_SIZE], |
119 screen[C64_SCR_MAX_BANK][C64_SCR_SCREEN_SIZE], | 119 screen[C64_SCR_MAX_BANK][C64_SCR_SCREEN_SIZE], |
120 extradata[C64_SCR_EXTRADATA], | 120 extradata[C64_SCR_EXTRADATA], |
121 d020, bgcolor, d022, d023, d024; | 121 d020, bgcolor, d022, d023, d024; |
122 | 122 |
123 uint8_t charset[C64_MAX_CHARS][C64_CHR_HEIGHT * C64_CHR_WIDTH]; | 123 Uint8 charset[C64_MAX_CHARS][C64_CHR_HEIGHT * C64_CHR_WIDTH]; |
124 DMC64Sprite sprites[C64_MAX_SPRITES]; | 124 DMC64Sprite sprites[C64_MAX_SPRITES]; |
125 } DMC64Image; | 125 } DMC64Image; |
126 | 126 |
127 | 127 |
128 enum | 128 enum |
143 { | 143 { |
144 int type; | 144 int type; |
145 size_t offs; | 145 size_t offs; |
146 int bank; | 146 int bank; |
147 size_t size; | 147 size_t size; |
148 BOOL (*function)(DMC64Image *img, const struct _DMDecodeOp *op, const uint8_t *buf, const size_t len); | 148 BOOL (*function)(DMC64Image *img, const struct _DMDecodeOp *op, const Uint8 *buf, const size_t len); |
149 } DMDecodeOp; | 149 } DMDecodeOp; |
150 | 150 |
151 | 151 |
152 typedef struct _DMC64ImageFormat | 152 typedef struct _DMC64ImageFormat |
153 { | 153 { |
154 int type; | 154 int type; |
155 char *extension; | 155 char *extension; |
156 char *name; | 156 char *name; |
157 int (*probe)(const uint8_t *buf, const size_t len); | 157 int (*probe)(const Uint8 *buf, const size_t len); |
158 int (*decode)(DMC64Image *img, const uint8_t *buf, const size_t len, const struct _DMC64ImageFormat *fmt); | 158 int (*decode)(DMC64Image *img, const Uint8 *buf, const size_t len, const struct _DMC64ImageFormat *fmt); |
159 int (*convert)(DMImage *, DMC64Image *); | 159 int (*convert)(DMImage *, DMC64Image *); |
160 | 160 |
161 int ndecodeOps; | 161 int ndecodeOps; |
162 DMDecodeOp decodeOps[16]; | 162 DMDecodeOp decodeOps[16]; |
163 } DMC64ImageFormat; | 163 } DMC64ImageFormat; |
173 DMImage * dmImageAlloc(int width, int height); | 173 DMImage * dmImageAlloc(int width, int height); |
174 void dmImageFree(DMImage *img); | 174 void dmImageFree(DMImage *img); |
175 int dmImageGetBytesPerPixel(int format); | 175 int dmImageGetBytesPerPixel(int format); |
176 | 176 |
177 | 177 |
178 int dmC64ConvertCSData(DMImage *img, int xoffs, int yoffs, const uint8_t *inBuf, int width, int height, BOOL multicolor, int *colors); | 178 int dmC64ConvertCSData(DMImage *img, int xoffs, int yoffs, const Uint8 *inBuf, int width, int height, BOOL multicolor, int *colors); |
179 int dmC64ProbeGeneric(const uint8_t *buf, const size_t len, DMC64ImageFormat **fmt); | 179 int dmC64ProbeGeneric(const Uint8 *buf, const size_t len, DMC64ImageFormat **fmt); |
180 int dmC64DecodeGenericBMP(DMC64Image *img, const uint8_t *buf, const size_t len, const DMC64ImageFormat *fmt); | 180 int dmC64DecodeGenericBMP(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt); |
181 int dmC64ConvertGenericBMP2Image(DMImage *screen, const DMC64Image *img); | 181 int dmC64ConvertGenericBMP2Image(DMImage *screen, const DMC64Image *img); |
182 int dmReadDataFile(const char *filename, uint8_t **buf, size_t *size); | 182 int dmReadDataFile(const char *filename, Uint8 **buf, size_t *size); |
183 | 183 |
184 #endif // LIB64GFX_H | 184 #endif // LIB64GFX_H |