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 /**   Canvas Management (Canvas)                                          */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_system.h"
28 #include "gx_utility.h"
29 #include "gx_canvas.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gx_canvas_alpha_set                                PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function assigns the alpha-blend value of a canvas             */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    canvas                                Canvas control block          */
49 /*    alpha                                 alpha value                   */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    status                                Completion status             */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*    _gx_canvas_dirty_mark                 Set the canvas dirty flag     */
58 /*                                                                        */
59 /*  CALLED BY                                                             */
60 /*                                                                        */
61 /*    _gx_animation_start                                                 */
62 /*    _gx_animation_update                                                */
63 /*                                                                        */
64 /*  RELEASE HISTORY                                                       */
65 /*                                                                        */
66 /*    DATE              NAME                      DESCRIPTION             */
67 /*                                                                        */
68 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
69 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
70 /*                                            resulting in version 6.1    */
71 /*                                                                        */
72 /**************************************************************************/
_gx_canvas_alpha_set(GX_CANVAS * canvas,GX_UBYTE alpha)73 UINT  _gx_canvas_alpha_set(GX_CANVAS *canvas, GX_UBYTE alpha)
74 {
75 VOID (*alpha_set)(INT layer, GX_UBYTE alpha);
76 
77     /* change the alpha value */
78     canvas -> gx_canvas_alpha = alpha;
79 
80     if (canvas -> gx_canvas_hardware_layer >= 0)
81     {
82         alpha_set = canvas -> gx_canvas_display -> gx_display_layer_services -> gx_display_layer_alpha_set;
83 
84         if (alpha_set)
85         {
86             alpha_set(canvas -> gx_canvas_hardware_layer, alpha);
87             return(GX_SUCCESS);
88         }
89     }
90 
91     /* mark the canvas dirty so that it get refreshed */
92     _gx_canvas_dirty_mark(canvas, GX_NULL);
93 
94     /* Return successful status.  */
95     return(GX_SUCCESS);
96 }
97 
98