Mercurial > hg > dmlib
comparison tools/lib64fmts.c @ 2265:48b48251610a
Refactor how the image "mode/type" is handled. It is still not perfect for
our purposes, but better now.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 17 Jun 2019 02:03:35 +0300 |
parents | 5db6e0b63b35 |
children | 631bbd451d08 |
comparison
equal
deleted
inserted
replaced
2264:e25fa516b53a | 2265:48b48251610a |
---|---|
102 case 23: img->extraInfo[D64_EI_CHAR_CASE] = 1; break; // lower case | 102 case 23: img->extraInfo[D64_EI_CHAR_CASE] = 1; break; // lower case |
103 default: | 103 default: |
104 return DMERR_INVALID_DATA; | 104 return DMERR_INVALID_DATA; |
105 } | 105 } |
106 | 106 |
107 img->extraInfo[D64_EI_CHAR_MODE] = D64_FMT_HIRES; | 107 img->extraInfo[D64_EI_MODE] = D64_FMT_HIRES | D64_FMT_CHAR; |
108 img->extraInfo[D64_EI_CHAR_CUSTOM] = 0; | 108 img->extraInfo[D64_EI_CHAR_CUSTOM] = 0; |
109 | 109 |
110 return DMERR_OK; | 110 return DMERR_OK; |
111 } | 111 } |
112 | 112 |
146 | 146 |
147 const Uint8 *data = img->extraData[0].data; | 147 const Uint8 *data = img->extraData[0].data; |
148 switch (data[0x0028 - 2]) | 148 switch (data[0x0028 - 2]) |
149 { | 149 { |
150 case 0x00: | 150 case 0x00: |
151 img->extraInfo[D64_EI_CHAR_MODE] = D64_FMT_HIRES; | 151 img->extraInfo[D64_EI_MODE] = D64_FMT_HIRES | D64_FMT_CHAR; |
152 img->d020 = data[0x001e - 2]; | 152 img->d020 = data[0x001e - 2]; |
153 img->bgcolor = data[0x0023 - 2]; | 153 img->bgcolor = data[0x0023 - 2]; |
154 break; | 154 break; |
155 | 155 |
156 case 0xd8: | 156 case 0xd8: |
157 img->extraInfo[D64_EI_CHAR_MODE] = D64_FMT_MC; | 157 img->extraInfo[D64_EI_MODE] = D64_FMT_MC | D64_FMT_CHAR; |
158 img->d020 = data[0x001e - 2]; | 158 img->d020 = data[0x001e - 2]; |
159 img->bgcolor = data[0x0023 - 2]; | 159 img->bgcolor = data[0x0023 - 2]; |
160 img->d022 = data[0x002d - 2]; | 160 img->d022 = data[0x002d - 2]; |
161 img->d023 = data[0x0032 - 2]; | 161 img->d023 = data[0x0032 - 2]; |
162 break; | 162 break; |
163 | 163 |
164 case 0x01: | 164 case 0x01: |
165 img->extraInfo[D64_EI_CHAR_MODE] = D64_FMT_ECM; | 165 img->extraInfo[D64_EI_MODE] = D64_FMT_ECM | D64_FMT_CHAR; |
166 img->d020 = data[0x001e - 2]; | 166 img->d020 = data[0x001e - 2]; |
167 img->bgcolor = data[0x0023 - 2]; | 167 img->bgcolor = data[0x0023 - 2]; |
168 img->d022 = data[0x0028 - 2]; | 168 img->d022 = data[0x0028 - 2]; |
169 img->d023 = data[0x002d - 2]; | 169 img->d023 = data[0x002d - 2]; |
170 img->d024 = data[0x0032 - 2]; | 170 img->d024 = data[0x0032 - 2]; |
190 { | 190 { |
191 (void) op; | 191 (void) op; |
192 (void) buf; | 192 (void) buf; |
193 (void) fmt; | 193 (void) fmt; |
194 | 194 |
195 img->extraInfo[D64_EI_CHAR_MODE] = D64_FMT_HIRES; | 195 img->extraInfo[D64_EI_MODE] = D64_FMT_HIRES | D64_FMT_CHAR; |
196 img->extraInfo[D64_EI_CHAR_CUSTOM] = 0; | 196 img->extraInfo[D64_EI_CHAR_CUSTOM] = 0; |
197 | 197 |
198 return DMERR_OK; | 198 return DMERR_OK; |
199 } | 199 } |
200 | 200 |
345 static int fmtEncodeDrazPaintPacked(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt) | 345 static int fmtEncodeDrazPaintPacked(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt) |
346 { | 346 { |
347 int res; | 347 int res; |
348 DMGrowBuf tmp; | 348 DMGrowBuf tmp; |
349 DMCompParams cfg; | 349 DMCompParams cfg; |
350 const char *magicID = (fmt->format->type & D64_FMT_ILACE) ? "DRAZLACE! 1.0" : "DRAZPAINT 2.0"; | 350 const char *magicID = (fmt->format->mode & D64_FMT_ILACE) ? "DRAZLACE! 1.0" : "DRAZPAINT 2.0"; |
351 | 351 |
352 // Encode the data to temp buffer | 352 // Encode the data to temp buffer |
353 if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK) | 353 if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK) |
354 goto out; | 354 goto out; |
355 | 355 |