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 /** Context Management (Context) */
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_context.h"
29
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _gx_context_brush_define PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Kenneth Maxwell, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* Set the brush of the current display context. */
44 /* */
45 /* INPUT */
46 /* */
47 /* line_color_id Resource ID of line color */
48 /* fill_color_id Resource ID of fill color */
49 /* style Style of brush */
50 /* */
51 /* OUTPUT */
52 /* */
53 /* status Completion status */
54 /* */
55 /* CALLS */
56 /* */
57 /* _gx_context_color_get Retrieve context color */
58 /* _gx_brush_define Define the brush */
59 /* */
60 /* CALLED BY */
61 /* */
62 /* _gx_scrollbar_draw */
63 /* _gx_slider_needle_draw */
64 /* _gx_widget_border_draw */
65 /* */
66 /* RELEASE HISTORY */
67 /* */
68 /* DATE NAME DESCRIPTION */
69 /* */
70 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
71 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
72 /* resulting in version 6.1 */
73 /* */
74 /**************************************************************************/
_gx_context_brush_define(GX_RESOURCE_ID line_color_id,GX_RESOURCE_ID fill_color_id,UINT style)75 UINT _gx_context_brush_define(GX_RESOURCE_ID line_color_id, GX_RESOURCE_ID fill_color_id, UINT style)
76 {
77 UINT status;
78
79 GX_BRUSH *brush;
80 GX_DRAW_CONTEXT *context = _gx_system_current_draw_context;
81
82 GX_COLOR linecolor;
83 GX_COLOR fillcolor;
84
85 status = _gx_context_color_get(line_color_id, &linecolor);
86
87 if (status == GX_SUCCESS)
88 {
89 status = _gx_context_color_get(fill_color_id, &fillcolor);
90
91 if (status == GX_SUCCESS)
92 {
93 /* Set the brush. */
94 brush = &context -> gx_draw_context_brush;
95 status = _gx_brush_define(brush, linecolor, fillcolor, style);
96 }
97 }
98
99 /* Return status. */
100 return status;
101 }
102
103