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