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_widget.h" |
28 |
|
|
#include "gx_utility.h" |
29 |
|
|
|
30 |
|
|
/* Bring in externs for caller checking code. */ |
31 |
|
|
GX_CALLER_CHECKING_EXTERNS |
32 |
|
|
|
33 |
|
|
/**************************************************************************/ |
34 |
|
|
/* */ |
35 |
|
|
/* FUNCTION RELEASE */ |
36 |
|
|
/* */ |
37 |
|
|
/* _gxe_widget_text_blend PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* This function checks for errors in the widget text blend function */ |
46 |
|
|
/* call. */ |
47 |
|
|
/* */ |
48 |
|
|
/* INPUT */ |
49 |
|
|
/* */ |
50 |
|
|
/* widget Widget control block */ |
51 |
|
|
/* tColor Text Color */ |
52 |
|
|
/* font_id Font Id */ |
53 |
|
|
/* string Drawing string */ |
54 |
|
|
/* x_offset Drawing position adjustment */ |
55 |
|
|
/* y_offset Drawing position adjustment */ |
56 |
|
|
/* alpha Blending value 0-255 */ |
57 |
|
|
/* */ |
58 |
|
|
/* OUTPUT */ |
59 |
|
|
/* */ |
60 |
|
|
/* status Completion status */ |
61 |
|
|
/* */ |
62 |
|
|
/* CALLS */ |
63 |
|
|
/* */ |
64 |
|
|
/* _gx_widget_text_blend Actual widget text blend */ |
65 |
|
|
/* function */ |
66 |
|
|
/* */ |
67 |
|
|
/* CALLED BY */ |
68 |
|
|
/* */ |
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 |
|
|
/**************************************************************************/ |
80 |
|
|
#if defined(GX_ENABLE_DEPRECATED_STRING_API) |
81 |
|
77 |
UINT _gxe_widget_text_blend(GX_WIDGET *widget, |
82 |
|
|
UINT tColor, UINT font_id, |
83 |
|
|
GX_CONST GX_CHAR *string, INT x_offset, INT y_offset, UCHAR alpha) |
84 |
|
|
{ |
85 |
|
|
UINT status; |
86 |
|
|
|
87 |
|
|
/* Check for appropriate caller. */ |
88 |
✓✓✓✓ ✓✓ |
77 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
89 |
|
|
|
90 |
|
|
/* Check for invalid input pointers. */ |
91 |
✓✓ |
75 |
if (widget == GX_NULL) |
92 |
|
|
{ |
93 |
|
1 |
return(GX_PTR_ERROR); |
94 |
|
|
} |
95 |
|
|
|
96 |
|
|
/* Check for invalid widget. */ |
97 |
✓✓ |
74 |
if (widget -> gx_widget_type == 0) |
98 |
|
|
{ |
99 |
|
1 |
return(GX_INVALID_WIDGET); |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
/* Call actual widget text blend function. */ |
103 |
|
73 |
status = _gx_widget_text_blend(widget, tColor, font_id, string, x_offset, y_offset, alpha); |
104 |
|
|
|
105 |
|
|
/* Return completion status. */ |
106 |
|
73 |
return(status); |
107 |
|
|
} |
108 |
|
|
#endif |
109 |
|
|
|
110 |
|
|
/**************************************************************************/ |
111 |
|
|
/* */ |
112 |
|
|
/* FUNCTION RELEASE */ |
113 |
|
|
/* */ |
114 |
|
|
/* _gxe_widget_text_blend_ext PORTABLE C */ |
115 |
|
|
/* 6.1 */ |
116 |
|
|
/* AUTHOR */ |
117 |
|
|
/* */ |
118 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
119 |
|
|
/* */ |
120 |
|
|
/* DESCRIPTION */ |
121 |
|
|
/* */ |
122 |
|
|
/* This function checks for errors in the widget text blend function */ |
123 |
|
|
/* call. */ |
124 |
|
|
/* */ |
125 |
|
|
/* INPUT */ |
126 |
|
|
/* */ |
127 |
|
|
/* widget Widget control block */ |
128 |
|
|
/* tColor Text Color */ |
129 |
|
|
/* font_id Font Id */ |
130 |
|
|
/* string Drawing string */ |
131 |
|
|
/* x_offset Drawing position adjustment */ |
132 |
|
|
/* y_offset Drawing position adjustment */ |
133 |
|
|
/* alpha Blending value 0-255 */ |
134 |
|
|
/* */ |
135 |
|
|
/* OUTPUT */ |
136 |
|
|
/* */ |
137 |
|
|
/* status Completion status */ |
138 |
|
|
/* */ |
139 |
|
|
/* CALLS */ |
140 |
|
|
/* */ |
141 |
|
|
/* _gx_widget_text_blend Actual widget text blend */ |
142 |
|
|
/* function */ |
143 |
|
|
/* */ |
144 |
|
|
/* CALLED BY */ |
145 |
|
|
/* */ |
146 |
|
|
/* Application Code */ |
147 |
|
|
/* */ |
148 |
|
|
/* RELEASE HISTORY */ |
149 |
|
|
/* */ |
150 |
|
|
/* DATE NAME DESCRIPTION */ |
151 |
|
|
/* */ |
152 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
153 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
154 |
|
|
/* resulting in version 6.1 */ |
155 |
|
|
/* */ |
156 |
|
|
/**************************************************************************/ |
157 |
|
154 |
UINT _gxe_widget_text_blend_ext(GX_WIDGET *widget, UINT tColor, UINT font_id, |
158 |
|
|
GX_CONST GX_STRING *string, INT x_offset, INT y_offset, UCHAR alpha) |
159 |
|
|
{ |
160 |
|
|
UINT status; |
161 |
|
154 |
UINT text_length = 0; |
162 |
|
|
|
163 |
|
|
/* Check for appropriate caller. */ |
164 |
✓✓✓✓ ✓✓ |
154 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
165 |
|
|
|
166 |
|
|
/* Check for invalid input pointers. */ |
167 |
✓✓ |
152 |
if (widget == GX_NULL) |
168 |
|
|
{ |
169 |
|
1 |
return(GX_PTR_ERROR); |
170 |
|
|
} |
171 |
|
|
|
172 |
|
|
/* Check for invalid widget. */ |
173 |
✓✓ |
151 |
if (widget -> gx_widget_type == 0) |
174 |
|
|
{ |
175 |
|
1 |
return(GX_INVALID_WIDGET); |
176 |
|
|
} |
177 |
|
|
|
178 |
✓✓ |
150 |
if (string) |
179 |
|
|
{ |
180 |
✓✓ |
149 |
if (string -> gx_string_ptr) |
181 |
|
|
{ |
182 |
|
147 |
status = _gx_utility_string_length_check(string -> gx_string_ptr, &text_length, string -> gx_string_length); |
183 |
|
|
|
184 |
✓✓ |
147 |
if (status != GX_SUCCESS) |
185 |
|
|
{ |
186 |
|
1 |
return status; |
187 |
|
|
} |
188 |
|
|
} |
189 |
|
|
|
190 |
✓✓ |
148 |
if (text_length != string -> gx_string_length) |
191 |
|
|
{ |
192 |
|
2 |
return GX_INVALID_STRING_LENGTH; |
193 |
|
|
} |
194 |
|
|
} |
195 |
|
|
|
196 |
|
|
/* Call actual widget text blend function. */ |
197 |
|
147 |
status = _gx_widget_text_blend_ext(widget, tColor, font_id, string, x_offset, y_offset, alpha); |
198 |
|
|
|
199 |
|
|
/* Return completion status. */ |
200 |
|
147 |
return(status); |
201 |
|
|
} |
202 |
|
|
|