1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Display Management (Display)                                        */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_context.h"
29 #include "gx_system.h"
30 #include "gx_display.h"
31 #include "gx_image_reader.h"
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gx_display_driver_565rgb_png_draw                  PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    565rgb format display driver PNG drawing function.                  */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    context                               Drawing context               */
50 /*    xpos                                  x-coord of top-left draw point*/
51 /*    ypos                                  y-coord of top-left draw point*/
52 /*    pixelmap                              Pointer to GX_PIXELMAP struct */
53 /*                                                                        */
54 /*  OUTPUT                                                                */
55 /*                                                                        */
56 /*    None                                                                */
57 /*                                                                        */
58 /*  CALLS                                                                 */
59 /*                                                                        */
60 /*    _gx_image_reader_create                                             */
61 /*    _gx_image_reader_start                                              */
62 /*    _gx_display_driver_565rgb_pixelmap_draw                             */
63 /*    _gx_system_memory_free                                              */
64 /*                                                                        */
65 /*  CALLED BY                                                             */
66 /*                                                                        */
67 /*    Application Code                                                    */
68 /*    GUIX Internal Code                                                  */
69 /*                                                                        */
70 /*  RELEASE HISTORY                                                       */
71 /*                                                                        */
72 /*    DATE              NAME                      DESCRIPTION             */
73 /*                                                                        */
74 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
75 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
76 /*                                            resulting in version 6.1    */
77 /*                                                                        */
78 /**************************************************************************/
79 #if defined(GX_SOFTWARE_DECODER_SUPPORT)
_gx_display_driver_565rgb_png_draw(GX_DRAW_CONTEXT * context,INT xpos,INT ypos,GX_PIXELMAP * pixelmap)80 VOID _gx_display_driver_565rgb_png_draw(GX_DRAW_CONTEXT *context, INT xpos, INT ypos, GX_PIXELMAP *pixelmap)
81 {
82 GX_IMAGE_READER image_reader;
83 GX_PIXELMAP     pic_outmap;
84 
85     _gx_image_reader_create(&image_reader,
86                             pixelmap -> gx_pixelmap_data,
87                             (INT)(pixelmap -> gx_pixelmap_data_size),
88                             GX_COLOR_FORMAT_565RGB, GX_IMAGE_READER_MODE_ALPHA);
89 
90     if (_gx_image_reader_start(&image_reader, &pic_outmap) == GX_SUCCESS)
91     {
92         _gx_display_driver_565rgb_pixelmap_draw(context, xpos, ypos, &pic_outmap);
93 
94         _gx_system_memory_free((VOID *)pic_outmap.gx_pixelmap_data);
95 
96         if (pic_outmap.gx_pixelmap_aux_data)
97         {
98             _gx_system_memory_free((VOID *)pic_outmap.gx_pixelmap_aux_data);
99         }
100     }
101 }
102 #endif
103 
104