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 /**   PIXELMAP Management (PIXELMAP)                                      */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_widget.h"
28 
29 
30 /**************************************************************************/
31 /*                                                                        */
32 /*  FUNCTION                                               RELEASE        */
33 /*                                                                        */
34 /*    _gx_widget_transparent_pixelmap_detect              PORTABLE C      */
35 /*                                                           6.1          */
36 /*  AUTHOR                                                                */
37 /*                                                                        */
38 /*    Kenneth Maxwell, Microsoft Corporation                              */
39 /*                                                                        */
40 /*  DESCRIPTION                                                           */
41 /*                                                                        */
42 /*    This function detects whether or not a pixelmap contains            */
43 /*    transparency.                                                       */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    pixelmap_id                           Pixelmap ID                   */
48 /*                                                                        */
49 /*  OUTPUT                                                                */
50 /*                                                                        */
51 /*    GX_TRUE or GX_FALSE                                                 */
52 /*                                                                        */
53 /*  CALLS                                                                 */
54 /*                                                                        */
55 /*    _gx_widget_canvas_get                 Retrieve canvas               */
56 /*                                                                        */
57 /*                                                                        */
58 /*  CALLED BY                                                             */
59 /*                                                                        */
60 /*    Application Code                                                    */
61 /*                                                                        */
62 /*  RELEASE HISTORY                                                       */
63 /*                                                                        */
64 /*    DATE              NAME                      DESCRIPTION             */
65 /*                                                                        */
66 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
67 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
68 /*                                            resulting in version 6.1    */
69 /*                                                                        */
70 /**************************************************************************/
_gx_widget_transparent_pixelmap_detect(GX_WIDGET * widget,GX_RESOURCE_ID pixelmap_id)71 GX_BOOL _gx_widget_transparent_pixelmap_detect(GX_WIDGET *widget, GX_RESOURCE_ID pixelmap_id)
72 {
73 GX_PIXELMAP *map;
74 GX_CANVAS   *canvas;
75 GX_DISPLAY  *display;
76 
77     if (widget -> gx_widget_status & GX_STATUS_VISIBLE)
78     {
79         _gx_widget_canvas_get(widget, &canvas);
80 
81         if (canvas)
82         {
83             display = canvas -> gx_canvas_display;
84 
85             if (pixelmap_id < display -> gx_display_pixelmap_table_size)
86             {
87                 map = display -> gx_display_pixelmap_table[pixelmap_id];
88 
89                 if (map)
90                 {
91                     if (map -> gx_pixelmap_flags & (GX_PIXELMAP_TRANSPARENT | GX_PIXELMAP_ALPHA))
92                     {
93                         return GX_TRUE;
94                     }
95                 }
96             }
97         }
98     }
99     return GX_FALSE;
100 }
101 
102