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 /**   Widget Management (Widget)                                          */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_canvas.h"
28 #include "gx_system.h"
29 
30 /* Bring in externs for caller checking code.  */
31 GX_CALLER_CHECKING_EXTERNS
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gxe_canvas_pie_draw                                PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function checks for errors in canvas pie draw function call.   */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    xcenter                               x-coord of center of circle   */
50 /*                                            arc                         */
51 /*    ycenter                               y-coord of center of circle   */
52 /*                                            arc                         */
53 /*    r                                     Radius of circle arc          */
54 /*    start_angle                           The start angle of the pie    */
55 /*    end_angle                             The end angle of the pie      */
56 /*                                                                        */
57 /*  OUTPUT                                                                */
58 /*                                                                        */
59 /*    status                                Completion status             */
60 /*                                                                        */
61 /*  CALLS                                                                 */
62 /*                                                                        */
63 /*    _gx_canvas_pie_draw                   Actual canvas pie draw        */
64 /*                                            function                    */
65 /*                                                                        */
66 /*  CALLED BY                                                             */
67 /*                                                                        */
68 /*    Application 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 /**************************************************************************/
_gxe_canvas_pie_draw(INT xcenter,INT ycenter,UINT r,INT start_angle,INT end_angle)79 UINT _gxe_canvas_pie_draw(INT xcenter, INT ycenter, UINT r, INT start_angle, INT end_angle)
80 {
81 UINT status;
82 
83     /* Check for appropriate caller.  */
84     GX_INIT_AND_THREADS_CALLER_CHECKING
85 
86     /* Check for invalid value. */
87     if (r == 0)
88     {
89         return GX_INVALID_VALUE;
90     }
91 
92     /* Check for invalid draw context. */
93     if (_gx_system_current_draw_context == GX_NULL)
94     {
95         return GX_INVALID_CONTEXT;
96     }
97 
98     /* Call actual widget draw function.  */
99     status = _gx_canvas_pie_draw(xcenter, ycenter, r, start_angle, end_angle);
100 
101     /* Return completion status.  */
102     return(status);
103 }
104 
105