1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* |
4 |
|
|
* This program and the accompanying materials are made available under the |
5 |
|
|
* terms of the MIT License which is available at |
6 |
|
|
* https://opensource.org/licenses/MIT. |
7 |
|
|
* |
8 |
|
|
* SPDX-License-Identifier: MIT |
9 |
|
|
**************************************************************************/ |
10 |
|
|
|
11 |
|
|
|
12 |
|
|
/**************************************************************************/ |
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/** */ |
15 |
|
|
/** GUIX Component */ |
16 |
|
|
/** */ |
17 |
|
|
/** Image Reader Management (Image Reader) */ |
18 |
|
|
/** */ |
19 |
|
|
/**************************************************************************/ |
20 |
|
|
|
21 |
|
|
#define GX_SOURCE_CODE |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
/* Include necessary system files. */ |
25 |
|
|
|
26 |
|
|
#include "gx_api.h" |
27 |
|
|
#include "gx_image_reader.h" |
28 |
|
|
|
29 |
|
|
|
30 |
|
|
/**************************************************************************/ |
31 |
|
|
/* */ |
32 |
|
|
/* FUNCTION RELEASE */ |
33 |
|
|
/* */ |
34 |
|
|
/* _gx_image_reader_create PORTABLE C */ |
35 |
|
|
/* 6.1 */ |
36 |
|
|
/* AUTHOR */ |
37 |
|
|
/* */ |
38 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
39 |
|
|
/* */ |
40 |
|
|
/* DESCRIPTION */ |
41 |
|
|
/* */ |
42 |
|
|
/* This function creates a runtime raw image reader / decoder. */ |
43 |
|
|
/* Currently only jpeg and png raw image types are supported. */ |
44 |
|
|
/* */ |
45 |
|
|
/* INPUT */ |
46 |
|
|
/* */ |
47 |
|
|
/* image_reader Image reader control block. */ |
48 |
|
|
/* read_data Pointer to raw input data. */ |
49 |
|
|
/* read_data_size Size of raw input data. */ |
50 |
|
|
/* color_format The requested output color format */ |
51 |
|
|
/* mode Compress dither and alpha modes flags */ |
52 |
|
|
/* */ |
53 |
|
|
/* OUTPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* Completion Status */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLS */ |
58 |
|
|
/* */ |
59 |
|
|
/* None */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* Application Code */ |
64 |
|
|
/* */ |
65 |
|
|
/* RELEASE HISTORY */ |
66 |
|
|
/* */ |
67 |
|
|
/* DATE NAME DESCRIPTION */ |
68 |
|
|
/* */ |
69 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
70 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
71 |
|
|
/* resulting in version 6.1 */ |
72 |
|
|
/* */ |
73 |
|
|
/**************************************************************************/ |
74 |
|
|
#if defined(GX_SOFTWARE_DECODER_SUPPORT) |
75 |
|
985 |
UINT _gx_image_reader_create(GX_IMAGE_READER *image_reader, |
76 |
|
|
GX_CONST GX_UBYTE *data, |
77 |
|
|
INT data_size, |
78 |
|
|
GX_UBYTE color_format, |
79 |
|
|
GX_UBYTE mode) |
80 |
|
|
{ |
81 |
|
985 |
image_reader -> gx_image_reader_color_format = color_format; |
82 |
|
985 |
image_reader -> gx_image_reader_mode = mode; |
83 |
|
985 |
image_reader -> gx_image_reader_image_type = 0; |
84 |
|
985 |
image_reader -> gx_image_reader_source_data = data; |
85 |
|
985 |
image_reader -> gx_image_reader_source_data_size = (UINT)data_size; |
86 |
|
985 |
image_reader -> gx_image_reader_getdata = GX_NULL; |
87 |
|
985 |
image_reader -> gx_image_reader_getauxdata = GX_NULL; |
88 |
|
985 |
image_reader -> gx_image_reader_putauxdata = GX_NULL; |
89 |
|
985 |
image_reader -> gx_image_reader_palette = GX_NULL; |
90 |
|
985 |
image_reader -> gx_image_reader_palette_size = 0; |
91 |
|
985 |
image_reader -> gx_image_reader_image_height = 0; |
92 |
|
985 |
image_reader -> gx_image_reader_image_width = 0; |
93 |
|
985 |
image_reader -> gx_image_reader_png_trans = 0; |
94 |
|
985 |
image_reader -> gx_image_reader_png_palette = GX_NULL; |
95 |
|
985 |
image_reader -> gx_image_reader_png_palette_size = 0; |
96 |
|
985 |
image_reader -> gx_image_reader_putdata = GX_NULL; |
97 |
|
985 |
image_reader -> gx_image_reader_putauxdata = GX_NULL; |
98 |
|
985 |
image_reader -> gx_image_reader_pixel_read = GX_NULL; |
99 |
|
985 |
image_reader -> gx_image_reader_pixel_write = GX_NULL; |
100 |
|
985 |
image_reader -> gx_image_reader_size_testing = GX_FALSE; |
101 |
|
985 |
image_reader -> gx_image_reader_mono_shreshold = 128; |
102 |
|
985 |
image_reader -> gx_image_reader_putdata_mask = 0; |
103 |
|
985 |
image_reader -> gx_image_reader_putauxdata_mask = 0; |
104 |
|
|
|
105 |
|
985 |
return GX_SUCCESS; |
106 |
|
|
} |
107 |
|
|
#endif |
108 |
|
|
|