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 /**   Radial Slider Management (Slider)                                   */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_widget.h"
29 #include "gx_context.h"
30 #include "gx_canvas.h"
31 #include "gx_radial_slider.h"
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gx_radial_slider_draw                              PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function draws a radial slider widget.                         */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    slider                                Radial slider control block   */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    None                                                                */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*    _gx_widget_draw                       Default widget draw           */
58 /*    _gx_context_pixelmap_get              Retrieve pixelmap with        */
59 /*                                            specified pixelmap id       */
60 /*    _gx_canvas_pixelmap_draw              Draw a pixelmap to canvas     */
61 /*    _gx_widget_children_draw              Draw widget children          */
62 /*    _gx_radial_slider_needle_rectangle_get                              */
63 /*                                          Retrive needle bounding       */
64 /*                                            rectangle                   */
65 /*                                                                        */
66 /*  CALLED BY                                                             */
67 /*                                                                        */
68 /*    GUIX Internal Code                                                  */
69 /*    Application Code                                                    */
70 /*                                                                        */
71 /*  RELEASE HISTORY                                                       */
72 /*                                                                        */
73 /*    DATE              NAME                      DESCRIPTION             */
74 /*                                                                        */
75 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
76 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
77 /*                                            resulting in version 6.1    */
78 /*                                                                        */
79 /**************************************************************************/
_gx_radial_slider_draw(GX_RADIAL_SLIDER * slider)80 VOID  _gx_radial_slider_draw(GX_RADIAL_SLIDER *slider)
81 {
82 GX_PIXELMAP *map = GX_NULL;
83 GX_RECTANGLE size;
84 
85     /* Call default widget draw. */
86     _gx_widget_background_draw((GX_WIDGET *)slider);
87 
88     _gx_context_pixelmap_get(slider -> gx_radial_slider_info.gx_radial_slider_info_background_pixelmap, &map);
89 
90     _gx_widget_context_fill_set((GX_WIDGET *)slider);
91 
92     if (map)
93     {
94         /* Draw background pixelmap. */
95         _gx_canvas_pixelmap_draw(slider -> gx_widget_size.gx_rectangle_left, slider -> gx_widget_size.gx_rectangle_top, map);
96     }
97 
98     /* Pick needle pixelmap. */
99     _gx_context_pixelmap_get(slider -> gx_radial_slider_info.gx_radial_slider_info_needle_pixelmap, &map);
100 
101     if (map)
102     {
103         /* Calcualte needle bounding rectangle. */
104         _gx_radial_slider_needle_rectangle_calculate(slider, &size);
105 
106         /* Draw needle. */
107         _gx_canvas_pixelmap_draw(size.gx_rectangle_left, size.gx_rectangle_top, map);
108     }
109 
110     /* Draw children widgets. */
111     _gx_widget_children_draw((GX_WIDGET *)slider);
112 }
113 
114