1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** GUIX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** Image Reader Management (Image Reader) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_system.h" |
29 |
|
|
#include "gx_utility.h" |
30 |
|
|
#include "gx_image_reader.h" |
31 |
|
|
|
32 |
|
|
#if defined(GX_SOFTWARE_DECODER_SUPPORT) |
33 |
|
|
|
34 |
|
|
extern VOID _gx_image_reader_rgb2gray(GX_PIXEL *pixel, GX_UBYTE *gray); |
35 |
|
|
/**************************************************************************/ |
36 |
|
|
/* */ |
37 |
|
|
/* FUNCTION RELEASE */ |
38 |
|
|
/* */ |
39 |
|
|
/* _gx_image_reader_8bit_alpha_write PORTABLE C */ |
40 |
|
|
/* 6.1 */ |
41 |
|
|
/* AUTHOR */ |
42 |
|
|
/* */ |
43 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
44 |
|
|
/* */ |
45 |
|
|
/* DESCRIPTION */ |
46 |
|
|
/* */ |
47 |
|
|
/* This function writes a pixel to output pixemap data structure. */ |
48 |
|
|
/* */ |
49 |
|
|
/* INPUT */ |
50 |
|
|
/* */ |
51 |
|
|
/* image_reader Image reader control block. */ |
52 |
|
|
/* pixel Pixel to write. */ |
53 |
|
|
/* */ |
54 |
|
|
/* OUTPUT */ |
55 |
|
|
/* */ |
56 |
|
|
/* Completion Status */ |
57 |
|
|
/* */ |
58 |
|
|
/* CALLS */ |
59 |
|
|
/* */ |
60 |
|
|
/* None */ |
61 |
|
|
/* */ |
62 |
|
|
/* CALLED BY */ |
63 |
|
|
/* */ |
64 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
65 |
|
|
/* */ |
66 |
|
|
/**************************************************************************/ |
67 |
|
6502078 |
static UINT _gx_image_reader_8bit_alpha_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
68 |
|
|
{ |
69 |
|
|
GX_UBYTE *palpha; |
70 |
|
|
|
71 |
✓✓ |
6502078 |
if (!image_reader -> gx_image_reader_size_testing) |
72 |
|
|
{ |
73 |
|
6423506 |
palpha = (GX_UBYTE *)image_reader -> gx_image_reader_putdata; |
74 |
|
|
|
75 |
|
6423506 |
*palpha = pixel -> gx_pixel_alpha; |
76 |
|
|
} |
77 |
|
|
|
78 |
|
6502078 |
image_reader -> gx_image_reader_putdata += 1; |
79 |
|
|
|
80 |
|
6502078 |
return GX_SUCCESS; |
81 |
|
|
} |
82 |
|
|
|
83 |
|
|
/**************************************************************************/ |
84 |
|
|
/* */ |
85 |
|
|
/* FUNCTION RELEASE */ |
86 |
|
|
/* */ |
87 |
|
|
/* _gx_image_reader_8bit_palette_write PORTABLE C */ |
88 |
|
|
/* 6.1 */ |
89 |
|
|
/* AUTHOR */ |
90 |
|
|
/* */ |
91 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
92 |
|
|
/* */ |
93 |
|
|
/* DESCRIPTION */ |
94 |
|
|
/* */ |
95 |
|
|
/* This function writes a palette index to output pixemap data */ |
96 |
|
|
/* structure. */ |
97 |
|
|
/* */ |
98 |
|
|
/* INPUT */ |
99 |
|
|
/* */ |
100 |
|
|
/* image_reader Image reader control block. */ |
101 |
|
|
/* pixel Pixel to write. */ |
102 |
|
|
/* */ |
103 |
|
|
/* OUTPUT */ |
104 |
|
|
/* */ |
105 |
|
|
/* None */ |
106 |
|
|
/* */ |
107 |
|
|
/* CALLS */ |
108 |
|
|
/* */ |
109 |
|
|
/* None */ |
110 |
|
|
/* */ |
111 |
|
|
/* CALLED BY */ |
112 |
|
|
/* */ |
113 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
114 |
|
|
/* */ |
115 |
|
|
/**************************************************************************/ |
116 |
|
4670178 |
static UINT _gx_image_reader_8bit_palette_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
117 |
|
|
{ |
118 |
|
|
GX_UBYTE *pLine; |
119 |
|
|
INT palindex; |
120 |
|
|
|
121 |
✓✓ |
4670178 |
if (!image_reader -> gx_image_reader_size_testing) |
122 |
|
|
{ |
123 |
|
3805479 |
pLine = (GX_UBYTE *)image_reader -> gx_image_reader_putdata; |
124 |
|
|
|
125 |
✓✓✓✓
|
3805479 |
if ((image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ALPHA) && (pixel -> gx_pixel_alpha < 128)) |
126 |
|
|
{ |
127 |
|
130195 |
*pLine = GX_TRANSPARENT_COLOR; |
128 |
|
|
} |
129 |
|
|
else |
130 |
|
|
{ |
131 |
|
|
/* Find the palette color that is nearest to the wanted color. */ |
132 |
|
3675284 |
_gx_image_reader_nearest_palette_color_get(image_reader, pixel, &palindex); |
133 |
|
|
|
134 |
|
3675284 |
*pLine = (GX_UBYTE)palindex; |
135 |
|
|
} |
136 |
|
|
} |
137 |
|
|
|
138 |
|
4670178 |
image_reader -> gx_image_reader_putdata += 1; |
139 |
|
|
|
140 |
|
4670178 |
return GX_SUCCESS; |
141 |
|
|
} |
142 |
|
|
|
143 |
|
|
/**************************************************************************/ |
144 |
|
|
/* */ |
145 |
|
|
/* FUNCTION RELEASE */ |
146 |
|
|
/* */ |
147 |
|
|
/* _gx_image_reader_24xrgb_pixel_write PORTABLE C */ |
148 |
|
|
/* 6.1 */ |
149 |
|
|
/* AUTHOR */ |
150 |
|
|
/* */ |
151 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
152 |
|
|
/* */ |
153 |
|
|
/* DESCRIPTION */ |
154 |
|
|
/* */ |
155 |
|
|
/* This function writes a pixel to output pixelmap data structure. */ |
156 |
|
|
/* */ |
157 |
|
|
/* INPUT */ |
158 |
|
|
/* */ |
159 |
|
|
/* image_reader Image reader control block. */ |
160 |
|
|
/* pixel Pixel to write. */ |
161 |
|
|
/* */ |
162 |
|
|
/* OUTPUT */ |
163 |
|
|
/* */ |
164 |
|
|
/* Completion Status */ |
165 |
|
|
/* */ |
166 |
|
|
/* CALLS */ |
167 |
|
|
/* */ |
168 |
|
|
/* None */ |
169 |
|
|
/* */ |
170 |
|
|
/* CALLED BY */ |
171 |
|
|
/* */ |
172 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
173 |
|
|
/* */ |
174 |
|
|
/**************************************************************************/ |
175 |
|
1394370 |
static UINT _gx_image_reader_24xrgb_pixel_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
176 |
|
|
{ |
177 |
|
|
GX_COLOR *pLine; |
178 |
|
|
|
179 |
✓✓ |
1394370 |
if (!image_reader -> gx_image_reader_size_testing) |
180 |
|
|
{ |
181 |
|
818726 |
pLine = (GX_COLOR *)image_reader -> gx_image_reader_putdata; |
182 |
|
|
|
183 |
|
818726 |
(*pLine) = (GX_COLOR)((pixel -> gx_pixel_red << 16)); |
184 |
|
818726 |
(*pLine) = (GX_COLOR)((*pLine) | ((ULONG)(pixel -> gx_pixel_green) << 8)); |
185 |
|
818726 |
(*pLine) = (GX_COLOR)((*pLine) | pixel -> gx_pixel_blue); |
186 |
|
818726 |
(*pLine) = (GX_COLOR)((*pLine) | 0xff000000); |
187 |
|
|
} |
188 |
|
|
|
189 |
|
1394370 |
image_reader -> gx_image_reader_putdata += 4; |
190 |
|
|
|
191 |
|
1394370 |
return GX_SUCCESS; |
192 |
|
|
} |
193 |
|
|
|
194 |
|
|
/**************************************************************************/ |
195 |
|
|
/* */ |
196 |
|
|
/* FUNCTION RELEASE */ |
197 |
|
|
/* */ |
198 |
|
|
/* _gx_image_reader_24xrgb_rotated_pixel_write PORTABLE C */ |
199 |
|
|
/* 6.1.4 */ |
200 |
|
|
/* AUTHOR */ |
201 |
|
|
/* */ |
202 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
203 |
|
|
/* */ |
204 |
|
|
/* DESCRIPTION */ |
205 |
|
|
/* */ |
206 |
|
|
/* This function writes a pixel to output rotated pixelmap data */ |
207 |
|
|
/* structure. */ |
208 |
|
|
/* */ |
209 |
|
|
/* INPUT */ |
210 |
|
|
/* */ |
211 |
|
|
/* image_reader Image reader control block. */ |
212 |
|
|
/* pixel Pixel to write. */ |
213 |
|
|
/* */ |
214 |
|
|
/* OUTPUT */ |
215 |
|
|
/* */ |
216 |
|
|
/* Completion Status */ |
217 |
|
|
/* */ |
218 |
|
|
/* CALLS */ |
219 |
|
|
/* */ |
220 |
|
|
/* None */ |
221 |
|
|
/* */ |
222 |
|
|
/* CALLED BY */ |
223 |
|
|
/* */ |
224 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
225 |
|
|
/* */ |
226 |
|
|
/**************************************************************************/ |
227 |
|
2970461 |
static UINT _gx_image_reader_24xrgb_rotated_pixel_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
228 |
|
|
{ |
229 |
|
|
GX_COLOR *pLine; |
230 |
|
|
|
231 |
✓✓ |
2970461 |
if (!image_reader -> gx_image_reader_size_testing) |
232 |
|
|
{ |
233 |
|
2933460 |
pLine = (GX_COLOR *)image_reader -> gx_image_reader_putdata; |
234 |
|
|
|
235 |
|
2933460 |
(*pLine) = (GX_COLOR)((pixel -> gx_pixel_red << 16)); |
236 |
|
2933460 |
(*pLine) = (GX_COLOR)((*pLine) | ((ULONG)(pixel -> gx_pixel_green) << 8)); |
237 |
|
2933460 |
(*pLine) = (GX_COLOR)((*pLine) | pixel -> gx_pixel_blue); |
238 |
|
2933460 |
(*pLine) = (GX_COLOR)((*pLine) | ((ULONG)(pixel -> gx_pixel_alpha) << 24)); |
239 |
|
|
} |
240 |
|
|
|
241 |
✓✓ |
2970461 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ROTATE_CW) |
242 |
|
|
{ |
243 |
|
2968841 |
image_reader -> gx_image_reader_putdata -= (image_reader -> gx_image_reader_image_height << 2); |
244 |
|
|
} |
245 |
|
|
else |
246 |
|
|
{ |
247 |
|
1620 |
image_reader -> gx_image_reader_putdata += (image_reader -> gx_image_reader_image_height << 2); |
248 |
|
|
} |
249 |
|
|
|
250 |
|
2970461 |
return GX_SUCCESS; |
251 |
|
|
} |
252 |
|
|
|
253 |
|
|
/**************************************************************************/ |
254 |
|
|
/* */ |
255 |
|
|
/* FUNCTION RELEASE */ |
256 |
|
|
/* */ |
257 |
|
|
/* _gx_image_reader_32argb_pixel_write PORTABLE C */ |
258 |
|
|
/* 6.1 */ |
259 |
|
|
/* AUTHOR */ |
260 |
|
|
/* */ |
261 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
262 |
|
|
/* */ |
263 |
|
|
/* DESCRIPTION */ |
264 |
|
|
/* */ |
265 |
|
|
/* This function writes a pixel to output pixelmap data structure. */ |
266 |
|
|
/* */ |
267 |
|
|
/* INPUT */ |
268 |
|
|
/* */ |
269 |
|
|
/* image_reader Image reader control block. */ |
270 |
|
|
/* pixel Pixel to write. */ |
271 |
|
|
/* */ |
272 |
|
|
/* OUTPUT */ |
273 |
|
|
/* */ |
274 |
|
|
/* Completion Status */ |
275 |
|
|
/* */ |
276 |
|
|
/* CALLS */ |
277 |
|
|
/* */ |
278 |
|
|
/* None */ |
279 |
|
|
/* */ |
280 |
|
|
/* CALLED BY */ |
281 |
|
|
/* */ |
282 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
283 |
|
|
/* */ |
284 |
|
|
/**************************************************************************/ |
285 |
|
928600 |
static UINT _gx_image_reader_32argb_pixel_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
286 |
|
|
{ |
287 |
|
|
GX_COLOR *pLine; |
288 |
|
|
|
289 |
✓✓ |
928600 |
if (!image_reader -> gx_image_reader_size_testing) |
290 |
|
|
{ |
291 |
|
745750 |
pLine = (GX_COLOR *)image_reader -> gx_image_reader_putdata; |
292 |
|
|
|
293 |
|
745750 |
(*pLine) = (GX_COLOR)(pixel -> gx_pixel_alpha << 24); |
294 |
|
745750 |
(*pLine) = (GX_COLOR)((*pLine) | ((ULONG)(pixel -> gx_pixel_red) << 16)); |
295 |
|
745750 |
(*pLine) = (GX_COLOR)((*pLine) | ((ULONG)(pixel -> gx_pixel_green) << 8)); |
296 |
|
745750 |
(*pLine) = (GX_COLOR)((*pLine) | pixel -> gx_pixel_blue); |
297 |
|
|
} |
298 |
|
|
|
299 |
|
928600 |
image_reader -> gx_image_reader_putdata += 4; |
300 |
|
|
|
301 |
|
928600 |
return GX_SUCCESS; |
302 |
|
|
} |
303 |
|
|
|
304 |
|
|
/**************************************************************************/ |
305 |
|
|
/* */ |
306 |
|
|
/* FUNCTION RELEASE */ |
307 |
|
|
/* */ |
308 |
|
|
/* _gx_image_reader_565rgb_rle_pixel_write PORTABLE C */ |
309 |
|
|
/* 6.1 */ |
310 |
|
|
/* AUTHOR */ |
311 |
|
|
/* */ |
312 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
313 |
|
|
/* */ |
314 |
|
|
/* DESCRIPTION */ |
315 |
|
|
/* */ |
316 |
|
|
/* This function writes a pixel to output pixemap data structure. */ |
317 |
|
|
/* */ |
318 |
|
|
/* INPUT */ |
319 |
|
|
/* */ |
320 |
|
|
/* image_reader Image reader control block. */ |
321 |
|
|
/* pixel Pixel to write. */ |
322 |
|
|
/* */ |
323 |
|
|
/* OUTPUT */ |
324 |
|
|
/* */ |
325 |
|
|
/* Completion Status */ |
326 |
|
|
/* */ |
327 |
|
|
/* CALLS */ |
328 |
|
|
/* */ |
329 |
|
|
/* None */ |
330 |
|
|
/* */ |
331 |
|
|
/* CALLED BY */ |
332 |
|
|
/* */ |
333 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
334 |
|
|
/* */ |
335 |
|
|
/**************************************************************************/ |
336 |
|
2592746 |
static UINT _gx_image_reader_565rgb_rle_pixel_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
337 |
|
|
{ |
338 |
|
|
USHORT *pLine; |
339 |
|
|
GX_UBYTE *pAlpha; |
340 |
|
|
|
341 |
✓✓ |
2592746 |
if (!image_reader -> gx_image_reader_size_testing) |
342 |
|
|
{ |
343 |
|
1280647 |
pLine = (USHORT *)image_reader -> gx_image_reader_putdata; |
344 |
|
|
|
345 |
✓✓ |
1280647 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ALPHA) |
346 |
|
|
{ |
347 |
|
173235 |
pAlpha = (GX_UBYTE *)image_reader -> gx_image_reader_putdata; |
348 |
|
|
|
349 |
|
|
/* Skip count. */ |
350 |
|
173235 |
pAlpha++; |
351 |
|
173235 |
pLine++; |
352 |
|
|
|
353 |
|
173235 |
(*pAlpha) = pixel -> gx_pixel_alpha; |
354 |
|
|
} |
355 |
|
|
|
356 |
|
1280647 |
pixel -> gx_pixel_red &= 0xf8; |
357 |
|
1280647 |
pixel -> gx_pixel_green &= 0xfc; |
358 |
|
1280647 |
pixel -> gx_pixel_blue &= 0xf8; |
359 |
|
|
|
360 |
|
1280647 |
(*pLine) = (USHORT)(pixel -> gx_pixel_red << 8); |
361 |
|
1280647 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_green << 3)); |
362 |
|
1280647 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_blue >> 3)); |
363 |
|
|
} |
364 |
|
|
|
365 |
✓✓ |
2592746 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ALPHA) |
366 |
|
|
{ |
367 |
|
377922 |
image_reader -> gx_image_reader_putdata += 4; |
368 |
|
|
} |
369 |
|
|
else |
370 |
|
|
{ |
371 |
|
2214824 |
image_reader -> gx_image_reader_putdata += 2; |
372 |
|
|
} |
373 |
|
|
|
374 |
|
2592746 |
return GX_SUCCESS; |
375 |
|
|
} |
376 |
|
|
|
377 |
|
|
/**************************************************************************/ |
378 |
|
|
/* */ |
379 |
|
|
/* FUNCTION RELEASE */ |
380 |
|
|
/* */ |
381 |
|
|
/* _gx_image_reader_565rgb_pixel_write PORTABLE C */ |
382 |
|
|
/* 6.1 */ |
383 |
|
|
/* AUTHOR */ |
384 |
|
|
/* */ |
385 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
386 |
|
|
/* */ |
387 |
|
|
/* DESCRIPTION */ |
388 |
|
|
/* */ |
389 |
|
|
/* This function writes a pixel to output pixemap data structure. */ |
390 |
|
|
/* */ |
391 |
|
|
/* INPUT */ |
392 |
|
|
/* */ |
393 |
|
|
/* image_reader Image reader control block. */ |
394 |
|
|
/* pixel Pixel to write. */ |
395 |
|
|
/* */ |
396 |
|
|
/* OUTPUT */ |
397 |
|
|
/* */ |
398 |
|
|
/* Completion Status */ |
399 |
|
|
/* */ |
400 |
|
|
/* CALLS */ |
401 |
|
|
/* */ |
402 |
|
|
/* None */ |
403 |
|
|
/* */ |
404 |
|
|
/* CALLED BY */ |
405 |
|
|
/* */ |
406 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
407 |
|
|
/* */ |
408 |
|
|
/**************************************************************************/ |
409 |
|
3015025 |
static UINT _gx_image_reader_565rgb_pixel_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
410 |
|
|
{ |
411 |
|
|
USHORT *pLine; |
412 |
|
|
GX_UBYTE *pAlpha; |
413 |
|
|
|
414 |
|
3015025 |
pLine = (USHORT *)image_reader -> gx_image_reader_putdata; |
415 |
|
|
|
416 |
|
3015025 |
pixel -> gx_pixel_red &= 0xf8; |
417 |
|
3015025 |
pixel -> gx_pixel_green &= 0xfc; |
418 |
|
3015025 |
pixel -> gx_pixel_blue &= 0xf8; |
419 |
|
|
|
420 |
|
3015025 |
(*pLine) = (USHORT)(pixel -> gx_pixel_red << 8); |
421 |
|
3015025 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_green << 3)); |
422 |
|
3015025 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_blue >> 3)); |
423 |
|
|
|
424 |
✓✓ |
3015025 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ALPHA) |
425 |
|
|
{ |
426 |
|
1126053 |
pAlpha = image_reader -> gx_image_reader_putauxdata; |
427 |
|
|
|
428 |
|
1126053 |
(*pAlpha) = pixel -> gx_pixel_alpha; |
429 |
|
|
} |
430 |
|
|
|
431 |
|
3015025 |
image_reader -> gx_image_reader_putauxdata += 1; |
432 |
|
3015025 |
image_reader -> gx_image_reader_putdata += 2; |
433 |
|
|
|
434 |
|
3015025 |
return GX_SUCCESS; |
435 |
|
|
} |
436 |
|
|
|
437 |
|
|
/**************************************************************************/ |
438 |
|
|
/* */ |
439 |
|
|
/* FUNCTION RELEASE */ |
440 |
|
|
/* */ |
441 |
|
|
/* _gx_image_reader_565rgb_rotated_pixel_write PORTABLE C */ |
442 |
|
|
/* 6.1.5 */ |
443 |
|
|
/* AUTHOR */ |
444 |
|
|
/* */ |
445 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
446 |
|
|
/* */ |
447 |
|
|
/* DESCRIPTION */ |
448 |
|
|
/* */ |
449 |
|
|
/* This function rotates a pixel to output pixemap data structure. */ |
450 |
|
|
/* */ |
451 |
|
|
/* INPUT */ |
452 |
|
|
/* */ |
453 |
|
|
/* image_reader Image reader control block. */ |
454 |
|
|
/* pixel Pixel to write. */ |
455 |
|
|
/* */ |
456 |
|
|
/* OUTPUT */ |
457 |
|
|
/* */ |
458 |
|
|
/* Completion Status */ |
459 |
|
|
/* */ |
460 |
|
|
/* CALLS */ |
461 |
|
|
/* */ |
462 |
|
|
/* None */ |
463 |
|
|
/* */ |
464 |
|
|
/* CALLED BY */ |
465 |
|
|
/* */ |
466 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
467 |
|
|
/* */ |
468 |
|
|
/**************************************************************************/ |
469 |
|
2482571 |
static UINT _gx_image_reader_565rgb_rotated_pixel_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
470 |
|
|
{ |
471 |
|
|
USHORT *pLine; |
472 |
|
|
GX_UBYTE *pAlpha; |
473 |
|
|
|
474 |
✓✓ |
2482571 |
if(!image_reader -> gx_image_reader_size_testing) |
475 |
|
|
{ |
476 |
|
2453211 |
pLine = (USHORT *)image_reader -> gx_image_reader_putdata; |
477 |
|
|
|
478 |
|
2453211 |
pixel -> gx_pixel_red &= 0xf8; |
479 |
|
2453211 |
pixel -> gx_pixel_green &= 0xfc; |
480 |
|
2453211 |
pixel -> gx_pixel_blue &= 0xf8; |
481 |
|
|
|
482 |
|
2453211 |
(*pLine) = (USHORT)(pixel -> gx_pixel_red << 8); |
483 |
|
2453211 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_green << 3)); |
484 |
|
2453211 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_blue >> 3)); |
485 |
|
|
|
486 |
✓✓ |
2453211 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ALPHA) |
487 |
|
|
{ |
488 |
|
2447055 |
pAlpha = image_reader -> gx_image_reader_putauxdata; |
489 |
|
|
|
490 |
|
2447055 |
(*pAlpha) = pixel -> gx_pixel_alpha; |
491 |
|
|
} |
492 |
|
|
} |
493 |
|
|
|
494 |
✓✓ |
2482571 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ROTATE_CW) |
495 |
|
|
{ |
496 |
|
1699976 |
image_reader -> gx_image_reader_putauxdata -= image_reader -> gx_image_reader_image_height; |
497 |
|
1699976 |
image_reader -> gx_image_reader_putdata -= (image_reader -> gx_image_reader_image_height << 1); |
498 |
|
|
} |
499 |
|
|
else |
500 |
|
|
{ |
501 |
|
782595 |
image_reader -> gx_image_reader_putauxdata += image_reader -> gx_image_reader_image_height; |
502 |
|
782595 |
image_reader -> gx_image_reader_putdata += (image_reader -> gx_image_reader_image_height << 1); |
503 |
|
|
} |
504 |
|
|
|
505 |
|
2482571 |
return GX_SUCCESS; |
506 |
|
|
} |
507 |
|
|
|
508 |
|
|
/**************************************************************************/ |
509 |
|
|
/* */ |
510 |
|
|
/* FUNCTION RELEASE */ |
511 |
|
|
/* */ |
512 |
|
|
/* _gx_image_reader_1555xrgb_rle_pixel_write PORTABLE C */ |
513 |
|
|
/* 6.1 */ |
514 |
|
|
/* AUTHOR */ |
515 |
|
|
/* */ |
516 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
517 |
|
|
/* */ |
518 |
|
|
/* DESCRIPTION */ |
519 |
|
|
/* */ |
520 |
|
|
/* This function writes an 1555xrgb format pixel to output pixemap */ |
521 |
|
|
/* data structure. */ |
522 |
|
|
/* */ |
523 |
|
|
/* INPUT */ |
524 |
|
|
/* */ |
525 |
|
|
/* image_reader Image reader control block. */ |
526 |
|
|
/* pixel Pixel to write. */ |
527 |
|
|
/* */ |
528 |
|
|
/* OUTPUT */ |
529 |
|
|
/* */ |
530 |
|
|
/* Completion Status */ |
531 |
|
|
/* */ |
532 |
|
|
/* CALLS */ |
533 |
|
|
/* */ |
534 |
|
|
/* None */ |
535 |
|
|
/* */ |
536 |
|
|
/* CALLED BY */ |
537 |
|
|
/* */ |
538 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
539 |
|
|
/* */ |
540 |
|
|
/**************************************************************************/ |
541 |
|
676444 |
static UINT _gx_image_reader_1555xrgb_rle_pixel_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
542 |
|
|
{ |
543 |
|
|
USHORT *pLine; |
544 |
|
|
GX_UBYTE *pAlpha; |
545 |
|
|
|
546 |
✓✓ |
676444 |
if (!image_reader -> gx_image_reader_size_testing) |
547 |
|
|
{ |
548 |
|
338222 |
pLine = (USHORT *)image_reader -> gx_image_reader_putdata; |
549 |
|
|
|
550 |
✓✓ |
338222 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ALPHA) |
551 |
|
|
{ |
552 |
|
196870 |
pAlpha = (GX_UBYTE *)image_reader -> gx_image_reader_putdata; |
553 |
|
|
|
554 |
|
|
/* Skip count. */ |
555 |
|
196870 |
pAlpha++; |
556 |
|
196870 |
pLine++; |
557 |
|
|
|
558 |
|
196870 |
(*pAlpha) = pixel -> gx_pixel_alpha; |
559 |
|
|
} |
560 |
|
|
|
561 |
|
338222 |
pixel -> gx_pixel_red &= 0xf8; |
562 |
|
338222 |
pixel -> gx_pixel_green &= 0xf8; |
563 |
|
338222 |
pixel -> gx_pixel_blue &= 0xf8; |
564 |
|
|
|
565 |
|
338222 |
(*pLine) = (USHORT)(pixel -> gx_pixel_red << 7); |
566 |
|
338222 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_green << 2)); |
567 |
|
338222 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_blue >> 3)); |
568 |
|
|
} |
569 |
|
|
|
570 |
✓✓ |
676444 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ALPHA) |
571 |
|
|
{ |
572 |
|
393740 |
image_reader -> gx_image_reader_putdata += 4; |
573 |
|
|
} |
574 |
|
|
else |
575 |
|
|
{ |
576 |
|
282704 |
image_reader -> gx_image_reader_putdata += 2; |
577 |
|
|
} |
578 |
|
|
|
579 |
|
676444 |
return GX_SUCCESS; |
580 |
|
|
} |
581 |
|
|
|
582 |
|
|
/**************************************************************************/ |
583 |
|
|
/* */ |
584 |
|
|
/* FUNCTION RELEASE */ |
585 |
|
|
/* */ |
586 |
|
|
/* _gx_image_reader_1555xrgb_pixel_write PORTABLE C */ |
587 |
|
|
/* 6.1 */ |
588 |
|
|
/* AUTHOR */ |
589 |
|
|
/* */ |
590 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
591 |
|
|
/* */ |
592 |
|
|
/* DESCRIPTION */ |
593 |
|
|
/* */ |
594 |
|
|
/* This function writes an 1555xrgb format pixel to output pixemap */ |
595 |
|
|
/* data structure. */ |
596 |
|
|
/* */ |
597 |
|
|
/* INPUT */ |
598 |
|
|
/* */ |
599 |
|
|
/* image_reader Image reader control block. */ |
600 |
|
|
/* pixel Pixel to write. */ |
601 |
|
|
/* */ |
602 |
|
|
/* OUTPUT */ |
603 |
|
|
/* */ |
604 |
|
|
/* Completion Status */ |
605 |
|
|
/* */ |
606 |
|
|
/* CALLS */ |
607 |
|
|
/* */ |
608 |
|
|
/* None */ |
609 |
|
|
/* */ |
610 |
|
|
/* CALLED BY */ |
611 |
|
|
/* */ |
612 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
613 |
|
|
/* */ |
614 |
|
|
/**************************************************************************/ |
615 |
|
921645 |
static UINT _gx_image_reader_1555xrgb_pixel_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
616 |
|
|
{ |
617 |
|
|
USHORT *pLine; |
618 |
|
|
GX_UBYTE *pAlpha; |
619 |
|
|
|
620 |
|
921645 |
pLine = (USHORT *)image_reader -> gx_image_reader_putdata; |
621 |
|
|
|
622 |
|
921645 |
pixel -> gx_pixel_red &= 0xf8; |
623 |
|
921645 |
pixel -> gx_pixel_green &= 0xf8; |
624 |
|
921645 |
pixel -> gx_pixel_blue &= 0xf8; |
625 |
|
|
|
626 |
|
921645 |
(*pLine) = (USHORT)(pixel -> gx_pixel_red << 7); |
627 |
|
921645 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_green << 2)); |
628 |
|
921645 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_blue >> 3)); |
629 |
|
|
|
630 |
✓✓ |
921645 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ALPHA) |
631 |
|
|
{ |
632 |
|
468585 |
pAlpha = image_reader -> gx_image_reader_putauxdata; |
633 |
|
|
|
634 |
|
468585 |
(*pAlpha) = pixel -> gx_pixel_alpha; |
635 |
|
|
} |
636 |
|
|
|
637 |
|
921645 |
image_reader -> gx_image_reader_putauxdata += 1; |
638 |
|
921645 |
image_reader -> gx_image_reader_putdata += 2; |
639 |
|
|
|
640 |
|
921645 |
return GX_SUCCESS; |
641 |
|
|
} |
642 |
|
|
|
643 |
|
|
/**************************************************************************/ |
644 |
|
|
/* */ |
645 |
|
|
/* FUNCTION RELEASE */ |
646 |
|
|
/* */ |
647 |
|
|
/* _gx_image_reader_4444argb_pixel_write PORTABLE C */ |
648 |
|
|
/* 6.1 */ |
649 |
|
|
/* AUTHOR */ |
650 |
|
|
/* */ |
651 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
652 |
|
|
/* */ |
653 |
|
|
/* DESCRIPTION */ |
654 |
|
|
/* */ |
655 |
|
|
/* This function writes an 4444argb format pixel (no transparency) to */ |
656 |
|
|
/* output pixemap data structure. */ |
657 |
|
|
/* */ |
658 |
|
|
/* INPUT */ |
659 |
|
|
/* */ |
660 |
|
|
/* image_reader Image reader control block. */ |
661 |
|
|
/* pixel Pixel to write. */ |
662 |
|
|
/* */ |
663 |
|
|
/* OUTPUT */ |
664 |
|
|
/* */ |
665 |
|
|
/* Completion Status */ |
666 |
|
|
/* */ |
667 |
|
|
/* CALLS */ |
668 |
|
|
/* */ |
669 |
|
|
/* None */ |
670 |
|
|
/* */ |
671 |
|
|
/* CALLED BY */ |
672 |
|
|
/* */ |
673 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
674 |
|
|
/* */ |
675 |
|
|
/**************************************************************************/ |
676 |
|
629890 |
static UINT _gx_image_reader_4444argb_pixel_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
677 |
|
|
{ |
678 |
|
|
USHORT *pLine; |
679 |
|
|
|
680 |
✓✓ |
629890 |
if (!image_reader -> gx_image_reader_size_testing) |
681 |
|
|
{ |
682 |
|
539765 |
pLine = (USHORT *)image_reader -> gx_image_reader_putdata; |
683 |
|
|
|
684 |
|
539765 |
pixel -> gx_pixel_alpha &= 0xf0; |
685 |
|
539765 |
pixel -> gx_pixel_red &= 0xf0; |
686 |
|
539765 |
pixel -> gx_pixel_green &= 0xf0; |
687 |
|
539765 |
pixel -> gx_pixel_blue &= 0xf0; |
688 |
|
|
|
689 |
|
539765 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_red << 4)); |
690 |
|
539765 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_green << 0)); |
691 |
|
539765 |
(*pLine) = (USHORT)((*pLine) | pixel -> gx_pixel_blue >> 4); |
692 |
|
539765 |
(*pLine) = (USHORT)((*pLine) | 0xf000); |
693 |
|
|
} |
694 |
|
|
|
695 |
|
629890 |
image_reader -> gx_image_reader_putdata += 2; |
696 |
|
|
|
697 |
|
629890 |
return GX_SUCCESS; |
698 |
|
|
} |
699 |
|
|
|
700 |
|
|
/**************************************************************************/ |
701 |
|
|
/* */ |
702 |
|
|
/* FUNCTION RELEASE */ |
703 |
|
|
/* */ |
704 |
|
|
/* _gx_image_reader_4444argb_transparent_write PORTABLE C */ |
705 |
|
|
/* 6.1 */ |
706 |
|
|
/* AUTHOR */ |
707 |
|
|
/* */ |
708 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
709 |
|
|
/* */ |
710 |
|
|
/* DESCRIPTION */ |
711 |
|
|
/* */ |
712 |
|
|
/* This function writes an 4444argb format pixel (with transparency) */ |
713 |
|
|
/* to output pixemap data structure. */ |
714 |
|
|
/* */ |
715 |
|
|
/* INPUT */ |
716 |
|
|
/* */ |
717 |
|
|
/* image_reader Image reader control block. */ |
718 |
|
|
/* pixel Pixel to write. */ |
719 |
|
|
/* */ |
720 |
|
|
/* OUTPUT */ |
721 |
|
|
/* */ |
722 |
|
|
/* Completion Status */ |
723 |
|
|
/* */ |
724 |
|
|
/* CALLS */ |
725 |
|
|
/* */ |
726 |
|
|
/* None */ |
727 |
|
|
/* */ |
728 |
|
|
/* CALLED BY */ |
729 |
|
|
/* */ |
730 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
731 |
|
|
/* */ |
732 |
|
|
/**************************************************************************/ |
733 |
|
420729 |
static UINT _gx_image_reader_4444argb_transparent_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
734 |
|
|
{ |
735 |
|
|
USHORT *pLine; |
736 |
|
|
|
737 |
✓✓ |
420729 |
if (!image_reader -> gx_image_reader_size_testing) |
738 |
|
|
{ |
739 |
|
340527 |
pLine = (USHORT *)image_reader -> gx_image_reader_putdata; |
740 |
|
|
|
741 |
|
340527 |
pixel -> gx_pixel_alpha &= 0xf0; |
742 |
|
340527 |
pixel -> gx_pixel_red &= 0xf0; |
743 |
|
340527 |
pixel -> gx_pixel_green &= 0xf0; |
744 |
|
340527 |
pixel -> gx_pixel_blue &= 0xf0; |
745 |
|
|
|
746 |
|
340527 |
(*pLine) = (USHORT)(pixel -> gx_pixel_alpha << 8); |
747 |
|
340527 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_red << 4)); |
748 |
|
340527 |
(*pLine) = (USHORT)((*pLine) | (pixel -> gx_pixel_green << 0)); |
749 |
|
340527 |
(*pLine) = (USHORT)((*pLine) | pixel -> gx_pixel_blue >> 4); |
750 |
|
|
} |
751 |
|
|
|
752 |
|
420729 |
image_reader -> gx_image_reader_putdata += 2; |
753 |
|
|
|
754 |
|
420729 |
return GX_SUCCESS; |
755 |
|
|
} |
756 |
|
|
|
757 |
|
|
/**************************************************************************/ |
758 |
|
|
/* */ |
759 |
|
|
/* FUNCTION RELEASE */ |
760 |
|
|
/* */ |
761 |
|
|
/* _gx_image_reader_4bit_grayscale_pixel_write PORTABLE C */ |
762 |
|
|
/* 6.1 */ |
763 |
|
|
/* AUTHOR */ |
764 |
|
|
/* */ |
765 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
766 |
|
|
/* */ |
767 |
|
|
/* DESCRIPTION */ |
768 |
|
|
/* */ |
769 |
|
|
/* This function writes an 4bit grayscale format pixel */ |
770 |
|
|
/* (no transparency)to output pixelmap data structure. */ |
771 |
|
|
/* */ |
772 |
|
|
/* INPUT */ |
773 |
|
|
/* */ |
774 |
|
|
/* image_reader Image reader control block. */ |
775 |
|
|
/* pixel Pixel to write. */ |
776 |
|
|
/* */ |
777 |
|
|
/* OUTPUT */ |
778 |
|
|
/* */ |
779 |
|
|
/* Completion Status */ |
780 |
|
|
/* */ |
781 |
|
|
/* CALLS */ |
782 |
|
|
/* */ |
783 |
|
|
/* _gx_image_reader_rgb2gray Convert RGB value to grayscale*/ |
784 |
|
|
/* */ |
785 |
|
|
/* CALLED BY */ |
786 |
|
|
/* */ |
787 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
788 |
|
|
/* */ |
789 |
|
|
/**************************************************************************/ |
790 |
|
618030 |
static UINT _gx_image_reader_4bit_grayscale_pixel_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
791 |
|
|
{ |
792 |
|
|
GX_UBYTE *pLine; |
793 |
|
|
GX_UBYTE gray; |
794 |
|
|
GX_UBYTE color; |
795 |
|
|
|
796 |
✓✓ |
618030 |
if (!image_reader -> gx_image_reader_size_testing) |
797 |
|
|
{ |
798 |
|
547245 |
_gx_image_reader_rgb2gray(pixel, &gray); |
799 |
|
547245 |
gray >>= 4; |
800 |
|
|
|
801 |
|
547245 |
color = (GX_UBYTE)(gray | (gray << 4)); |
802 |
|
547245 |
pixel -> gx_pixel_red = color; |
803 |
|
547245 |
pixel -> gx_pixel_green = color; |
804 |
|
547245 |
pixel -> gx_pixel_blue = color; |
805 |
|
|
|
806 |
|
547245 |
pLine = image_reader -> gx_image_reader_putdata; |
807 |
|
|
|
808 |
✓✓ |
547245 |
if (image_reader -> gx_image_reader_putdata_mask & 0xf0) |
809 |
|
|
{ |
810 |
|
274159 |
(*pLine) = (GX_UBYTE)(gray << 4); |
811 |
|
|
} |
812 |
|
|
else |
813 |
|
|
{ |
814 |
|
273086 |
(*pLine) |= gray; |
815 |
|
|
} |
816 |
|
|
} |
817 |
|
|
|
818 |
|
618030 |
image_reader -> gx_image_reader_putdata_mask >>= 4; |
819 |
|
|
|
820 |
✓✓ |
618030 |
if (!image_reader -> gx_image_reader_putdata_mask) |
821 |
|
|
{ |
822 |
|
308476 |
image_reader -> gx_image_reader_putdata++; |
823 |
|
308476 |
image_reader -> gx_image_reader_putdata_mask = 0xf0; |
824 |
|
|
} |
825 |
|
|
|
826 |
|
618030 |
return GX_SUCCESS; |
827 |
|
|
} |
828 |
|
|
|
829 |
|
|
/**************************************************************************/ |
830 |
|
|
/* */ |
831 |
|
|
/* FUNCTION RELEASE */ |
832 |
|
|
/* */ |
833 |
|
|
/* _gx_image_reader_4bit_grayscale_transparent_write PORTABLE C */ |
834 |
|
|
/* 6.1 */ |
835 |
|
|
/* AUTHOR */ |
836 |
|
|
/* */ |
837 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
838 |
|
|
/* */ |
839 |
|
|
/* DESCRIPTION */ |
840 |
|
|
/* */ |
841 |
|
|
/* This function writes an 4bit grayscale format pixel */ |
842 |
|
|
/* (with transparency)to output pixelmap data structure. */ |
843 |
|
|
/* */ |
844 |
|
|
/* INPUT */ |
845 |
|
|
/* */ |
846 |
|
|
/* image_reader Image reader control block. */ |
847 |
|
|
/* pixel Pixel to write. */ |
848 |
|
|
/* */ |
849 |
|
|
/* OUTPUT */ |
850 |
|
|
/* */ |
851 |
|
|
/* Completion Status */ |
852 |
|
|
/* */ |
853 |
|
|
/* CALLS */ |
854 |
|
|
/* */ |
855 |
|
|
/* _gx_image_reader_rgb2gray Convert RGB value to grayscale*/ |
856 |
|
|
/* */ |
857 |
|
|
/* CALLED BY */ |
858 |
|
|
/* */ |
859 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
860 |
|
|
/* */ |
861 |
|
|
/**************************************************************************/ |
862 |
|
394436 |
static UINT _gx_image_reader_4bit_grayscale_transparent_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
863 |
|
|
{ |
864 |
|
|
GX_UBYTE *pLine; |
865 |
|
|
GX_UBYTE *pAuxData; |
866 |
|
|
GX_UBYTE gray; |
867 |
|
|
GX_UBYTE color; |
868 |
|
|
|
869 |
✓✓ |
394436 |
if (!image_reader -> gx_image_reader_size_testing) |
870 |
|
|
{ |
871 |
|
353541 |
_gx_image_reader_rgb2gray(pixel, &gray); |
872 |
|
353541 |
gray >>= 4; |
873 |
|
|
|
874 |
|
353541 |
color = (GX_UBYTE)(gray | (gray << 4)); |
875 |
|
353541 |
pixel -> gx_pixel_red = color; |
876 |
|
353541 |
pixel -> gx_pixel_green = color; |
877 |
|
353541 |
pixel -> gx_pixel_blue = color; |
878 |
|
|
|
879 |
|
353541 |
pLine = image_reader -> gx_image_reader_putdata; |
880 |
|
|
|
881 |
✓✓ |
353541 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_COMPRESS) |
882 |
|
|
{ |
883 |
|
|
/* with compression, with transparent: 1 byte color |
884 |
|
|
0x00-0x0f: pixel value |
885 |
|
|
0xff: transparent value */ |
886 |
✓✓ |
40895 |
if (pixel -> gx_pixel_alpha < 128) |
887 |
|
|
{ |
888 |
|
2308 |
(*pLine) = GX_TRANSPARENT_COLOR; |
889 |
|
|
} |
890 |
|
|
else |
891 |
|
|
{ |
892 |
|
38587 |
(*pLine) = gray; |
893 |
|
|
} |
894 |
|
|
} |
895 |
|
|
else |
896 |
|
|
{ |
897 |
|
|
/* without compression, with transparent: half byte color, |
898 |
|
|
1-bit transparent go into auxdata. */ |
899 |
✓✓ |
312646 |
if (image_reader -> gx_image_reader_putdata_mask & 0xf0) |
900 |
|
|
{ |
901 |
|
157124 |
(*pLine) = (GX_UBYTE)(gray << 4); |
902 |
|
|
} |
903 |
|
|
else |
904 |
|
|
{ |
905 |
|
155522 |
(*pLine) |= gray; |
906 |
|
|
} |
907 |
|
|
|
908 |
|
312646 |
pAuxData = image_reader -> gx_image_reader_putauxdata; |
909 |
|
|
|
910 |
✓✓ |
312646 |
if (pixel -> gx_pixel_alpha > 128) |
911 |
|
|
{ |
912 |
|
217507 |
(*pAuxData) &= (GX_UBYTE)(~image_reader -> gx_image_reader_putauxdata_mask); |
913 |
|
|
} |
914 |
|
|
else |
915 |
|
|
{ |
916 |
|
95139 |
(*pAuxData) |= image_reader -> gx_image_reader_putauxdata_mask; |
917 |
|
|
} |
918 |
|
|
} |
919 |
|
|
} |
920 |
|
|
|
921 |
✓✓ |
394436 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_COMPRESS) |
922 |
|
|
{ |
923 |
|
81790 |
image_reader -> gx_image_reader_putdata++; |
924 |
|
|
} |
925 |
|
|
else |
926 |
|
|
{ |
927 |
|
|
|
928 |
|
312646 |
image_reader -> gx_image_reader_putdata_mask >>= 4; |
929 |
|
|
|
930 |
✓✓ |
312646 |
if (!image_reader -> gx_image_reader_putdata_mask) |
931 |
|
|
{ |
932 |
|
155522 |
image_reader -> gx_image_reader_putdata++; |
933 |
|
155522 |
image_reader -> gx_image_reader_putdata_mask = 0xf0; |
934 |
|
|
} |
935 |
|
|
|
936 |
|
312646 |
image_reader -> gx_image_reader_putauxdata_mask >>= 1; |
937 |
✓✓ |
312646 |
if (!image_reader -> gx_image_reader_putauxdata_mask) |
938 |
|
|
{ |
939 |
|
38480 |
image_reader -> gx_image_reader_putauxdata++; |
940 |
|
38480 |
image_reader -> gx_image_reader_putauxdata_mask = 0x80; |
941 |
|
|
} |
942 |
|
|
} |
943 |
|
|
|
944 |
|
394436 |
return GX_SUCCESS; |
945 |
|
|
} |
946 |
|
|
|
947 |
|
|
/**************************************************************************/ |
948 |
|
|
/* */ |
949 |
|
|
/* FUNCTION RELEASE */ |
950 |
|
|
/* */ |
951 |
|
|
/* _gx_image_reader_monochrome_pixel_write PORTABLE C */ |
952 |
|
|
/* 6.1 */ |
953 |
|
|
/* AUTHOR */ |
954 |
|
|
/* */ |
955 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
956 |
|
|
/* */ |
957 |
|
|
/* DESCRIPTION */ |
958 |
|
|
/* */ |
959 |
|
|
/* This function writes a monochrome format pixel (no transparency) to */ |
960 |
|
|
/* output pixelmap data structure. */ |
961 |
|
|
/* */ |
962 |
|
|
/* INPUT */ |
963 |
|
|
/* */ |
964 |
|
|
/* image_reader Image reader control block. */ |
965 |
|
|
/* pixel Pixel to write. */ |
966 |
|
|
/* */ |
967 |
|
|
/* OUTPUT */ |
968 |
|
|
/* */ |
969 |
|
|
/* Completion Status */ |
970 |
|
|
/* */ |
971 |
|
|
/* CALLS */ |
972 |
|
|
/* */ |
973 |
|
|
/* _gx_image_reader_rgb2gray Convert RGB value to grayscale*/ |
974 |
|
|
/* */ |
975 |
|
|
/* CALLED BY */ |
976 |
|
|
/* */ |
977 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
978 |
|
|
/* */ |
979 |
|
|
/**************************************************************************/ |
980 |
|
562013 |
static UINT _gx_image_reader_monochrome_pixel_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
981 |
|
|
{ |
982 |
|
|
GX_UBYTE *pLine; |
983 |
|
|
GX_UBYTE gray; |
984 |
|
|
GX_UBYTE color; |
985 |
|
|
|
986 |
|
562013 |
pLine = image_reader -> gx_image_reader_putdata; |
987 |
|
|
|
988 |
✓✓ |
562013 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_COMPRESS) |
989 |
|
|
{ |
990 |
|
|
/* [7-bit counter][1-bit color]*/ |
991 |
✓✓ |
58477 |
if (!image_reader -> gx_image_reader_size_testing) |
992 |
|
|
{ |
993 |
|
3404 |
_gx_image_reader_rgb2gray(pixel, &gray); |
994 |
✓✓ |
3404 |
if (gray > image_reader -> gx_image_reader_mono_shreshold) |
995 |
|
|
{ |
996 |
|
2104 |
(*pLine) |= 0x01; |
997 |
|
|
} |
998 |
|
|
else |
999 |
|
|
{ |
1000 |
|
1300 |
(*pLine) &= 0xfe; |
1001 |
|
|
} |
1002 |
|
|
} |
1003 |
|
58477 |
image_reader -> gx_image_reader_putdata++; |
1004 |
|
|
} |
1005 |
|
|
else |
1006 |
|
|
{ |
1007 |
|
|
/* [1-bit color]*/ |
1008 |
|
503536 |
_gx_image_reader_rgb2gray(pixel, &gray); |
1009 |
✓✓ |
503536 |
if (gray > image_reader -> gx_image_reader_mono_shreshold) |
1010 |
|
|
{ |
1011 |
|
322452 |
(*pLine) |= image_reader -> gx_image_reader_putdata_mask; |
1012 |
|
322452 |
color = 255; |
1013 |
|
|
} |
1014 |
|
|
else |
1015 |
|
|
{ |
1016 |
|
181084 |
(*pLine) &= (GX_UBYTE)(~image_reader -> gx_image_reader_putdata_mask); |
1017 |
|
181084 |
color = 0; |
1018 |
|
|
} |
1019 |
|
|
|
1020 |
|
503536 |
pixel -> gx_pixel_red = color; |
1021 |
|
503536 |
pixel -> gx_pixel_green = color; |
1022 |
|
503536 |
pixel -> gx_pixel_blue = color; |
1023 |
|
503536 |
pixel -> gx_pixel_alpha = 0xff; |
1024 |
|
|
|
1025 |
|
503536 |
image_reader -> gx_image_reader_putdata_mask >>= 1; |
1026 |
|
|
|
1027 |
✓✓ |
503536 |
if (!image_reader -> gx_image_reader_putdata_mask) |
1028 |
|
|
{ |
1029 |
|
61722 |
image_reader -> gx_image_reader_putdata++; |
1030 |
|
61722 |
image_reader -> gx_image_reader_putdata_mask = 0x80; |
1031 |
|
|
} |
1032 |
|
|
} |
1033 |
|
|
|
1034 |
|
562013 |
return GX_SUCCESS; |
1035 |
|
|
} |
1036 |
|
|
|
1037 |
|
|
/**************************************************************************/ |
1038 |
|
|
/* */ |
1039 |
|
|
/* FUNCTION RELEASE */ |
1040 |
|
|
/* */ |
1041 |
|
|
/* _gx_image_reader_monochrome_transparent_write PORTABLE C */ |
1042 |
|
|
/* 6.1 */ |
1043 |
|
|
/* AUTHOR */ |
1044 |
|
|
/* */ |
1045 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
1046 |
|
|
/* */ |
1047 |
|
|
/* DESCRIPTION */ |
1048 |
|
|
/* */ |
1049 |
|
|
/* This function writes a monochrome format pixel (with transparency) */ |
1050 |
|
|
/* to output pixelmap data structure. */ |
1051 |
|
|
/* */ |
1052 |
|
|
/* INPUT */ |
1053 |
|
|
/* */ |
1054 |
|
|
/* image_reader Image reader control block. */ |
1055 |
|
|
/* pixel Pixel to write. */ |
1056 |
|
|
/* */ |
1057 |
|
|
/* OUTPUT */ |
1058 |
|
|
/* */ |
1059 |
|
|
/* Completion Status */ |
1060 |
|
|
/* */ |
1061 |
|
|
/* CALLS */ |
1062 |
|
|
/* */ |
1063 |
|
|
/* _gx_image_reader_rgb2gray Convert RGB value to grayscale*/ |
1064 |
|
|
/* */ |
1065 |
|
|
/* CALLED BY */ |
1066 |
|
|
/* */ |
1067 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
1068 |
|
|
/* */ |
1069 |
|
|
/**************************************************************************/ |
1070 |
|
464993 |
static UINT _gx_image_reader_monochrome_transparent_write(GX_IMAGE_READER *image_reader, GX_PIXEL *pixel) |
1071 |
|
|
{ |
1072 |
|
|
GX_UBYTE *pLine; |
1073 |
|
|
GX_UBYTE gray; |
1074 |
|
|
GX_UBYTE trans_mask; |
1075 |
|
|
GX_UBYTE color; |
1076 |
|
|
|
1077 |
|
464993 |
pLine = image_reader -> gx_image_reader_putdata; |
1078 |
|
|
|
1079 |
✓✓ |
464993 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_COMPRESS) |
1080 |
|
|
{ |
1081 |
|
|
/* [6-bit counter][1-bit color][1-bit transparency]*/ |
1082 |
✓✓ |
99770 |
if (!image_reader -> gx_image_reader_size_testing) |
1083 |
|
|
{ |
1084 |
✓✓ |
2949 |
if (pixel -> gx_pixel_alpha < 128) |
1085 |
|
|
{ |
1086 |
|
|
/* Mark as transparency. */ |
1087 |
|
877 |
(*pLine) &= 0xfc; |
1088 |
|
|
} |
1089 |
|
|
else |
1090 |
|
|
{ |
1091 |
|
2072 |
(*pLine) |= 0x01; |
1092 |
|
|
|
1093 |
|
|
/* Write color: 0 or 1. */ |
1094 |
|
2072 |
_gx_image_reader_rgb2gray(pixel, &gray); |
1095 |
✓✓ |
2072 |
if (gray > image_reader -> gx_image_reader_mono_shreshold) |
1096 |
|
|
{ |
1097 |
|
1075 |
(*pLine) |= 0x02; |
1098 |
|
|
} |
1099 |
|
|
else |
1100 |
|
|
{ |
1101 |
|
997 |
(*pLine) &= 0xfd; |
1102 |
|
|
} |
1103 |
|
|
} |
1104 |
|
|
} |
1105 |
|
99770 |
image_reader -> gx_image_reader_putdata++; |
1106 |
|
|
} |
1107 |
|
|
else |
1108 |
|
|
{ |
1109 |
|
|
/* [1-bit color][1-bit transparency]*/ |
1110 |
|
365223 |
trans_mask = image_reader -> gx_image_reader_putdata_mask >> 1; |
1111 |
✓✓ |
365223 |
if (pixel -> gx_pixel_alpha < 128) |
1112 |
|
|
{ |
1113 |
|
|
/* Mark as transparency. */ |
1114 |
|
111185 |
(*pLine) &= (GX_UBYTE)(~trans_mask); |
1115 |
|
111185 |
(*pLine) &= (GX_UBYTE)(~image_reader -> gx_image_reader_putdata_mask); |
1116 |
|
|
} |
1117 |
|
|
else |
1118 |
|
|
{ |
1119 |
|
254038 |
(*pLine) |= trans_mask; |
1120 |
|
|
|
1121 |
|
254038 |
_gx_image_reader_rgb2gray(pixel, &gray); |
1122 |
✓✓ |
254038 |
if (gray > image_reader -> gx_image_reader_mono_shreshold) |
1123 |
|
|
{ |
1124 |
|
112246 |
(*pLine) |= image_reader -> gx_image_reader_putdata_mask; |
1125 |
|
112246 |
color = 255; |
1126 |
|
|
} |
1127 |
|
|
else |
1128 |
|
|
{ |
1129 |
|
141792 |
(*pLine) &= (GX_UBYTE)(~image_reader -> gx_image_reader_putdata_mask); |
1130 |
|
141792 |
color = 0; |
1131 |
|
|
} |
1132 |
|
254038 |
pixel -> gx_pixel_red = color; |
1133 |
|
254038 |
pixel -> gx_pixel_green = color; |
1134 |
|
254038 |
pixel -> gx_pixel_blue = color; |
1135 |
|
|
} |
1136 |
|
|
|
1137 |
|
365223 |
image_reader -> gx_image_reader_putdata_mask >>= 2; |
1138 |
|
|
|
1139 |
✓✓ |
365223 |
if (!image_reader -> gx_image_reader_putdata_mask) |
1140 |
|
|
{ |
1141 |
|
89904 |
image_reader -> gx_image_reader_putdata++; |
1142 |
|
89904 |
image_reader -> gx_image_reader_putdata_mask = 0x80; |
1143 |
|
|
} |
1144 |
|
|
} |
1145 |
|
|
|
1146 |
|
464993 |
return GX_SUCCESS; |
1147 |
|
|
} |
1148 |
|
|
|
1149 |
|
|
/**************************************************************************/ |
1150 |
|
|
/* */ |
1151 |
|
|
/* FUNCTION RELEASE */ |
1152 |
|
|
/* */ |
1153 |
|
|
/* _gx_image_reader_pixel_rotated_write_callback_set PORTABLE C */ |
1154 |
|
|
/* 6.1.4 */ |
1155 |
|
|
/* AUTHOR */ |
1156 |
|
|
/* */ |
1157 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
1158 |
|
|
/* */ |
1159 |
|
|
/* DESCRIPTION */ |
1160 |
|
|
/* */ |
1161 |
|
|
/* This function sets pixel write callback of the image reader when */ |
1162 |
|
|
/* rotation mode is set. */ |
1163 |
|
|
/* */ |
1164 |
|
|
/* INPUT */ |
1165 |
|
|
/* */ |
1166 |
|
|
/* image_reader Image reader control block */ |
1167 |
|
|
/* outmap Outpu pixelmap. */ |
1168 |
|
|
/* */ |
1169 |
|
|
/* OUTPUT */ |
1170 |
|
|
/* */ |
1171 |
|
|
/* Completion Status */ |
1172 |
|
|
/* */ |
1173 |
|
|
/* CALLS */ |
1174 |
|
|
/* */ |
1175 |
|
|
/* _gx_image_reader_565rgb_rotated_pixel_write */ |
1176 |
|
|
/* Write 565rgb format pixel in */ |
1177 |
|
|
/* rotation mode */ |
1178 |
|
|
/* _gx_image_reader_24xrgb_rotated_pixel_write */ |
1179 |
|
|
/* Write 24xrgn format pixel in */ |
1180 |
|
|
/* rotation mode */ |
1181 |
|
|
/* */ |
1182 |
|
|
/* CALLED BY */ |
1183 |
|
|
/* */ |
1184 |
|
|
/* _gx_image_reader_pixel_write_callback_set */ |
1185 |
|
|
/* */ |
1186 |
|
|
/**************************************************************************/ |
1187 |
|
180 |
static UINT _gx_image_reader_pixel_rotated_write_callback_set(GX_IMAGE_READER *image_reader, GX_PIXELMAP *outmap) |
1188 |
|
|
{ |
1189 |
✓✓✓ |
180 |
switch (outmap -> gx_pixelmap_format) |
1190 |
|
|
{ |
1191 |
|
67 |
case GX_COLOR_FORMAT_565RGB: |
1192 |
|
67 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_565rgb_rotated_pixel_write; |
1193 |
|
|
|
1194 |
✓✓ |
67 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ROTATE_CW) |
1195 |
|
|
{ |
1196 |
|
47 |
outmap -> gx_pixelmap_flags |= GX_PIXELMAP_ROTATED_90; |
1197 |
|
|
|
1198 |
|
47 |
image_reader -> gx_image_reader_putdatarow = (GX_UBYTE *)outmap -> gx_pixelmap_data; |
1199 |
|
47 |
image_reader -> gx_image_reader_putdatarow += (outmap -> gx_pixelmap_width - 1) * (outmap -> gx_pixelmap_height << 1); |
1200 |
|
|
|
1201 |
✓✓ |
47 |
if (outmap -> gx_pixelmap_aux_data) |
1202 |
|
|
{ |
1203 |
|
32 |
image_reader -> gx_image_reader_putauxdatarow = (GX_UBYTE *)outmap -> gx_pixelmap_aux_data; |
1204 |
|
32 |
image_reader -> gx_image_reader_putauxdatarow += (outmap -> gx_pixelmap_width - 1) * outmap -> gx_pixelmap_height; |
1205 |
|
|
} |
1206 |
|
|
|
1207 |
|
47 |
image_reader -> gx_image_reader_putdatarow_stride = 2; |
1208 |
|
47 |
image_reader -> gx_image_reader_putauxdatarow_stride = 1; |
1209 |
|
|
} |
1210 |
|
|
else |
1211 |
|
|
{ |
1212 |
|
20 |
outmap -> gx_pixelmap_flags |= GX_PIXELMAP_ROTATED_270; |
1213 |
|
|
|
1214 |
|
20 |
image_reader -> gx_image_reader_putdatarow = (GX_UBYTE *)outmap -> gx_pixelmap_data; |
1215 |
|
20 |
image_reader -> gx_image_reader_putdatarow += (outmap -> gx_pixelmap_height - 1) * 2; |
1216 |
|
|
|
1217 |
✓✓ |
20 |
if (outmap -> gx_pixelmap_aux_data) |
1218 |
|
|
{ |
1219 |
|
15 |
image_reader -> gx_image_reader_putauxdatarow = (GX_UBYTE *)outmap -> gx_pixelmap_aux_data; |
1220 |
|
15 |
image_reader -> gx_image_reader_putauxdatarow += (outmap -> gx_pixelmap_height - 1); |
1221 |
|
|
} |
1222 |
|
|
|
1223 |
|
20 |
image_reader -> gx_image_reader_putdatarow_stride = -2; |
1224 |
|
20 |
image_reader -> gx_image_reader_putauxdatarow_stride = -1; |
1225 |
|
|
} |
1226 |
|
67 |
break; |
1227 |
|
|
|
1228 |
|
112 |
case GX_COLOR_FORMAT_24XRGB: |
1229 |
|
112 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_24xrgb_rotated_pixel_write; |
1230 |
|
|
|
1231 |
✓✓ |
112 |
if (image_reader -> gx_image_reader_mode & GX_IMAGE_READER_MODE_ROTATE_CW) |
1232 |
|
|
{ |
1233 |
|
107 |
outmap -> gx_pixelmap_flags |= GX_PIXELMAP_ROTATED_90; |
1234 |
|
|
|
1235 |
|
107 |
image_reader -> gx_image_reader_putdatarow = (GX_UBYTE *)outmap -> gx_pixelmap_data; |
1236 |
|
107 |
image_reader -> gx_image_reader_putdatarow += (outmap -> gx_pixelmap_width - 1) * (outmap -> gx_pixelmap_height << 2); |
1237 |
|
|
|
1238 |
|
107 |
image_reader -> gx_image_reader_putdatarow_stride = 4; |
1239 |
|
|
} |
1240 |
|
|
else |
1241 |
|
|
{ |
1242 |
|
5 |
outmap -> gx_pixelmap_flags |= GX_PIXELMAP_ROTATED_270; |
1243 |
|
|
|
1244 |
|
5 |
image_reader -> gx_image_reader_putdatarow = (GX_UBYTE *)outmap -> gx_pixelmap_data; |
1245 |
|
5 |
image_reader -> gx_image_reader_putdatarow += ((outmap -> gx_pixelmap_height - 1) << 2); |
1246 |
|
|
|
1247 |
|
5 |
image_reader -> gx_image_reader_putdatarow_stride = -4; |
1248 |
|
|
} |
1249 |
|
112 |
break; |
1250 |
|
|
|
1251 |
|
1 |
default: |
1252 |
|
1 |
return GX_NOT_SUPPORTED; |
1253 |
|
|
} |
1254 |
|
|
|
1255 |
|
179 |
return GX_SUCCESS; |
1256 |
|
|
} |
1257 |
|
|
|
1258 |
|
|
/**************************************************************************/ |
1259 |
|
|
/* */ |
1260 |
|
|
/* FUNCTION RELEASE */ |
1261 |
|
|
/* */ |
1262 |
|
|
/* _gx_image_reader_pixel_write_callback_set PORTABLE C */ |
1263 |
|
|
/* 6.1.3 */ |
1264 |
|
|
/* AUTHOR */ |
1265 |
|
|
/* */ |
1266 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
1267 |
|
|
/* */ |
1268 |
|
|
/* DESCRIPTION */ |
1269 |
|
|
/* */ |
1270 |
|
|
/* This function sets pixel write callback of the image reader. */ |
1271 |
|
|
/* */ |
1272 |
|
|
/* INPUT */ |
1273 |
|
|
/* */ |
1274 |
|
|
/* image_reader Image reader control block */ |
1275 |
|
|
/* outmap Outpu pixelmap. */ |
1276 |
|
|
/* */ |
1277 |
|
|
/* OUTPUT */ |
1278 |
|
|
/* */ |
1279 |
|
|
/* Completion Status */ |
1280 |
|
|
/* */ |
1281 |
|
|
/* CALLS */ |
1282 |
|
|
/* */ |
1283 |
|
|
/* _gx_image_reader_565rgb_rle_pixel_write */ |
1284 |
|
|
/* Write 565 rgb fromat pixel */ |
1285 |
|
|
/* in compress mode */ |
1286 |
|
|
/* _gx_image_reader_565rgb_pixel_write Write 565 rgb format pixel */ |
1287 |
|
|
/* _gx_image_reader_1555xrgb_rle_pixel_write */ |
1288 |
|
|
/* Write 1555xrgb format pixel */ |
1289 |
|
|
/* in compress mode */ |
1290 |
|
|
/* _gx_image_reader_1555xrgb_pixel_write Write 1555xrgb format pixel */ |
1291 |
|
|
/* _gx_image_reader_4444argb_transparent_write */ |
1292 |
|
|
/* Write 4444argb format pixel */ |
1293 |
|
|
/* with transparency */ |
1294 |
|
|
/* _gx_image_reader_4444argb_pixel_write Write 4444argb format pixel */ |
1295 |
|
|
/* _gx_image_reader_32argb_pixel_write Write 32argb format pixel */ |
1296 |
|
|
/* _gx_image_reader_24xrgb_pixel_write Write 24xrgb format pixel */ |
1297 |
|
|
/* _gx_image_reader_8bit_alpha_write Write 8bit alphamap format */ |
1298 |
|
|
/* pixel */ |
1299 |
|
|
/* _gx_image_reader_8bit_palette_write Write 8bit palette format */ |
1300 |
|
|
/* pixel */ |
1301 |
|
|
/* _gx_image_reader_4bit_grayscale_transparent_write */ |
1302 |
|
|
/* Write 4bit grayscale format */ |
1303 |
|
|
/* pixel with transparency */ |
1304 |
|
|
/* _gx_image_reader_4bit_grayscale_pixel_write */ |
1305 |
|
|
/* Write 4bit grayscale format */ |
1306 |
|
|
/* pixel */ |
1307 |
|
|
/* _gx_image_reader_monochrome_transparent_write */ |
1308 |
|
|
/* Write 1bpp format pixel with */ |
1309 |
|
|
/* transparency */ |
1310 |
|
|
/* _gx_image_reader_monochrome_pixel_write */ |
1311 |
|
|
/* Write 1bpp format pixel */ |
1312 |
|
|
/* _gx_system_memory_allocator Application defined memory */ |
1313 |
|
|
/* allocator function */ |
1314 |
|
|
/* _gx_system_memory_free Application defined memory */ |
1315 |
|
|
/* free function */ |
1316 |
|
|
/* */ |
1317 |
|
|
/* CALLED BY */ |
1318 |
|
|
/* */ |
1319 |
|
|
/* _gx_image_reader_colorspace_convert */ |
1320 |
|
|
/* */ |
1321 |
|
|
/**************************************************************************/ |
1322 |
|
1150 |
UINT _gx_image_reader_pixel_write_callback_set(GX_IMAGE_READER *image_reader, GX_PIXELMAP *outmap) |
1323 |
|
|
{ |
1324 |
|
|
/* Allocate memory for data of the output pixelmap. */ |
1325 |
✓✓ |
1150 |
if (outmap -> gx_pixelmap_data_size) |
1326 |
|
|
{ |
1327 |
|
953 |
outmap -> gx_pixelmap_data = (GX_UBYTE *)_gx_system_memory_allocator(outmap -> gx_pixelmap_data_size); |
1328 |
|
|
|
1329 |
✓✓ |
953 |
if (outmap -> gx_pixelmap_data == GX_NULL) |
1330 |
|
|
{ |
1331 |
|
2 |
return GX_SYSTEM_MEMORY_ERROR; |
1332 |
|
|
} |
1333 |
|
|
|
1334 |
|
951 |
memset((void *)outmap -> gx_pixelmap_data, 0, outmap -> gx_pixelmap_data_size); |
1335 |
|
|
|
1336 |
|
951 |
image_reader -> gx_image_reader_putdata = (GX_UBYTE *)outmap -> gx_pixelmap_data; |
1337 |
|
|
} |
1338 |
|
|
|
1339 |
|
|
/* Allocate memory for aux data of the output pixelmap. */ |
1340 |
✓✓ |
1148 |
if (outmap -> gx_pixelmap_aux_data_size) |
1341 |
|
|
{ |
1342 |
|
185 |
outmap -> gx_pixelmap_aux_data = (GX_UBYTE *)_gx_system_memory_allocator(outmap -> gx_pixelmap_aux_data_size); |
1343 |
|
|
|
1344 |
✓✓ |
185 |
if (outmap -> gx_pixelmap_aux_data == GX_NULL) |
1345 |
|
|
{ |
1346 |
|
1 |
_gx_system_memory_free((void *)outmap -> gx_pixelmap_data); |
1347 |
|
1 |
outmap -> gx_pixelmap_data = GX_NULL; |
1348 |
|
1 |
return GX_SYSTEM_MEMORY_ERROR; |
1349 |
|
|
} |
1350 |
|
|
|
1351 |
|
184 |
memset((void *)outmap -> gx_pixelmap_aux_data, 0, outmap -> gx_pixelmap_aux_data_size); |
1352 |
|
|
|
1353 |
|
184 |
image_reader -> gx_image_reader_putauxdata = (GX_UBYTE *)outmap -> gx_pixelmap_aux_data; |
1354 |
|
|
} |
1355 |
|
|
|
1356 |
✓✓ |
1147 |
if (image_reader -> gx_image_reader_mode & (GX_IMAGE_READER_MODE_ROTATE_CW | GX_IMAGE_READER_MODE_ROTATE_CCW)) |
1357 |
|
|
{ |
1358 |
|
180 |
return _gx_image_reader_pixel_rotated_write_callback_set(image_reader, outmap); |
1359 |
|
|
} |
1360 |
|
|
|
1361 |
|
|
/* Set pixel write callback. */ |
1362 |
✓✓✓✓ ✓✓✓✓ ✓ |
967 |
switch (outmap -> gx_pixelmap_format) |
1363 |
|
|
{ |
1364 |
|
252 |
case GX_COLOR_FORMAT_565RGB: |
1365 |
✓✓ |
252 |
if (outmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
1366 |
|
|
{ |
1367 |
|
61 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_565rgb_rle_pixel_write; |
1368 |
|
|
} |
1369 |
|
|
else |
1370 |
|
|
{ |
1371 |
|
191 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_565rgb_pixel_write; |
1372 |
|
|
} |
1373 |
|
252 |
break; |
1374 |
|
|
|
1375 |
|
54 |
case GX_COLOR_FORMAT_1555XRGB: |
1376 |
✓✓ |
54 |
if (outmap -> gx_pixelmap_flags & GX_PIXELMAP_COMPRESSED) |
1377 |
|
|
{ |
1378 |
|
32 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_1555xrgb_rle_pixel_write; |
1379 |
|
|
} |
1380 |
|
|
else |
1381 |
|
|
{ |
1382 |
|
22 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_1555xrgb_pixel_write; |
1383 |
|
|
} |
1384 |
|
54 |
break; |
1385 |
|
|
|
1386 |
|
38 |
case GX_COLOR_FORMAT_4444ARGB: |
1387 |
✓✓ |
38 |
if (outmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA) |
1388 |
|
|
{ |
1389 |
|
11 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_4444argb_transparent_write; |
1390 |
|
|
} |
1391 |
|
|
else |
1392 |
|
|
{ |
1393 |
|
27 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_4444argb_pixel_write; |
1394 |
|
|
} |
1395 |
|
38 |
break; |
1396 |
|
|
|
1397 |
|
178 |
case GX_COLOR_FORMAT_32ARGB: |
1398 |
|
|
case GX_COLOR_FORMAT_24XRGB: |
1399 |
✓✓ |
178 |
if (outmap -> gx_pixelmap_flags & GX_PIXELMAP_ALPHA) |
1400 |
|
|
{ |
1401 |
|
70 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_32argb_pixel_write; |
1402 |
|
|
} |
1403 |
|
|
else |
1404 |
|
|
{ |
1405 |
|
108 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_24xrgb_pixel_write; |
1406 |
|
|
} |
1407 |
|
178 |
break; |
1408 |
|
|
|
1409 |
|
238 |
case GX_COLOR_FORMAT_8BIT_ALPHAMAP: |
1410 |
|
238 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_8bit_alpha_write; |
1411 |
|
238 |
break; |
1412 |
|
|
|
1413 |
|
108 |
case GX_COLOR_FORMAT_8BIT_PALETTE: |
1414 |
|
108 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_8bit_palette_write; |
1415 |
|
108 |
break; |
1416 |
|
|
|
1417 |
|
47 |
case GX_COLOR_FORMAT_4BIT_GRAY: |
1418 |
✓✓ |
47 |
if (outmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT) |
1419 |
|
|
{ |
1420 |
|
15 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_4bit_grayscale_transparent_write; |
1421 |
|
|
} |
1422 |
|
|
else |
1423 |
|
|
{ |
1424 |
|
32 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_4bit_grayscale_pixel_write; |
1425 |
|
|
} |
1426 |
|
47 |
image_reader -> gx_image_reader_putdata_mask = 0xf0; |
1427 |
|
47 |
image_reader -> gx_image_reader_putauxdata_mask = 0x80; |
1428 |
|
47 |
break; |
1429 |
|
|
|
1430 |
|
51 |
case GX_COLOR_FORMAT_MONOCHROME: |
1431 |
✓✓ |
51 |
if (outmap -> gx_pixelmap_flags & GX_PIXELMAP_TRANSPARENT) |
1432 |
|
|
{ |
1433 |
|
22 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_monochrome_transparent_write; |
1434 |
|
|
} |
1435 |
|
|
else |
1436 |
|
|
{ |
1437 |
|
29 |
image_reader -> gx_image_reader_pixel_write = _gx_image_reader_monochrome_pixel_write; |
1438 |
|
|
} |
1439 |
|
51 |
image_reader -> gx_image_reader_putdata_mask = 0x80; |
1440 |
|
51 |
break; |
1441 |
|
|
|
1442 |
|
1 |
default: |
1443 |
|
1 |
return GX_NOT_SUPPORTED; |
1444 |
|
|
} |
1445 |
|
|
|
1446 |
|
966 |
return GX_SUCCESS; |
1447 |
|
|
} |
1448 |
|
|
#endif |
1449 |
|
|
|