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_ellipse_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 ellipse draw function     */
46 /*    call.                                                               */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    xcenter                               x-coord of center of ellipse  */
51 /*    ycenter                               y-coord of center of ellipse  */
52 /*    r                                     Radius of circle              */
53 /*    a                                     Length of the Semi-major Axis */
54 /*    b                                     Length of the Semi-minor Axis */
55 /*                                                                        */
56 /*  OUTPUT                                                                */
57 /*                                                                        */
58 /*    status                                Completion status             */
59 /*                                                                        */
60 /*  CALLS                                                                 */
61 /*                                                                        */
62 /*    _gx_canvas_ellipse_draw               Actual canvas ellipse draw    */
63 /*                                            function                    */
64 /*                                                                        */
65 /*  CALLED BY                                                             */
66 /*                                                                        */
67 /*    Application Code                                                    */
68 /*                                                                        */
69 /*  RELEASE HISTORY                                                       */
70 /*                                                                        */
71 /*    DATE              NAME                      DESCRIPTION             */
72 /*                                                                        */
73 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
74 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
75 /*                                            resulting in version 6.1    */
76 /*                                                                        */
77 /**************************************************************************/
_gxe_canvas_ellipse_draw(INT xcenter,INT ycenter,INT a,INT b)78 UINT _gxe_canvas_ellipse_draw(INT xcenter, INT ycenter, INT a, INT b)
79 {
80 UINT status;
81 
82     /* Check for appropriate caller.  */
83     GX_INIT_AND_THREADS_CALLER_CHECKING
84 
85     /* Check for invalid input values.  */
86     if ((a <= 0) || (b <= 0))
87     {
88         return(GX_INVALID_VALUE);
89     }
90 
91     /* Check for invalid draw context. */
92     if (_gx_system_current_draw_context == GX_NULL)
93     {
94         return GX_INVALID_CONTEXT;
95     }
96 
97     /* Call actual widget draw function.  */
98     status = _gx_canvas_ellipse_draw(xcenter, ycenter, a, b);
99 
100     /* Return completion status.  */
101     return(status);
102 }
103 
104