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 /*  FUNCTION                                               RELEASE        */
32 /*                                                                        */
33 /*    _gxe_image_reader_create                            PORTABLE C      */
34 /*                                                           6.1          */
35 /*  AUTHOR                                                                */
36 /*                                                                        */
37 /*    Kenneth Maxwell, Microsoft Corporation                              */
38 /*                                                                        */
39 /*  DESCRIPTION                                                           */
40 /*                                                                        */
41 /*    This function checks for errors in creating an image reader         */
42 /*    instance.                                                           */
43 /*                                                                        */
44 /*  INPUT                                                                 */
45 /*                                                                        */
46 /*    image_reader              Image reader control block.               */
47 /*    read_data                 pointer to raw input data.                */
48 /*    read_data_size            size of raw input data.                   */
49 /*    color_format              the requested output color format         */
50 /*    mode                      compress dither and alpha modes flags     */
51 /*                                                                        */
52 /*  OUTPUT                                                                */
53 /*                                                                        */
54 /*    status                    Completion status                         */
55 /*                                                                        */
56 /*  CALLS                                                                 */
57 /*   _gx_image_reader_create    Actual image reader create call.          */
58 /*                                                                        */
59 /*  CALLED BY                                                             */
60 /*                                                                        */
61 /*    Application Code                                                    */
62 /*                                                                        */
63 /*  RELEASE HISTORY                                                       */
64 /*                                                                        */
65 /*    DATE              NAME                      DESCRIPTION             */
66 /*                                                                        */
67 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
68 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
69 /*                                            resulting in version 6.1    */
70 /*                                                                        */
71 /**************************************************************************/
72 #if defined(GX_SOFTWARE_DECODER_SUPPORT)
_gxe_image_reader_create(GX_IMAGE_READER * image_reader,GX_CONST GX_UBYTE * read_data,INT read_data_size,GX_UBYTE color_format,GX_UBYTE mode)73 UINT  _gxe_image_reader_create(GX_IMAGE_READER *image_reader,
74                                GX_CONST GX_UBYTE *read_data,
75                                INT read_data_size,
76                                GX_UBYTE color_format,
77                                GX_UBYTE mode)
78 {
79 UINT status;
80 
81     /* Check for invalid input pointers.  */
82     if ((image_reader == GX_NULL) || (read_data == GX_NULL))
83     {
84         return(GX_PTR_ERROR);
85     }
86 
87     if (read_data_size <= 20)
88     {
89         return(GX_INVALID_VALUE);
90     }
91 
92     /* Call the actual image reader info set function.  */
93     status = _gx_image_reader_create(image_reader, read_data, read_data_size, color_format, mode);
94 
95     /* Return completion status.  */
96     return status;
97 }
98 #endif
99 
100