Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qcolor.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | QColor::QColor(Qt::GlobalColor color) noexcept | - | ||||||||||||||||||
6 | { | - | ||||||||||||||||||
7 | - | |||||||||||||||||||
8 | - | |||||||||||||||||||
9 | - | |||||||||||||||||||
10 | - | |||||||||||||||||||
11 | - | |||||||||||||||||||
12 | static const QRgb global_colors[] = { | - | ||||||||||||||||||
13 | QRgb(((0xffu << 24) | ((255 & 0xff) << 16) | ((255 & 0xff) << 8) | (255 & 0xff))), | - | ||||||||||||||||||
14 | QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((0 & 0xff) << 8) | (0 & 0xff))), | - | ||||||||||||||||||
15 | QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((0 & 0xff) << 8) | (0 & 0xff))), | - | ||||||||||||||||||
16 | QRgb(((0xffu << 24) | ((255 & 0xff) << 16) | ((255 & 0xff) << 8) | (255 & 0xff))), | - | ||||||||||||||||||
17 | QRgb(((0xffu << 24) | ((128 & 0xff) << 16) | ((128 & 0xff) << 8) | (128 & 0xff))), | - | ||||||||||||||||||
18 | QRgb(((0xffu << 24) | ((160 & 0xff) << 16) | ((160 & 0xff) << 8) | (164 & 0xff))), | - | ||||||||||||||||||
19 | QRgb(((0xffu << 24) | ((192 & 0xff) << 16) | ((192 & 0xff) << 8) | (192 & 0xff))), | - | ||||||||||||||||||
20 | QRgb(((0xffu << 24) | ((255 & 0xff) << 16) | ((0 & 0xff) << 8) | (0 & 0xff))), | - | ||||||||||||||||||
21 | QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((255 & 0xff) << 8) | (0 & 0xff))), | - | ||||||||||||||||||
22 | QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((0 & 0xff) << 8) | (255 & 0xff))), | - | ||||||||||||||||||
23 | QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((255 & 0xff) << 8) | (255 & 0xff))), | - | ||||||||||||||||||
24 | QRgb(((0xffu << 24) | ((255 & 0xff) << 16) | ((0 & 0xff) << 8) | (255 & 0xff))), | - | ||||||||||||||||||
25 | QRgb(((0xffu << 24) | ((255 & 0xff) << 16) | ((255 & 0xff) << 8) | (0 & 0xff))), | - | ||||||||||||||||||
26 | QRgb(((0xffu << 24) | ((128 & 0xff) << 16) | ((0 & 0xff) << 8) | (0 & 0xff))), | - | ||||||||||||||||||
27 | QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((128 & 0xff) << 8) | (0 & 0xff))), | - | ||||||||||||||||||
28 | QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((0 & 0xff) << 8) | (128 & 0xff))), | - | ||||||||||||||||||
29 | QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((128 & 0xff) << 8) | (128 & 0xff))), | - | ||||||||||||||||||
30 | QRgb(((0xffu << 24) | ((128 & 0xff) << 16) | ((0 & 0xff) << 8) | (128 & 0xff))), | - | ||||||||||||||||||
31 | QRgb(((0xffu << 24) | ((128 & 0xff) << 16) | ((128 & 0xff) << 8) | (0 & 0xff))), | - | ||||||||||||||||||
32 | QRgb(((0 & 0xff) << 24) | ((0 & 0xff) << 16) | ((0 & 0xff) << 8) | (0 & 0xff)) | - | ||||||||||||||||||
33 | }; | - | ||||||||||||||||||
34 | - | |||||||||||||||||||
35 | - | |||||||||||||||||||
36 | - | |||||||||||||||||||
37 | setRgb(qRed(global_colors[color]), | - | ||||||||||||||||||
38 | qGreen(global_colors[color]), | - | ||||||||||||||||||
39 | qBlue(global_colors[color]), | - | ||||||||||||||||||
40 | qAlpha(global_colors[color])); | - | ||||||||||||||||||
41 | } never executed: end of block | 0 | ||||||||||||||||||
42 | QColor::QColor(QRgb color) noexcept | - | ||||||||||||||||||
43 | { | - | ||||||||||||||||||
44 | cspec = Rgb; | - | ||||||||||||||||||
45 | ct.argb.alpha = 0xffff; | - | ||||||||||||||||||
46 | ct.argb.red = qRed(color) * 0x101; | - | ||||||||||||||||||
47 | ct.argb.green = qGreen(color) * 0x101; | - | ||||||||||||||||||
48 | ct.argb.blue = qBlue(color) * 0x101; | - | ||||||||||||||||||
49 | ct.argb.pad = 0; | - | ||||||||||||||||||
50 | } never executed: end of block | 0 | ||||||||||||||||||
51 | QColor::QColor(QRgba64 rgba64) noexcept | - | ||||||||||||||||||
52 | { | - | ||||||||||||||||||
53 | setRgba64(rgba64); | - | ||||||||||||||||||
54 | } never executed: end of block | 0 | ||||||||||||||||||
55 | QColor::QColor(Spec spec) noexcept | - | ||||||||||||||||||
56 | { | - | ||||||||||||||||||
57 | switch (spec) { | - | ||||||||||||||||||
58 | case never executed: Invalid:case Invalid: never executed: case Invalid: | 0 | ||||||||||||||||||
59 | invalidate(); | - | ||||||||||||||||||
60 | break; never executed: break; | 0 | ||||||||||||||||||
61 | case never executed: Rgb:case Rgb: never executed: case Rgb: | 0 | ||||||||||||||||||
62 | setRgb(0, 0, 0); | - | ||||||||||||||||||
63 | break; never executed: break; | 0 | ||||||||||||||||||
64 | case never executed: Hsv:case Hsv: never executed: case Hsv: | 0 | ||||||||||||||||||
65 | setHsv(0, 0, 0); | - | ||||||||||||||||||
66 | break; never executed: break; | 0 | ||||||||||||||||||
67 | case never executed: Cmyk:case Cmyk: never executed: case Cmyk: | 0 | ||||||||||||||||||
68 | setCmyk(0, 0, 0, 0); | - | ||||||||||||||||||
69 | break; never executed: break; | 0 | ||||||||||||||||||
70 | case never executed: Hsl:case Hsl: never executed: case Hsl: | 0 | ||||||||||||||||||
71 | setHsl(0, 0, 0, 0); | - | ||||||||||||||||||
72 | break; never executed: break; | 0 | ||||||||||||||||||
73 | } | - | ||||||||||||||||||
74 | } never executed: end of block | 0 | ||||||||||||||||||
75 | QString QColor::name() const | - | ||||||||||||||||||
76 | { | - | ||||||||||||||||||
77 | return name(HexRgb); | - | ||||||||||||||||||
78 | } | - | ||||||||||||||||||
79 | QString QColor::name(NameFormat format) const | - | ||||||||||||||||||
80 | { | - | ||||||||||||||||||
81 | switch (format) { | - | ||||||||||||||||||
82 | case HexRgb: | - | ||||||||||||||||||
83 | return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6); | - | ||||||||||||||||||
84 | case HexArgb: | - | ||||||||||||||||||
85 | - | |||||||||||||||||||
86 | return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8); | - | ||||||||||||||||||
87 | } | - | ||||||||||||||||||
88 | return QString(); | - | ||||||||||||||||||
89 | } | - | ||||||||||||||||||
90 | void QColor::setNamedColor(const QString &name) | - | ||||||||||||||||||
91 | { | - | ||||||||||||||||||
92 | setColorFromString(name); | - | ||||||||||||||||||
93 | } | - | ||||||||||||||||||
94 | bool QColor::isValidColor(const QString &name) | - | ||||||||||||||||||
95 | { | - | ||||||||||||||||||
96 | return !name.isEmpty() && QColor().setColorFromString(name); | - | ||||||||||||||||||
97 | } | - | ||||||||||||||||||
98 | - | |||||||||||||||||||
99 | bool QColor::setColorFromString(const QString &name) | - | ||||||||||||||||||
100 | { | - | ||||||||||||||||||
101 | if (name.isEmpty()) { | - | ||||||||||||||||||
102 | invalidate(); | - | ||||||||||||||||||
103 | return true; | - | ||||||||||||||||||
104 | } | - | ||||||||||||||||||
105 | - | |||||||||||||||||||
106 | if (name.startsWith(QLatin1Char('#'))) { | - | ||||||||||||||||||
107 | QRgb rgba; | - | ||||||||||||||||||
108 | if (qt_get_hex_rgb(name.constData(), name.length(), &rgba)) { | - | ||||||||||||||||||
109 | setRgba(rgba); | - | ||||||||||||||||||
110 | return true; | - | ||||||||||||||||||
111 | } else { | - | ||||||||||||||||||
112 | invalidate(); | - | ||||||||||||||||||
113 | return false; | - | ||||||||||||||||||
114 | } | - | ||||||||||||||||||
115 | } | - | ||||||||||||||||||
116 | - | |||||||||||||||||||
117 | - | |||||||||||||||||||
118 | QRgb rgb; | - | ||||||||||||||||||
119 | if (qt_get_named_rgb(name.constData(), name.length(), &rgb)) { | - | ||||||||||||||||||
120 | setRgba(rgb); | - | ||||||||||||||||||
121 | return true; | - | ||||||||||||||||||
122 | } else | - | ||||||||||||||||||
123 | - | |||||||||||||||||||
124 | { | - | ||||||||||||||||||
125 | invalidate(); | - | ||||||||||||||||||
126 | return false; | - | ||||||||||||||||||
127 | } | - | ||||||||||||||||||
128 | } | - | ||||||||||||||||||
129 | - | |||||||||||||||||||
130 | - | |||||||||||||||||||
131 | - | |||||||||||||||||||
132 | - | |||||||||||||||||||
133 | - | |||||||||||||||||||
134 | - | |||||||||||||||||||
135 | QStringList QColor::colorNames() | - | ||||||||||||||||||
136 | { | - | ||||||||||||||||||
137 | - | |||||||||||||||||||
138 | return qt_get_colornames(); | - | ||||||||||||||||||
139 | - | |||||||||||||||||||
140 | - | |||||||||||||||||||
141 | - | |||||||||||||||||||
142 | } | - | ||||||||||||||||||
143 | void QColor::getHsvF(qreal *h, qreal *s, qreal *v, qreal *a) const | - | ||||||||||||||||||
144 | { | - | ||||||||||||||||||
145 | if (!h || !s || !v) | - | ||||||||||||||||||
146 | return; | - | ||||||||||||||||||
147 | - | |||||||||||||||||||
148 | if (cspec != Invalid && cspec != Hsv) { | - | ||||||||||||||||||
149 | toHsv().getHsvF(h, s, v, a); | - | ||||||||||||||||||
150 | return; | - | ||||||||||||||||||
151 | } | - | ||||||||||||||||||
152 | - | |||||||||||||||||||
153 | *h = ct.ahsv.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0); | - | ||||||||||||||||||
154 | *s = ct.ahsv.saturation / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
155 | *v = ct.ahsv.value / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
156 | - | |||||||||||||||||||
157 | if (a) | - | ||||||||||||||||||
158 | *a = ct.ahsv.alpha / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
159 | } | - | ||||||||||||||||||
160 | void QColor::getHsv(int *h, int *s, int *v, int *a) const | - | ||||||||||||||||||
161 | { | - | ||||||||||||||||||
162 | if (!h || !s || !v) | - | ||||||||||||||||||
163 | return; | - | ||||||||||||||||||
164 | - | |||||||||||||||||||
165 | if (cspec != Invalid && cspec != Hsv) { | - | ||||||||||||||||||
166 | toHsv().getHsv(h, s, v, a); | - | ||||||||||||||||||
167 | return; | - | ||||||||||||||||||
168 | } | - | ||||||||||||||||||
169 | - | |||||||||||||||||||
170 | *h = ct.ahsv.hue == (32767 * 2 + 1) ? -1 : ct.ahsv.hue / 100; | - | ||||||||||||||||||
171 | *s = ct.ahsv.saturation >> 8; | - | ||||||||||||||||||
172 | *v = ct.ahsv.value >> 8; | - | ||||||||||||||||||
173 | - | |||||||||||||||||||
174 | if (a) | - | ||||||||||||||||||
175 | *a = ct.ahsv.alpha >> 8; | - | ||||||||||||||||||
176 | } | - | ||||||||||||||||||
177 | void QColor::setHsvF(qreal h, qreal s, qreal v, qreal a) | - | ||||||||||||||||||
178 | { | - | ||||||||||||||||||
179 | if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0)) | - | ||||||||||||||||||
180 | || (s < qreal(0.0) || s > qreal(1.0)) | - | ||||||||||||||||||
181 | || (v < qreal(0.0) || v > qreal(1.0)) | - | ||||||||||||||||||
182 | || (a < qreal(0.0) || a > qreal(1.0))) { | - | ||||||||||||||||||
183 | QMessageLogger(__FILE__, 691697, __PRETTY_FUNCTION__).warning("QColor::setHsvF: HSV parameters out of range"); | - | ||||||||||||||||||
184 | return; | - | ||||||||||||||||||
185 | } | - | ||||||||||||||||||
186 | - | |||||||||||||||||||
187 | cspec = Hsv; | - | ||||||||||||||||||
188 | ct.ahsv.alpha = qRound(a * (32767 * 2 + 1)); | - | ||||||||||||||||||
189 | ct.ahsv.hue = h == qreal(-1.0) ? (32767 * 2 + 1) : qRound(h * 36000); | - | ||||||||||||||||||
190 | ct.ahsv.saturation = qRound(s * (32767 * 2 + 1)); | - | ||||||||||||||||||
191 | ct.ahsv.value = qRound(v * (32767 * 2 + 1)); | - | ||||||||||||||||||
192 | ct.ahsv.pad = 0; | - | ||||||||||||||||||
193 | } | - | ||||||||||||||||||
194 | void QColor::setHsv(int h, int s, int v, int a) | - | ||||||||||||||||||
195 | { | - | ||||||||||||||||||
196 | if (h < -1 || (uint)s > 255 || (uint)v > 255 || (uint)a > 255) { | - | ||||||||||||||||||
197 | QMessageLogger(__FILE__, 715721, __PRETTY_FUNCTION__).warning("QColor::setHsv: HSV parameters out of range"); | - | ||||||||||||||||||
198 | invalidate(); | - | ||||||||||||||||||
199 | return; | - | ||||||||||||||||||
200 | } | - | ||||||||||||||||||
201 | - | |||||||||||||||||||
202 | cspec = Hsv; | - | ||||||||||||||||||
203 | ct.ahsv.alpha = a * 0x101; | - | ||||||||||||||||||
204 | ct.ahsv.hue = h == -1 ? (32767 * 2 + 1) : (h % 360) * 100; | - | ||||||||||||||||||
205 | ct.ahsv.saturation = s * 0x101; | - | ||||||||||||||||||
206 | ct.ahsv.value = v * 0x101; | - | ||||||||||||||||||
207 | ct.ahsv.pad = 0; | - | ||||||||||||||||||
208 | } | - | ||||||||||||||||||
209 | void QColor::getHslF(qreal *h, qreal *s, qreal *l, qreal *a) const | - | ||||||||||||||||||
210 | { | - | ||||||||||||||||||
211 | if (!h || !s || !l) | - | ||||||||||||||||||
212 | return; | - | ||||||||||||||||||
213 | - | |||||||||||||||||||
214 | if (cspec != Invalid && cspec != Hsl) { | - | ||||||||||||||||||
215 | toHsl().getHslF(h, s, l, a); | - | ||||||||||||||||||
216 | return; | - | ||||||||||||||||||
217 | } | - | ||||||||||||||||||
218 | - | |||||||||||||||||||
219 | *h = ct.ahsl.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0); | - | ||||||||||||||||||
220 | *s = ct.ahsl.saturation / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
221 | *l = ct.ahsl.lightness / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
222 | - | |||||||||||||||||||
223 | if (a) | - | ||||||||||||||||||
224 | *a = ct.ahsl.alpha / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
225 | } | - | ||||||||||||||||||
226 | void QColor::getHsl(int *h, int *s, int *l, int *a) const | - | ||||||||||||||||||
227 | { | - | ||||||||||||||||||
228 | if (!h || !s || !l) | - | ||||||||||||||||||
229 | return; | - | ||||||||||||||||||
230 | - | |||||||||||||||||||
231 | if (cspec != Invalid && cspec != Hsl) { | - | ||||||||||||||||||
232 | toHsl().getHsl(h, s, l, a); | - | ||||||||||||||||||
233 | return; | - | ||||||||||||||||||
234 | } | - | ||||||||||||||||||
235 | - | |||||||||||||||||||
236 | *h = ct.ahsl.hue == (32767 * 2 + 1) ? -1 : ct.ahsl.hue / 100; | - | ||||||||||||||||||
237 | *s = ct.ahsl.saturation >> 8; | - | ||||||||||||||||||
238 | *l = ct.ahsl.lightness >> 8; | - | ||||||||||||||||||
239 | - | |||||||||||||||||||
240 | if (a) | - | ||||||||||||||||||
241 | *a = ct.ahsl.alpha >> 8; | - | ||||||||||||||||||
242 | } | - | ||||||||||||||||||
243 | void QColor::setHslF(qreal h, qreal s, qreal l, qreal a) | - | ||||||||||||||||||
244 | { | - | ||||||||||||||||||
245 | if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0)) | - | ||||||||||||||||||
246 | || (s < qreal(0.0) || s > qreal(1.0)) | - | ||||||||||||||||||
247 | || (l < qreal(0.0) || l > qreal(1.0)) | - | ||||||||||||||||||
248 | || (a < qreal(0.0) || a > qreal(1.0))) { | - | ||||||||||||||||||
249 | QMessageLogger(__FILE__, 804810, __PRETTY_FUNCTION__).warning("QColor::setHsvF: HSV parameters out of range"); | - | ||||||||||||||||||
250 | return; | - | ||||||||||||||||||
251 | } | - | ||||||||||||||||||
252 | - | |||||||||||||||||||
253 | cspec = Hsl; | - | ||||||||||||||||||
254 | ct.ahsl.alpha = qRound(a * (32767 * 2 + 1)); | - | ||||||||||||||||||
255 | ct.ahsl.hue = h == qreal(-1.0) ? (32767 * 2 + 1) : qRound(h * 36000); | - | ||||||||||||||||||
256 | ct.ahsl.saturation = qRound(s * (32767 * 2 + 1)); | - | ||||||||||||||||||
257 | ct.ahsl.lightness = qRound(l * (32767 * 2 + 1)); | - | ||||||||||||||||||
258 | ct.ahsl.pad = 0; | - | ||||||||||||||||||
259 | } | - | ||||||||||||||||||
260 | void QColor::setHsl(int h, int s, int l, int a) | - | ||||||||||||||||||
261 | { | - | ||||||||||||||||||
262 | if (h < -1 || (uint)s > 255 || (uint)l > 255 || (uint)a > 255) { | - | ||||||||||||||||||
263 | QMessageLogger(__FILE__, 830836, __PRETTY_FUNCTION__).warning("QColor::setHsv: HSV parameters out of range"); | - | ||||||||||||||||||
264 | invalidate(); | - | ||||||||||||||||||
265 | return; | - | ||||||||||||||||||
266 | } | - | ||||||||||||||||||
267 | - | |||||||||||||||||||
268 | cspec = Hsl; | - | ||||||||||||||||||
269 | ct.ahsl.alpha = a * 0x101; | - | ||||||||||||||||||
270 | ct.ahsl.hue = h == -1 ? (32767 * 2 + 1) : (h % 360) * 100; | - | ||||||||||||||||||
271 | ct.ahsl.saturation = s * 0x101; | - | ||||||||||||||||||
272 | ct.ahsl.lightness = l * 0x101; | - | ||||||||||||||||||
273 | ct.ahsl.pad = 0; | - | ||||||||||||||||||
274 | } | - | ||||||||||||||||||
275 | void QColor::getRgbF(qreal *r, qreal *g, qreal *b, qreal *a) const | - | ||||||||||||||||||
276 | { | - | ||||||||||||||||||
277 | if (!r || !g || !b) | - | ||||||||||||||||||
278 | return; | - | ||||||||||||||||||
279 | - | |||||||||||||||||||
280 | if (cspec != Invalid && cspec != Rgb) { | - | ||||||||||||||||||
281 | toRgb().getRgbF(r, g, b, a); | - | ||||||||||||||||||
282 | return; | - | ||||||||||||||||||
283 | } | - | ||||||||||||||||||
284 | - | |||||||||||||||||||
285 | *r = ct.argb.red / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
286 | *g = ct.argb.green / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
287 | *b = ct.argb.blue / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
288 | - | |||||||||||||||||||
289 | if (a) | - | ||||||||||||||||||
290 | *a = ct.argb.alpha / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
291 | - | |||||||||||||||||||
292 | } | - | ||||||||||||||||||
293 | void QColor::getRgb(int *r, int *g, int *b, int *a) const | - | ||||||||||||||||||
294 | { | - | ||||||||||||||||||
295 | if (!r || !g || !b) | - | ||||||||||||||||||
296 | return; | - | ||||||||||||||||||
297 | - | |||||||||||||||||||
298 | if (cspec != Invalid && cspec != Rgb) { | - | ||||||||||||||||||
299 | toRgb().getRgb(r, g, b, a); | - | ||||||||||||||||||
300 | return; | - | ||||||||||||||||||
301 | } | - | ||||||||||||||||||
302 | - | |||||||||||||||||||
303 | *r = ct.argb.red >> 8; | - | ||||||||||||||||||
304 | *g = ct.argb.green >> 8; | - | ||||||||||||||||||
305 | *b = ct.argb.blue >> 8; | - | ||||||||||||||||||
306 | - | |||||||||||||||||||
307 | if (a) | - | ||||||||||||||||||
308 | *a = ct.argb.alpha >> 8; | - | ||||||||||||||||||
309 | } | - | ||||||||||||||||||
310 | void QColor::setRgbF(qreal r, qreal g, qreal b, qreal a) | - | ||||||||||||||||||
311 | { | - | ||||||||||||||||||
312 | if (r < qreal(0.0) || r > qreal(1.0) | - | ||||||||||||||||||
313 | || g < qreal(0.0) || g > qreal(1.0) | - | ||||||||||||||||||
314 | || b < qreal(0.0) || b > qreal(1.0) | - | ||||||||||||||||||
315 | || a < qreal(0.0) || a > qreal(1.0)) { | - | ||||||||||||||||||
316 | QMessageLogger(__FILE__, 916922, __PRETTY_FUNCTION__).warning("QColor::setRgbF: RGB parameters out of range"); | - | ||||||||||||||||||
317 | invalidate(); | - | ||||||||||||||||||
318 | return; | - | ||||||||||||||||||
319 | } | - | ||||||||||||||||||
320 | - | |||||||||||||||||||
321 | cspec = Rgb; | - | ||||||||||||||||||
322 | ct.argb.alpha = qRound(a * (32767 * 2 + 1)); | - | ||||||||||||||||||
323 | ct.argb.red = qRound(r * (32767 * 2 + 1)); | - | ||||||||||||||||||
324 | ct.argb.green = qRound(g * (32767 * 2 + 1)); | - | ||||||||||||||||||
325 | ct.argb.blue = qRound(b * (32767 * 2 + 1)); | - | ||||||||||||||||||
326 | ct.argb.pad = 0; | - | ||||||||||||||||||
327 | } | - | ||||||||||||||||||
328 | void QColor::setRgb(int r, int g, int b, int a) | - | ||||||||||||||||||
329 | { | - | ||||||||||||||||||
330 | if ((uint)r > 255 || (uint)g > 255 || (uint)b > 255 || (uint)a > 255) { | - | ||||||||||||||||||
331 | QMessageLogger(__FILE__, 939945, __PRETTY_FUNCTION__).warning("QColor::setRgb: RGB parameters out of range"); | - | ||||||||||||||||||
332 | invalidate(); | - | ||||||||||||||||||
333 | return; | - | ||||||||||||||||||
334 | } | - | ||||||||||||||||||
335 | - | |||||||||||||||||||
336 | cspec = Rgb; | - | ||||||||||||||||||
337 | ct.argb.alpha = a * 0x101; | - | ||||||||||||||||||
338 | ct.argb.red = r * 0x101; | - | ||||||||||||||||||
339 | ct.argb.green = g * 0x101; | - | ||||||||||||||||||
340 | ct.argb.blue = b * 0x101; | - | ||||||||||||||||||
341 | ct.argb.pad = 0; | - | ||||||||||||||||||
342 | } | - | ||||||||||||||||||
343 | QRgb QColor::rgba() const noexcept | - | ||||||||||||||||||
344 | { | - | ||||||||||||||||||
345 | if (cspec != Invalid
| 0 | ||||||||||||||||||
346 | return never executed: toRgb().rgba();return toRgb().rgba(); never executed: return toRgb().rgba(); | 0 | ||||||||||||||||||
347 | return never executed: qRgba(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8, ct.argb.alpha >> 8);return qRgba(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8, ct.argb.alpha >> 8); never executed: return qRgba(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8, ct.argb.alpha >> 8); | 0 | ||||||||||||||||||
348 | } | - | ||||||||||||||||||
349 | - | |||||||||||||||||||
350 | - | |||||||||||||||||||
351 | - | |||||||||||||||||||
352 | - | |||||||||||||||||||
353 | - | |||||||||||||||||||
354 | - | |||||||||||||||||||
355 | void QColor::setRgba(QRgb rgba) noexcept | - | ||||||||||||||||||
356 | { | - | ||||||||||||||||||
357 | cspec = Rgb; | - | ||||||||||||||||||
358 | ct.argb.alpha = qAlpha(rgba) * 0x101; | - | ||||||||||||||||||
359 | ct.argb.red = qRed(rgba) * 0x101; | - | ||||||||||||||||||
360 | ct.argb.green = qGreen(rgba) * 0x101; | - | ||||||||||||||||||
361 | ct.argb.blue = qBlue(rgba) * 0x101; | - | ||||||||||||||||||
362 | ct.argb.pad = 0; | - | ||||||||||||||||||
363 | } never executed: end of block | 0 | ||||||||||||||||||
364 | QRgba64 QColor::rgba64() const noexcept | - | ||||||||||||||||||
365 | { | - | ||||||||||||||||||
366 | if (cspec != Invalid
| 0 | ||||||||||||||||||
367 | return never executed: toRgb().rgba64();return toRgb().rgba64(); never executed: return toRgb().rgba64(); | 0 | ||||||||||||||||||
368 | return never executed: qRgba64(ct.argb.red, ct.argb.green, ct.argb.blue, ct.argb.alpha);return qRgba64(ct.argb.red, ct.argb.green, ct.argb.blue, ct.argb.alpha); never executed: return qRgba64(ct.argb.red, ct.argb.green, ct.argb.blue, ct.argb.alpha); | 0 | ||||||||||||||||||
369 | } | - | ||||||||||||||||||
370 | void QColor::setRgba64(QRgba64 rgba) noexcept | - | ||||||||||||||||||
371 | { | - | ||||||||||||||||||
372 | cspec = Rgb; | - | ||||||||||||||||||
373 | ct.argb.alpha = rgba.alpha(); | - | ||||||||||||||||||
374 | ct.argb.red = rgba.red(); | - | ||||||||||||||||||
375 | ct.argb.green = rgba.green(); | - | ||||||||||||||||||
376 | ct.argb.blue = rgba.blue(); | - | ||||||||||||||||||
377 | ct.argb.pad = 0; | - | ||||||||||||||||||
378 | } never executed: end of block | 0 | ||||||||||||||||||
379 | QRgb QColor::rgb() const noexcept | - | ||||||||||||||||||
380 | { | - | ||||||||||||||||||
381 | if (cspec != Invalid
| 0 | ||||||||||||||||||
382 | return never executed: toRgb().rgb();return toRgb().rgb(); never executed: return toRgb().rgb(); | 0 | ||||||||||||||||||
383 | return never executed: qRgb(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8);return qRgb(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8); never executed: return qRgb(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8); | 0 | ||||||||||||||||||
384 | } | - | ||||||||||||||||||
385 | - | |||||||||||||||||||
386 | - | |||||||||||||||||||
387 | - | |||||||||||||||||||
388 | - | |||||||||||||||||||
389 | - | |||||||||||||||||||
390 | - | |||||||||||||||||||
391 | void QColor::setRgb(QRgb rgb) noexcept | - | ||||||||||||||||||
392 | { | - | ||||||||||||||||||
393 | cspec = Rgb; | - | ||||||||||||||||||
394 | ct.argb.alpha = 0xffff; | - | ||||||||||||||||||
395 | ct.argb.red = qRed(rgb) * 0x101; | - | ||||||||||||||||||
396 | ct.argb.green = qGreen(rgb) * 0x101; | - | ||||||||||||||||||
397 | ct.argb.blue = qBlue(rgb) * 0x101; | - | ||||||||||||||||||
398 | ct.argb.pad = 0; | - | ||||||||||||||||||
399 | } never executed: end of block | 0 | ||||||||||||||||||
400 | - | |||||||||||||||||||
401 | - | |||||||||||||||||||
402 | - | |||||||||||||||||||
403 | - | |||||||||||||||||||
404 | - | |||||||||||||||||||
405 | - | |||||||||||||||||||
406 | int QColor::alpha() const noexcept | - | ||||||||||||||||||
407 | { return never executed: ct.argb.alpha >> 8;return ct.argb.alpha >> 8; never executed: }return ct.argb.alpha >> 8; | 0 | ||||||||||||||||||
408 | void QColor::setAlpha(int alpha) | - | ||||||||||||||||||
409 | { | - | ||||||||||||||||||
410 | do { if (alpha < 0 || alpha > 255) { QMessageLogger(__FILE__, 10651071, __PRETTY_FUNCTION__).warning("\"QColor::setAlpha\""": invalid value %d", alpha); alpha = qMax(0, qMin(alpha, 255)); } } while (0); | - | ||||||||||||||||||
411 | ct.argb.alpha = alpha * 0x101; | - | ||||||||||||||||||
412 | } | - | ||||||||||||||||||
413 | - | |||||||||||||||||||
414 | - | |||||||||||||||||||
415 | - | |||||||||||||||||||
416 | - | |||||||||||||||||||
417 | - | |||||||||||||||||||
418 | - | |||||||||||||||||||
419 | qreal QColor::alphaF() const noexcept | - | ||||||||||||||||||
420 | { return never executed: ct.argb.alpha / qreal((32767 * 2 + 1));return ct.argb.alpha / qreal((32767 * 2 + 1)); never executed: }return ct.argb.alpha / qreal((32767 * 2 + 1)); | 0 | ||||||||||||||||||
421 | void QColor::setAlphaF(qreal alpha) | - | ||||||||||||||||||
422 | { | - | ||||||||||||||||||
423 | do { if (alpha < qreal(0.0) || alpha > qreal(1.0)) { QMessageLogger(__FILE__, 10861092, __PRETTY_FUNCTION__).warning("\"QColor::setAlphaF\""": invalid value %g", alpha); alpha = qMax(qreal(0.0), qMin(alpha, qreal(1.0))); } } while (0); | - | ||||||||||||||||||
424 | qreal tmp = alpha * (32767 * 2 + 1); | - | ||||||||||||||||||
425 | ct.argb.alpha = qRound(tmp); | - | ||||||||||||||||||
426 | } | - | ||||||||||||||||||
427 | - | |||||||||||||||||||
428 | - | |||||||||||||||||||
429 | - | |||||||||||||||||||
430 | - | |||||||||||||||||||
431 | - | |||||||||||||||||||
432 | - | |||||||||||||||||||
433 | - | |||||||||||||||||||
434 | int QColor::red() const noexcept | - | ||||||||||||||||||
435 | { | - | ||||||||||||||||||
436 | if (cspec != Invalid
| 0 | ||||||||||||||||||
437 | return never executed: toRgb().red();return toRgb().red(); never executed: return toRgb().red(); | 0 | ||||||||||||||||||
438 | return never executed: ct.argb.red >> 8;return ct.argb.red >> 8; never executed: return ct.argb.red >> 8; | 0 | ||||||||||||||||||
439 | } | - | ||||||||||||||||||
440 | - | |||||||||||||||||||
441 | - | |||||||||||||||||||
442 | - | |||||||||||||||||||
443 | - | |||||||||||||||||||
444 | - | |||||||||||||||||||
445 | - | |||||||||||||||||||
446 | - | |||||||||||||||||||
447 | void QColor::setRed(int red) | - | ||||||||||||||||||
448 | { | - | ||||||||||||||||||
449 | do { if (red < 0 || red > 255) { QMessageLogger(__FILE__, 11121118, __PRETTY_FUNCTION__).warning("\"QColor::setRed\""": invalid value %d", red); red = qMax(0, qMin(red, 255)); } } while (0); | - | ||||||||||||||||||
450 | if (cspec != Rgb) | - | ||||||||||||||||||
451 | setRgb(red, green(), blue(), alpha()); | - | ||||||||||||||||||
452 | else | - | ||||||||||||||||||
453 | ct.argb.red = red * 0x101; | - | ||||||||||||||||||
454 | } | - | ||||||||||||||||||
455 | - | |||||||||||||||||||
456 | - | |||||||||||||||||||
457 | - | |||||||||||||||||||
458 | - | |||||||||||||||||||
459 | - | |||||||||||||||||||
460 | - | |||||||||||||||||||
461 | int QColor::green() const noexcept | - | ||||||||||||||||||
462 | { | - | ||||||||||||||||||
463 | if (cspec != Invalid
| 0 | ||||||||||||||||||
464 | return never executed: toRgb().green();return toRgb().green(); never executed: return toRgb().green(); | 0 | ||||||||||||||||||
465 | return never executed: ct.argb.green >> 8;return ct.argb.green >> 8; never executed: return ct.argb.green >> 8; | 0 | ||||||||||||||||||
466 | } | - | ||||||||||||||||||
467 | - | |||||||||||||||||||
468 | - | |||||||||||||||||||
469 | - | |||||||||||||||||||
470 | - | |||||||||||||||||||
471 | - | |||||||||||||||||||
472 | - | |||||||||||||||||||
473 | - | |||||||||||||||||||
474 | void QColor::setGreen(int green) | - | ||||||||||||||||||
475 | { | - | ||||||||||||||||||
476 | do { if (green < 0 || green > 255) { QMessageLogger(__FILE__, 11391145, __PRETTY_FUNCTION__).warning("\"QColor::setGreen\""": invalid value %d", green); green = qMax(0, qMin(green, 255)); } } while (0); | - | ||||||||||||||||||
477 | if (cspec != Rgb) | - | ||||||||||||||||||
478 | setRgb(red(), green, blue(), alpha()); | - | ||||||||||||||||||
479 | else | - | ||||||||||||||||||
480 | ct.argb.green = green * 0x101; | - | ||||||||||||||||||
481 | } | - | ||||||||||||||||||
482 | - | |||||||||||||||||||
483 | - | |||||||||||||||||||
484 | - | |||||||||||||||||||
485 | - | |||||||||||||||||||
486 | - | |||||||||||||||||||
487 | - | |||||||||||||||||||
488 | - | |||||||||||||||||||
489 | int QColor::blue() const noexcept | - | ||||||||||||||||||
490 | { | - | ||||||||||||||||||
491 | if (cspec != Invalid
| 0 | ||||||||||||||||||
492 | return never executed: toRgb().blue();return toRgb().blue(); never executed: return toRgb().blue(); | 0 | ||||||||||||||||||
493 | return never executed: ct.argb.blue >> 8;return ct.argb.blue >> 8; never executed: return ct.argb.blue >> 8; | 0 | ||||||||||||||||||
494 | } | - | ||||||||||||||||||
495 | void QColor::setBlue(int blue) | - | ||||||||||||||||||
496 | { | - | ||||||||||||||||||
497 | do { if (blue < 0 || blue > 255) { QMessageLogger(__FILE__, 11681174, __PRETTY_FUNCTION__).warning("\"QColor::setBlue\""": invalid value %d", blue); blue = qMax(0, qMin(blue, 255)); } } while (0); | - | ||||||||||||||||||
498 | if (cspec != Rgb) | - | ||||||||||||||||||
499 | setRgb(red(), green(), blue, alpha()); | - | ||||||||||||||||||
500 | else | - | ||||||||||||||||||
501 | ct.argb.blue = blue * 0x101; | - | ||||||||||||||||||
502 | } | - | ||||||||||||||||||
503 | - | |||||||||||||||||||
504 | - | |||||||||||||||||||
505 | - | |||||||||||||||||||
506 | - | |||||||||||||||||||
507 | - | |||||||||||||||||||
508 | - | |||||||||||||||||||
509 | qreal QColor::redF() const noexcept | - | ||||||||||||||||||
510 | { | - | ||||||||||||||||||
511 | if (cspec != Invalid
| 0 | ||||||||||||||||||
512 | return never executed: toRgb().redF();return toRgb().redF(); never executed: return toRgb().redF(); | 0 | ||||||||||||||||||
513 | return never executed: ct.argb.red / qreal((32767 * 2 + 1));return ct.argb.red / qreal((32767 * 2 + 1)); never executed: return ct.argb.red / qreal((32767 * 2 + 1)); | 0 | ||||||||||||||||||
514 | } | - | ||||||||||||||||||
515 | void QColor::setRedF(qreal red) | - | ||||||||||||||||||
516 | { | - | ||||||||||||||||||
517 | do { if (red < qreal(0.0) || red > qreal(1.0)) { QMessageLogger(__FILE__, 11961202, __PRETTY_FUNCTION__).warning("\"QColor::setRedF\""": invalid value %g", red); red = qMax(qreal(0.0), qMin(red, qreal(1.0))); } } while (0); | - | ||||||||||||||||||
518 | if (cspec != Rgb) | - | ||||||||||||||||||
519 | setRgbF(red, greenF(), blueF(), alphaF()); | - | ||||||||||||||||||
520 | else | - | ||||||||||||||||||
521 | ct.argb.red = qRound(red * (32767 * 2 + 1)); | - | ||||||||||||||||||
522 | } | - | ||||||||||||||||||
523 | - | |||||||||||||||||||
524 | - | |||||||||||||||||||
525 | - | |||||||||||||||||||
526 | - | |||||||||||||||||||
527 | - | |||||||||||||||||||
528 | - | |||||||||||||||||||
529 | qreal QColor::greenF() const noexcept | - | ||||||||||||||||||
530 | { | - | ||||||||||||||||||
531 | if (cspec != Invalid
| 0 | ||||||||||||||||||
532 | return never executed: toRgb().greenF();return toRgb().greenF(); never executed: return toRgb().greenF(); | 0 | ||||||||||||||||||
533 | return never executed: ct.argb.green / qreal((32767 * 2 + 1));return ct.argb.green / qreal((32767 * 2 + 1)); never executed: return ct.argb.green / qreal((32767 * 2 + 1)); | 0 | ||||||||||||||||||
534 | } | - | ||||||||||||||||||
535 | void QColor::setGreenF(qreal green) | - | ||||||||||||||||||
536 | { | - | ||||||||||||||||||
537 | do { if (green < qreal(0.0) || green > qreal(1.0)) { QMessageLogger(__FILE__, 12241230, __PRETTY_FUNCTION__).warning("\"QColor::setGreenF\""": invalid value %g", green); green = qMax(qreal(0.0), qMin(green, qreal(1.0))); } } while (0); | - | ||||||||||||||||||
538 | if (cspec != Rgb) | - | ||||||||||||||||||
539 | setRgbF(redF(), green, blueF(), alphaF()); | - | ||||||||||||||||||
540 | else | - | ||||||||||||||||||
541 | ct.argb.green = qRound(green * (32767 * 2 + 1)); | - | ||||||||||||||||||
542 | } | - | ||||||||||||||||||
543 | - | |||||||||||||||||||
544 | - | |||||||||||||||||||
545 | - | |||||||||||||||||||
546 | - | |||||||||||||||||||
547 | - | |||||||||||||||||||
548 | - | |||||||||||||||||||
549 | qreal QColor::blueF() const noexcept | - | ||||||||||||||||||
550 | { | - | ||||||||||||||||||
551 | if (cspec != Invalid
| 0 | ||||||||||||||||||
552 | return never executed: toRgb().blueF();return toRgb().blueF(); never executed: return toRgb().blueF(); | 0 | ||||||||||||||||||
553 | return never executed: ct.argb.blue / qreal((32767 * 2 + 1));return ct.argb.blue / qreal((32767 * 2 + 1)); never executed: return ct.argb.blue / qreal((32767 * 2 + 1)); | 0 | ||||||||||||||||||
554 | } | - | ||||||||||||||||||
555 | - | |||||||||||||||||||
556 | - | |||||||||||||||||||
557 | - | |||||||||||||||||||
558 | - | |||||||||||||||||||
559 | - | |||||||||||||||||||
560 | - | |||||||||||||||||||
561 | - | |||||||||||||||||||
562 | void QColor::setBlueF(qreal blue) | - | ||||||||||||||||||
563 | { | - | ||||||||||||||||||
564 | do { if (blue < qreal(0.0) || blue > qreal(1.0)) { QMessageLogger(__FILE__, 12511257, __PRETTY_FUNCTION__).warning("\"QColor::setBlueF\""": invalid value %g", blue); blue = qMax(qreal(0.0), qMin(blue, qreal(1.0))); } } while (0); | - | ||||||||||||||||||
565 | if (cspec != Rgb) | - | ||||||||||||||||||
566 | setRgbF(redF(), greenF(), blue, alphaF()); | - | ||||||||||||||||||
567 | else | - | ||||||||||||||||||
568 | ct.argb.blue = qRound(blue * (32767 * 2 + 1)); | - | ||||||||||||||||||
569 | } | - | ||||||||||||||||||
570 | int QColor::hue() const noexcept | - | ||||||||||||||||||
571 | { | - | ||||||||||||||||||
572 | return never executed: hsvHue();return hsvHue(); never executed: return hsvHue(); | 0 | ||||||||||||||||||
573 | } | - | ||||||||||||||||||
574 | - | |||||||||||||||||||
575 | - | |||||||||||||||||||
576 | - | |||||||||||||||||||
577 | - | |||||||||||||||||||
578 | - | |||||||||||||||||||
579 | - | |||||||||||||||||||
580 | int QColor::hsvHue() const noexcept | - | ||||||||||||||||||
581 | { | - | ||||||||||||||||||
582 | if (cspec != Invalid
| 0 | ||||||||||||||||||
583 | return never executed: toHsv().hue();return toHsv().hue(); never executed: return toHsv().hue(); | 0 | ||||||||||||||||||
584 | return never executed: ct.ahsv.hue == (32767 * 2 + 1) ? -1 : ct.ahsv.hue / 100;return ct.ahsv.hue == (32767 * 2 + 1) ? -1 : ct.ahsv.hue / 100; never executed: return ct.ahsv.hue == (32767 * 2 + 1) ? -1 : ct.ahsv.hue / 100; | 0 | ||||||||||||||||||
585 | } | - | ||||||||||||||||||
586 | int QColor::saturation() const noexcept | - | ||||||||||||||||||
587 | { | - | ||||||||||||||||||
588 | return never executed: hsvSaturation();return hsvSaturation(); never executed: return hsvSaturation(); | 0 | ||||||||||||||||||
589 | } | - | ||||||||||||||||||
590 | - | |||||||||||||||||||
591 | - | |||||||||||||||||||
592 | - | |||||||||||||||||||
593 | - | |||||||||||||||||||
594 | - | |||||||||||||||||||
595 | - | |||||||||||||||||||
596 | int QColor::hsvSaturation() const noexcept | - | ||||||||||||||||||
597 | { | - | ||||||||||||||||||
598 | if (cspec != Invalid
| 0 | ||||||||||||||||||
599 | return never executed: toHsv().saturation();return toHsv().saturation(); never executed: return toHsv().saturation(); | 0 | ||||||||||||||||||
600 | return never executed: ct.ahsv.saturation >> 8;return ct.ahsv.saturation >> 8; never executed: return ct.ahsv.saturation >> 8; | 0 | ||||||||||||||||||
601 | } | - | ||||||||||||||||||
602 | - | |||||||||||||||||||
603 | - | |||||||||||||||||||
604 | - | |||||||||||||||||||
605 | - | |||||||||||||||||||
606 | - | |||||||||||||||||||
607 | - | |||||||||||||||||||
608 | int QColor::value() const noexcept | - | ||||||||||||||||||
609 | { | - | ||||||||||||||||||
610 | if (cspec != Invalid
| 0 | ||||||||||||||||||
611 | return never executed: toHsv().value();return toHsv().value(); never executed: return toHsv().value(); | 0 | ||||||||||||||||||
612 | return never executed: ct.ahsv.value >> 8;return ct.ahsv.value >> 8; never executed: return ct.ahsv.value >> 8; | 0 | ||||||||||||||||||
613 | } | - | ||||||||||||||||||
614 | qreal QColor::hueF() const noexcept | - | ||||||||||||||||||
615 | { | - | ||||||||||||||||||
616 | return never executed: hsvHueF();return hsvHueF(); never executed: return hsvHueF(); | 0 | ||||||||||||||||||
617 | } | - | ||||||||||||||||||
618 | - | |||||||||||||||||||
619 | - | |||||||||||||||||||
620 | - | |||||||||||||||||||
621 | - | |||||||||||||||||||
622 | - | |||||||||||||||||||
623 | - | |||||||||||||||||||
624 | - | |||||||||||||||||||
625 | qreal QColor::hsvHueF() const noexcept | - | ||||||||||||||||||
626 | { | - | ||||||||||||||||||
627 | if (cspec != Invalid
| 0 | ||||||||||||||||||
628 | return never executed: toHsv().hueF();return toHsv().hueF(); never executed: return toHsv().hueF(); | 0 | ||||||||||||||||||
629 | return never executed: ct.ahsv.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0);return ct.ahsv.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0); never executed: return ct.ahsv.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0); | 0 | ||||||||||||||||||
630 | } | - | ||||||||||||||||||
631 | qreal QColor::saturationF() const noexcept | - | ||||||||||||||||||
632 | { | - | ||||||||||||||||||
633 | return never executed: hsvSaturationF();return hsvSaturationF(); never executed: return hsvSaturationF(); | 0 | ||||||||||||||||||
634 | } | - | ||||||||||||||||||
635 | - | |||||||||||||||||||
636 | - | |||||||||||||||||||
637 | - | |||||||||||||||||||
638 | - | |||||||||||||||||||
639 | - | |||||||||||||||||||
640 | - | |||||||||||||||||||
641 | qreal QColor::hsvSaturationF() const noexcept | - | ||||||||||||||||||
642 | { | - | ||||||||||||||||||
643 | if (cspec != Invalid
| 0 | ||||||||||||||||||
644 | return never executed: toHsv().saturationF();return toHsv().saturationF(); never executed: return toHsv().saturationF(); | 0 | ||||||||||||||||||
645 | return never executed: ct.ahsv.saturation / qreal((32767 * 2 + 1));return ct.ahsv.saturation / qreal((32767 * 2 + 1)); never executed: return ct.ahsv.saturation / qreal((32767 * 2 + 1)); | 0 | ||||||||||||||||||
646 | } | - | ||||||||||||||||||
647 | - | |||||||||||||||||||
648 | - | |||||||||||||||||||
649 | - | |||||||||||||||||||
650 | - | |||||||||||||||||||
651 | - | |||||||||||||||||||
652 | - | |||||||||||||||||||
653 | qreal QColor::valueF() const noexcept | - | ||||||||||||||||||
654 | { | - | ||||||||||||||||||
655 | if (cspec != Invalid
| 0 | ||||||||||||||||||
656 | return never executed: toHsv().valueF();return toHsv().valueF(); never executed: return toHsv().valueF(); | 0 | ||||||||||||||||||
657 | return never executed: ct.ahsv.value / qreal((32767 * 2 + 1));return ct.ahsv.value / qreal((32767 * 2 + 1)); never executed: return ct.ahsv.value / qreal((32767 * 2 + 1)); | 0 | ||||||||||||||||||
658 | } | - | ||||||||||||||||||
659 | int QColor::hslHue() const noexcept | - | ||||||||||||||||||
660 | { | - | ||||||||||||||||||
661 | if (cspec != Invalid
| 0 | ||||||||||||||||||
662 | return never executed: toHsl().hslHue();return toHsl().hslHue(); never executed: return toHsl().hslHue(); | 0 | ||||||||||||||||||
663 | return never executed: ct.ahsl.hue == (32767 * 2 + 1) ? -1 : ct.ahsl.hue / 100;return ct.ahsl.hue == (32767 * 2 + 1) ? -1 : ct.ahsl.hue / 100; never executed: return ct.ahsl.hue == (32767 * 2 + 1) ? -1 : ct.ahsl.hue / 100; | 0 | ||||||||||||||||||
664 | } | - | ||||||||||||||||||
665 | int QColor::hslSaturation() const noexcept | - | ||||||||||||||||||
666 | { | - | ||||||||||||||||||
667 | if (cspec != Invalid
| 0 | ||||||||||||||||||
668 | return never executed: toHsl().hslSaturation();return toHsl().hslSaturation(); never executed: return toHsl().hslSaturation(); | 0 | ||||||||||||||||||
669 | return never executed: ct.ahsl.saturation >> 8;return ct.ahsl.saturation >> 8; never executed: return ct.ahsl.saturation >> 8; | 0 | ||||||||||||||||||
670 | } | - | ||||||||||||||||||
671 | int QColor::lightness() const noexcept | - | ||||||||||||||||||
672 | { | - | ||||||||||||||||||
673 | if (cspec != Invalid
| 0 | ||||||||||||||||||
674 | return never executed: toHsl().lightness();return toHsl().lightness(); never executed: return toHsl().lightness(); | 0 | ||||||||||||||||||
675 | return never executed: ct.ahsl.lightness >> 8;return ct.ahsl.lightness >> 8; never executed: return ct.ahsl.lightness >> 8; | 0 | ||||||||||||||||||
676 | } | - | ||||||||||||||||||
677 | qreal QColor::hslHueF() const noexcept | - | ||||||||||||||||||
678 | { | - | ||||||||||||||||||
679 | if (cspec != Invalid
| 0 | ||||||||||||||||||
680 | return never executed: toHsl().hslHueF();return toHsl().hslHueF(); never executed: return toHsl().hslHueF(); | 0 | ||||||||||||||||||
681 | return never executed: ct.ahsl.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0);return ct.ahsl.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0); never executed: return ct.ahsl.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0); | 0 | ||||||||||||||||||
682 | } | - | ||||||||||||||||||
683 | qreal QColor::hslSaturationF() const noexcept | - | ||||||||||||||||||
684 | { | - | ||||||||||||||||||
685 | if (cspec != Invalid
| 0 | ||||||||||||||||||
686 | return never executed: toHsl().hslSaturationF();return toHsl().hslSaturationF(); never executed: return toHsl().hslSaturationF(); | 0 | ||||||||||||||||||
687 | return never executed: ct.ahsl.saturation / qreal((32767 * 2 + 1));return ct.ahsl.saturation / qreal((32767 * 2 + 1)); never executed: return ct.ahsl.saturation / qreal((32767 * 2 + 1)); | 0 | ||||||||||||||||||
688 | } | - | ||||||||||||||||||
689 | qreal QColor::lightnessF() const noexcept | - | ||||||||||||||||||
690 | { | - | ||||||||||||||||||
691 | if (cspec != Invalid
| 0 | ||||||||||||||||||
692 | return never executed: toHsl().lightnessF();return toHsl().lightnessF(); never executed: return toHsl().lightnessF(); | 0 | ||||||||||||||||||
693 | return never executed: ct.ahsl.lightness / qreal((32767 * 2 + 1));return ct.ahsl.lightness / qreal((32767 * 2 + 1)); never executed: return ct.ahsl.lightness / qreal((32767 * 2 + 1)); | 0 | ||||||||||||||||||
694 | } | - | ||||||||||||||||||
695 | - | |||||||||||||||||||
696 | - | |||||||||||||||||||
697 | - | |||||||||||||||||||
698 | - | |||||||||||||||||||
699 | - | |||||||||||||||||||
700 | - | |||||||||||||||||||
701 | int QColor::cyan() const noexcept | - | ||||||||||||||||||
702 | { | - | ||||||||||||||||||
703 | if (cspec != Invalid
| 0 | ||||||||||||||||||
704 | return never executed: toCmyk().cyan();return toCmyk().cyan(); never executed: return toCmyk().cyan(); | 0 | ||||||||||||||||||
705 | return never executed: ct.acmyk.cyan >> 8;return ct.acmyk.cyan >> 8; never executed: return ct.acmyk.cyan >> 8; | 0 | ||||||||||||||||||
706 | } | - | ||||||||||||||||||
707 | - | |||||||||||||||||||
708 | - | |||||||||||||||||||
709 | - | |||||||||||||||||||
710 | - | |||||||||||||||||||
711 | - | |||||||||||||||||||
712 | - | |||||||||||||||||||
713 | int QColor::magenta() const noexcept | - | ||||||||||||||||||
714 | { | - | ||||||||||||||||||
715 | if (cspec != Invalid
| 0 | ||||||||||||||||||
716 | return never executed: toCmyk().magenta();return toCmyk().magenta(); never executed: return toCmyk().magenta(); | 0 | ||||||||||||||||||
717 | return never executed: ct.acmyk.magenta >> 8;return ct.acmyk.magenta >> 8; never executed: return ct.acmyk.magenta >> 8; | 0 | ||||||||||||||||||
718 | } | - | ||||||||||||||||||
719 | - | |||||||||||||||||||
720 | - | |||||||||||||||||||
721 | - | |||||||||||||||||||
722 | - | |||||||||||||||||||
723 | - | |||||||||||||||||||
724 | - | |||||||||||||||||||
725 | int QColor::yellow() const noexcept | - | ||||||||||||||||||
726 | { | - | ||||||||||||||||||
727 | if (cspec != Invalid
| 0 | ||||||||||||||||||
728 | return never executed: toCmyk().yellow();return toCmyk().yellow(); never executed: return toCmyk().yellow(); | 0 | ||||||||||||||||||
729 | return never executed: ct.acmyk.yellow >> 8;return ct.acmyk.yellow >> 8; never executed: return ct.acmyk.yellow >> 8; | 0 | ||||||||||||||||||
730 | } | - | ||||||||||||||||||
731 | - | |||||||||||||||||||
732 | - | |||||||||||||||||||
733 | - | |||||||||||||||||||
734 | - | |||||||||||||||||||
735 | - | |||||||||||||||||||
736 | - | |||||||||||||||||||
737 | - | |||||||||||||||||||
738 | int QColor::black() const noexcept | - | ||||||||||||||||||
739 | { | - | ||||||||||||||||||
740 | if (cspec != Invalid
| 0 | ||||||||||||||||||
741 | return never executed: toCmyk().black();return toCmyk().black(); never executed: return toCmyk().black(); | 0 | ||||||||||||||||||
742 | return never executed: ct.acmyk.black >> 8;return ct.acmyk.black >> 8; never executed: return ct.acmyk.black >> 8; | 0 | ||||||||||||||||||
743 | } | - | ||||||||||||||||||
744 | - | |||||||||||||||||||
745 | - | |||||||||||||||||||
746 | - | |||||||||||||||||||
747 | - | |||||||||||||||||||
748 | - | |||||||||||||||||||
749 | - | |||||||||||||||||||
750 | qreal QColor::cyanF() const noexcept | - | ||||||||||||||||||
751 | { | - | ||||||||||||||||||
752 | if (cspec != Invalid
| 0 | ||||||||||||||||||
753 | return never executed: toCmyk().cyanF();return toCmyk().cyanF(); never executed: return toCmyk().cyanF(); | 0 | ||||||||||||||||||
754 | return never executed: ct.acmyk.cyan / qreal((32767 * 2 + 1));return ct.acmyk.cyan / qreal((32767 * 2 + 1)); never executed: return ct.acmyk.cyan / qreal((32767 * 2 + 1)); | 0 | ||||||||||||||||||
755 | } | - | ||||||||||||||||||
756 | - | |||||||||||||||||||
757 | - | |||||||||||||||||||
758 | - | |||||||||||||||||||
759 | - | |||||||||||||||||||
760 | - | |||||||||||||||||||
761 | - | |||||||||||||||||||
762 | qreal QColor::magentaF() const noexcept | - | ||||||||||||||||||
763 | { | - | ||||||||||||||||||
764 | if (cspec != Invalid
| 0 | ||||||||||||||||||
765 | return never executed: toCmyk().magentaF();return toCmyk().magentaF(); never executed: return toCmyk().magentaF(); | 0 | ||||||||||||||||||
766 | return never executed: ct.acmyk.magenta / qreal((32767 * 2 + 1));return ct.acmyk.magenta / qreal((32767 * 2 + 1)); never executed: return ct.acmyk.magenta / qreal((32767 * 2 + 1)); | 0 | ||||||||||||||||||
767 | } | - | ||||||||||||||||||
768 | - | |||||||||||||||||||
769 | - | |||||||||||||||||||
770 | - | |||||||||||||||||||
771 | - | |||||||||||||||||||
772 | - | |||||||||||||||||||
773 | - | |||||||||||||||||||
774 | qreal QColor::yellowF() const noexcept | - | ||||||||||||||||||
775 | { | - | ||||||||||||||||||
776 | if (cspec != Invalid
| 0 | ||||||||||||||||||
777 | return never executed: toCmyk().yellowF();return toCmyk().yellowF(); never executed: return toCmyk().yellowF(); | 0 | ||||||||||||||||||
778 | return never executed: ct.acmyk.yellow / qreal((32767 * 2 + 1));return ct.acmyk.yellow / qreal((32767 * 2 + 1)); never executed: return ct.acmyk.yellow / qreal((32767 * 2 + 1)); | 0 | ||||||||||||||||||
779 | } | - | ||||||||||||||||||
780 | - | |||||||||||||||||||
781 | - | |||||||||||||||||||
782 | - | |||||||||||||||||||
783 | - | |||||||||||||||||||
784 | - | |||||||||||||||||||
785 | - | |||||||||||||||||||
786 | qreal QColor::blackF() const noexcept | - | ||||||||||||||||||
787 | { | - | ||||||||||||||||||
788 | if (cspec != Invalid
| 0 | ||||||||||||||||||
789 | return never executed: toCmyk().blackF();return toCmyk().blackF(); never executed: return toCmyk().blackF(); | 0 | ||||||||||||||||||
790 | return never executed: ct.acmyk.black / qreal((32767 * 2 + 1));return ct.acmyk.black / qreal((32767 * 2 + 1)); never executed: return ct.acmyk.black / qreal((32767 * 2 + 1)); | 0 | ||||||||||||||||||
791 | } | - | ||||||||||||||||||
792 | - | |||||||||||||||||||
793 | - | |||||||||||||||||||
794 | - | |||||||||||||||||||
795 | - | |||||||||||||||||||
796 | - | |||||||||||||||||||
797 | - | |||||||||||||||||||
798 | QColor QColor::toRgb() const noexcept | - | ||||||||||||||||||
799 | { | - | ||||||||||||||||||
800 | if (!isValid()
| 0 | ||||||||||||||||||
801 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||||||||
802 | - | |||||||||||||||||||
803 | QColor color; | - | ||||||||||||||||||
804 | color.cspec = Rgb; | - | ||||||||||||||||||
805 | color.ct.argb.alpha = ct.argb.alpha; | - | ||||||||||||||||||
806 | color.ct.argb.pad = 0; | - | ||||||||||||||||||
807 | - | |||||||||||||||||||
808 | switch (cspec) { | - | ||||||||||||||||||
809 | case never executed: Hsv:case Hsv: never executed: case Hsv: | 0 | ||||||||||||||||||
810 | { | - | ||||||||||||||||||
811 | if (ct.ahsv.saturation == 0
| 0 | ||||||||||||||||||
812 | - | |||||||||||||||||||
813 | color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsv.value; | - | ||||||||||||||||||
814 | break; never executed: break; | 0 | ||||||||||||||||||
815 | } | - | ||||||||||||||||||
816 | - | |||||||||||||||||||
817 | - | |||||||||||||||||||
818 | const qreal h = ct.ahsv.hue == 36000
| 0 | ||||||||||||||||||
819 | const qreal s = ct.ahsv.saturation / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
820 | const qreal v = ct.ahsv.value / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
821 | const int i = int(h); | - | ||||||||||||||||||
822 | const qreal f = h - i; | - | ||||||||||||||||||
823 | const qreal p = v * (qreal(1.0) - s); | - | ||||||||||||||||||
824 | - | |||||||||||||||||||
825 | if (i & 1
| 0 | ||||||||||||||||||
826 | const qreal q = v * (qreal(1.0) - (s * f)); | - | ||||||||||||||||||
827 | - | |||||||||||||||||||
828 | switch (i) { | - | ||||||||||||||||||
829 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||||||||
830 | color.ct.argb.red = qRound(q * (32767 * 2 + 1)); | - | ||||||||||||||||||
831 | color.ct.argb.green = qRound(v * (32767 * 2 + 1)); | - | ||||||||||||||||||
832 | color.ct.argb.blue = qRound(p * (32767 * 2 + 1)); | - | ||||||||||||||||||
833 | break; never executed: break; | 0 | ||||||||||||||||||
834 | case never executed: 3:case 3: never executed: case 3: | 0 | ||||||||||||||||||
835 | color.ct.argb.red = qRound(p * (32767 * 2 + 1)); | - | ||||||||||||||||||
836 | color.ct.argb.green = qRound(q * (32767 * 2 + 1)); | - | ||||||||||||||||||
837 | color.ct.argb.blue = qRound(v * (32767 * 2 + 1)); | - | ||||||||||||||||||
838 | break; never executed: break; | 0 | ||||||||||||||||||
839 | case never executed: 5:case 5: never executed: case 5: | 0 | ||||||||||||||||||
840 | color.ct.argb.red = qRound(v * (32767 * 2 + 1)); | - | ||||||||||||||||||
841 | color.ct.argb.green = qRound(p * (32767 * 2 + 1)); | - | ||||||||||||||||||
842 | color.ct.argb.blue = qRound(q * (32767 * 2 + 1)); | - | ||||||||||||||||||
843 | break; never executed: break; | 0 | ||||||||||||||||||
844 | } | - | ||||||||||||||||||
845 | } never executed: else {end of block | 0 | ||||||||||||||||||
846 | const qreal t = v * (qreal(1.0) - (s * (qreal(1.0) - f))); | - | ||||||||||||||||||
847 | - | |||||||||||||||||||
848 | switch (i) { | - | ||||||||||||||||||
849 | case never executed: 0:case 0: never executed: case 0: | 0 | ||||||||||||||||||
850 | color.ct.argb.red = qRound(v * (32767 * 2 + 1)); | - | ||||||||||||||||||
851 | color.ct.argb.green = qRound(t * (32767 * 2 + 1)); | - | ||||||||||||||||||
852 | color.ct.argb.blue = qRound(p * (32767 * 2 + 1)); | - | ||||||||||||||||||
853 | break; never executed: break; | 0 | ||||||||||||||||||
854 | case never executed: 2:case 2: never executed: case 2: | 0 | ||||||||||||||||||
855 | color.ct.argb.red = qRound(p * (32767 * 2 + 1)); | - | ||||||||||||||||||
856 | color.ct.argb.green = qRound(v * (32767 * 2 + 1)); | - | ||||||||||||||||||
857 | color.ct.argb.blue = qRound(t * (32767 * 2 + 1)); | - | ||||||||||||||||||
858 | break; never executed: break; | 0 | ||||||||||||||||||
859 | case never executed: 4:case 4: never executed: case 4: | 0 | ||||||||||||||||||
860 | color.ct.argb.red = qRound(t * (32767 * 2 + 1)); | - | ||||||||||||||||||
861 | color.ct.argb.green = qRound(p * (32767 * 2 + 1)); | - | ||||||||||||||||||
862 | color.ct.argb.blue = qRound(v * (32767 * 2 + 1)); | - | ||||||||||||||||||
863 | break; never executed: break; | 0 | ||||||||||||||||||
864 | } | - | ||||||||||||||||||
865 | } never executed: end of block | 0 | ||||||||||||||||||
866 | break; never executed: break; | 0 | ||||||||||||||||||
867 | } | - | ||||||||||||||||||
868 | case never executed: Hsl:case Hsl: never executed: case Hsl: | 0 | ||||||||||||||||||
869 | { | - | ||||||||||||||||||
870 | if (ct.ahsl.saturation == 0
| 0 | ||||||||||||||||||
871 | - | |||||||||||||||||||
872 | color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsl.lightness; | - | ||||||||||||||||||
873 | } never executed: else if (ct.ahsl.lightness == 0end of block
| 0 | ||||||||||||||||||
874 | - | |||||||||||||||||||
875 | color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = 0; | - | ||||||||||||||||||
876 | } never executed: else {end of block | 0 | ||||||||||||||||||
877 | - | |||||||||||||||||||
878 | const qreal h = ct.ahsl.hue == 36000
| 0 | ||||||||||||||||||
879 | const qreal s = ct.ahsl.saturation / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
880 | const qreal l = ct.ahsl.lightness / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
881 | - | |||||||||||||||||||
882 | qreal temp2; | - | ||||||||||||||||||
883 | if (l < qreal(0.5)
| 0 | ||||||||||||||||||
884 | temp2 = l * (qreal(1.0) + s); never executed: temp2 = l * (qreal(1.0) + s); | 0 | ||||||||||||||||||
885 | else | - | ||||||||||||||||||
886 | temp2 = l + s - (l * s); never executed: temp2 = l + s - (l * s); | 0 | ||||||||||||||||||
887 | - | |||||||||||||||||||
888 | const qreal temp1 = (qreal(2.0) * l) - temp2; | - | ||||||||||||||||||
889 | qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)), | - | ||||||||||||||||||
890 | h, | - | ||||||||||||||||||
891 | h - (qreal(1.0) / qreal(3.0)) }; | - | ||||||||||||||||||
892 | - | |||||||||||||||||||
893 | for (int i = 0; i != 3
| 0 | ||||||||||||||||||
894 | if (temp3[i] < qreal(0.0)
| 0 | ||||||||||||||||||
895 | temp3[i] += qreal(1.0); never executed: temp3[i] += qreal(1.0); | 0 | ||||||||||||||||||
896 | else if (temp3[i] > qreal(1.0)
| 0 | ||||||||||||||||||
897 | temp3[i] -= qreal(1.0); never executed: temp3[i] -= qreal(1.0); | 0 | ||||||||||||||||||
898 | - | |||||||||||||||||||
899 | const qreal sixtemp3 = temp3[i] * qreal(6.0); | - | ||||||||||||||||||
900 | if (sixtemp3 < qreal(1.0)
| 0 | ||||||||||||||||||
901 | color.ct.array[i+1] = qRound((temp1 + (temp2 - temp1) * sixtemp3) * (32767 * 2 + 1)); never executed: color.ct.array[i+1] = qRound((temp1 + (temp2 - temp1) * sixtemp3) * (32767 * 2 + 1)); | 0 | ||||||||||||||||||
902 | else if ((
| 0 | ||||||||||||||||||
903 | color.ct.array[i+1] = qRound(temp2 * (32767 * 2 + 1)); never executed: color.ct.array[i+1] = qRound(temp2 * (32767 * 2 + 1)); | 0 | ||||||||||||||||||
904 | else if ((
| 0 | ||||||||||||||||||
905 | color.ct.array[i+1] = qRound((temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0)) * (32767 * 2 + 1)); never executed: color.ct.array[i+1] = qRound((temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0)) * (32767 * 2 + 1)); | 0 | ||||||||||||||||||
906 | else | - | ||||||||||||||||||
907 | color.ct.array[i+1] = qRound(temp1 * (32767 * 2 + 1)); never executed: color.ct.array[i+1] = qRound(temp1 * (32767 * 2 + 1)); | 0 | ||||||||||||||||||
908 | } | - | ||||||||||||||||||
909 | color.ct.argb.red = color.ct.argb.red == 1
| 0 | ||||||||||||||||||
910 | color.ct.argb.green = color.ct.argb.green == 1
| 0 | ||||||||||||||||||
911 | color.ct.argb.blue = color.ct.argb.blue == 1
| 0 | ||||||||||||||||||
912 | } never executed: end of block | 0 | ||||||||||||||||||
913 | break; never executed: break; | 0 | ||||||||||||||||||
914 | } | - | ||||||||||||||||||
915 | case never executed: Cmyk:case Cmyk: never executed: case Cmyk: | 0 | ||||||||||||||||||
916 | { | - | ||||||||||||||||||
917 | const qreal c = ct.acmyk.cyan / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
918 | const qreal m = ct.acmyk.magenta / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
919 | const qreal y = ct.acmyk.yellow / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
920 | const qreal k = ct.acmyk.black / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
921 | - | |||||||||||||||||||
922 | color.ct.argb.red = qRound((qreal(1.0) - (c * (qreal(1.0) - k) + k)) * (32767 * 2 + 1)); | - | ||||||||||||||||||
923 | color.ct.argb.green = qRound((qreal(1.0) - (m * (qreal(1.0) - k) + k)) * (32767 * 2 + 1)); | - | ||||||||||||||||||
924 | color.ct.argb.blue = qRound((qreal(1.0) - (y * (qreal(1.0) - k) + k)) * (32767 * 2 + 1)); | - | ||||||||||||||||||
925 | break; never executed: break; | 0 | ||||||||||||||||||
926 | } | - | ||||||||||||||||||
927 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
928 | break; never executed: break; | 0 | ||||||||||||||||||
929 | } | - | ||||||||||||||||||
930 | - | |||||||||||||||||||
931 | return never executed: color;return color; never executed: return color; | 0 | ||||||||||||||||||
932 | } | - | ||||||||||||||||||
933 | QColor QColor::toHsv() const noexcept | - | ||||||||||||||||||
934 | { | - | ||||||||||||||||||
935 | if (!isValid()
| 0 | ||||||||||||||||||
936 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||||||||
937 | - | |||||||||||||||||||
938 | if (cspec != Rgb
| 0 | ||||||||||||||||||
939 | return never executed: toRgb().toHsv();return toRgb().toHsv(); never executed: return toRgb().toHsv(); | 0 | ||||||||||||||||||
940 | - | |||||||||||||||||||
941 | QColor color; | - | ||||||||||||||||||
942 | color.cspec = Hsv; | - | ||||||||||||||||||
943 | color.ct.ahsv.alpha = ct.argb.alpha; | - | ||||||||||||||||||
944 | color.ct.ahsv.pad = 0; | - | ||||||||||||||||||
945 | - | |||||||||||||||||||
946 | const qreal r = ct.argb.red / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
947 | const qreal g = ct.argb.green / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
948 | const qreal b = ct.argb.blue / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
949 | const qreal max = ( ( r > g
| 0 | ||||||||||||||||||
950 | const qreal min = ( ( r < g
| 0 | ||||||||||||||||||
951 | const qreal delta = max - min; | - | ||||||||||||||||||
952 | color.ct.ahsv.value = qRound(max * (32767 * 2 + 1)); | - | ||||||||||||||||||
953 | if (qFuzzyIsNull(delta)
| 0 | ||||||||||||||||||
954 | - | |||||||||||||||||||
955 | color.ct.ahsv.hue = (32767 * 2 + 1); | - | ||||||||||||||||||
956 | color.ct.ahsv.saturation = 0; | - | ||||||||||||||||||
957 | } never executed: else {end of block | 0 | ||||||||||||||||||
958 | - | |||||||||||||||||||
959 | qreal hue = 0; | - | ||||||||||||||||||
960 | color.ct.ahsv.saturation = qRound((delta / max) * (32767 * 2 + 1)); | - | ||||||||||||||||||
961 | if (qFuzzyCompare(r, max)
| 0 | ||||||||||||||||||
962 | hue = ((g - b) /delta); | - | ||||||||||||||||||
963 | } never executed: else if (qFuzzyCompare(g, max)end of block
| 0 | ||||||||||||||||||
964 | hue = (qreal(2.0) + (b - r) / delta); | - | ||||||||||||||||||
965 | } never executed: else if (qFuzzyCompare(b, max)end of block
| 0 | ||||||||||||||||||
966 | hue = (qreal(4.0) + (r - g) / delta); | - | ||||||||||||||||||
967 | } never executed: else {end of block | 0 | ||||||||||||||||||
968 | ((!(false)) ? qt_assert_x("QColor::toHsv", "internal error",__FILE__,17501756) : qt_noop()); | - | ||||||||||||||||||
969 | } never executed: end of block | 0 | ||||||||||||||||||
970 | hue *= qreal(60.0); | - | ||||||||||||||||||
971 | if (hue < qreal(0.0)
| 0 | ||||||||||||||||||
972 | hue += qreal(360.0); never executed: hue += qreal(360.0); | 0 | ||||||||||||||||||
973 | color.ct.ahsv.hue = qRound(hue * 100); | - | ||||||||||||||||||
974 | } never executed: end of block | 0 | ||||||||||||||||||
975 | - | |||||||||||||||||||
976 | return never executed: color;return color; never executed: return color; | 0 | ||||||||||||||||||
977 | } | - | ||||||||||||||||||
978 | - | |||||||||||||||||||
979 | - | |||||||||||||||||||
980 | - | |||||||||||||||||||
981 | - | |||||||||||||||||||
982 | - | |||||||||||||||||||
983 | - | |||||||||||||||||||
984 | QColor QColor::toHsl() const noexcept | - | ||||||||||||||||||
985 | { | - | ||||||||||||||||||
986 | if (!isValid()
| 0 | ||||||||||||||||||
987 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||||||||
988 | - | |||||||||||||||||||
989 | if (cspec != Rgb
| 0 | ||||||||||||||||||
990 | return never executed: toRgb().toHsl();return toRgb().toHsl(); never executed: return toRgb().toHsl(); | 0 | ||||||||||||||||||
991 | - | |||||||||||||||||||
992 | QColor color; | - | ||||||||||||||||||
993 | color.cspec = Hsl; | - | ||||||||||||||||||
994 | color.ct.ahsl.alpha = ct.argb.alpha; | - | ||||||||||||||||||
995 | color.ct.ahsl.pad = 0; | - | ||||||||||||||||||
996 | - | |||||||||||||||||||
997 | const qreal r = ct.argb.red / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
998 | const qreal g = ct.argb.green / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
999 | const qreal b = ct.argb.blue / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
1000 | const qreal max = ( ( r > g
| 0 | ||||||||||||||||||
1001 | const qreal min = ( ( r < g
| 0 | ||||||||||||||||||
1002 | const qreal delta = max - min; | - | ||||||||||||||||||
1003 | const qreal delta2 = max + min; | - | ||||||||||||||||||
1004 | const qreal lightness = qreal(0.5) * delta2; | - | ||||||||||||||||||
1005 | color.ct.ahsl.lightness = qRound(lightness * (32767 * 2 + 1)); | - | ||||||||||||||||||
1006 | if (qFuzzyIsNull(delta)
| 0 | ||||||||||||||||||
1007 | - | |||||||||||||||||||
1008 | color.ct.ahsl.hue = (32767 * 2 + 1); | - | ||||||||||||||||||
1009 | color.ct.ahsl.saturation = 0; | - | ||||||||||||||||||
1010 | } never executed: else {end of block | 0 | ||||||||||||||||||
1011 | - | |||||||||||||||||||
1012 | qreal hue = 0; | - | ||||||||||||||||||
1013 | if (lightness < qreal(0.5)
| 0 | ||||||||||||||||||
1014 | color.ct.ahsl.saturation = qRound((delta / delta2) * (32767 * 2 + 1)); never executed: color.ct.ahsl.saturation = qRound((delta / delta2) * (32767 * 2 + 1)); | 0 | ||||||||||||||||||
1015 | else | - | ||||||||||||||||||
1016 | color.ct.ahsl.saturation = qRound((delta / (qreal(2.0) - delta2)) * (32767 * 2 + 1)); never executed: color.ct.ahsl.saturation = qRound((delta / (qreal(2.0) - delta2)) * (32767 * 2 + 1)); | 0 | ||||||||||||||||||
1017 | if (qFuzzyCompare(r, max)
| 0 | ||||||||||||||||||
1018 | hue = ((g - b) /delta); | - | ||||||||||||||||||
1019 | } never executed: else if (qFuzzyCompare(g, max)end of block
| 0 | ||||||||||||||||||
1020 | hue = (qreal(2.0) + (b - r) / delta); | - | ||||||||||||||||||
1021 | } never executed: else if (qFuzzyCompare(b, max)end of block
| 0 | ||||||||||||||||||
1022 | hue = (qreal(4.0) + (r - g) / delta); | - | ||||||||||||||||||
1023 | } never executed: else {end of block | 0 | ||||||||||||||||||
1024 | ((!(false)) ? qt_assert_x("QColor::toHsv", "internal error",__FILE__,18061812) : qt_noop()); | - | ||||||||||||||||||
1025 | } never executed: end of block | 0 | ||||||||||||||||||
1026 | hue *= qreal(60.0); | - | ||||||||||||||||||
1027 | if (hue < qreal(0.0)
| 0 | ||||||||||||||||||
1028 | hue += qreal(360.0); never executed: hue += qreal(360.0); | 0 | ||||||||||||||||||
1029 | color.ct.ahsl.hue = qRound(hue * 100); | - | ||||||||||||||||||
1030 | } never executed: end of block | 0 | ||||||||||||||||||
1031 | - | |||||||||||||||||||
1032 | return never executed: color;return color; never executed: return color; | 0 | ||||||||||||||||||
1033 | } | - | ||||||||||||||||||
1034 | - | |||||||||||||||||||
1035 | - | |||||||||||||||||||
1036 | - | |||||||||||||||||||
1037 | - | |||||||||||||||||||
1038 | - | |||||||||||||||||||
1039 | - | |||||||||||||||||||
1040 | QColor QColor::toCmyk() const noexcept | - | ||||||||||||||||||
1041 | { | - | ||||||||||||||||||
1042 | if (!isValid()
| 0 | ||||||||||||||||||
1043 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||||||||
1044 | if (cspec != Rgb
| 0 | ||||||||||||||||||
1045 | return never executed: toRgb().toCmyk();return toRgb().toCmyk(); never executed: return toRgb().toCmyk(); | 0 | ||||||||||||||||||
1046 | - | |||||||||||||||||||
1047 | QColor color; | - | ||||||||||||||||||
1048 | color.cspec = Cmyk; | - | ||||||||||||||||||
1049 | color.ct.acmyk.alpha = ct.argb.alpha; | - | ||||||||||||||||||
1050 | - | |||||||||||||||||||
1051 | - | |||||||||||||||||||
1052 | const qreal r = ct.argb.red / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
1053 | const qreal g = ct.argb.green / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
1054 | const qreal b = ct.argb.blue / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
1055 | qreal c = qreal(1.0) - r; | - | ||||||||||||||||||
1056 | qreal m = qreal(1.0) - g; | - | ||||||||||||||||||
1057 | qreal y = qreal(1.0) - b; | - | ||||||||||||||||||
1058 | - | |||||||||||||||||||
1059 | - | |||||||||||||||||||
1060 | const qreal k = qMin(c, qMin(m, y)); | - | ||||||||||||||||||
1061 | - | |||||||||||||||||||
1062 | if (!qFuzzyIsNull(k - 1)
| 0 | ||||||||||||||||||
1063 | c = (c - k) / (qreal(1.0) - k); | - | ||||||||||||||||||
1064 | m = (m - k) / (qreal(1.0) - k); | - | ||||||||||||||||||
1065 | y = (y - k) / (qreal(1.0) - k); | - | ||||||||||||||||||
1066 | } never executed: end of block | 0 | ||||||||||||||||||
1067 | - | |||||||||||||||||||
1068 | color.ct.acmyk.cyan = qRound(c * (32767 * 2 + 1)); | - | ||||||||||||||||||
1069 | color.ct.acmyk.magenta = qRound(m * (32767 * 2 + 1)); | - | ||||||||||||||||||
1070 | color.ct.acmyk.yellow = qRound(y * (32767 * 2 + 1)); | - | ||||||||||||||||||
1071 | color.ct.acmyk.black = qRound(k * (32767 * 2 + 1)); | - | ||||||||||||||||||
1072 | - | |||||||||||||||||||
1073 | return never executed: color;return color; never executed: return color; | 0 | ||||||||||||||||||
1074 | } | - | ||||||||||||||||||
1075 | - | |||||||||||||||||||
1076 | QColor QColor::convertTo(QColor::Spec colorSpec) const noexcept | - | ||||||||||||||||||
1077 | { | - | ||||||||||||||||||
1078 | if (colorSpec == cspec
| 0 | ||||||||||||||||||
1079 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||||||||
1080 | switch (colorSpec) { | - | ||||||||||||||||||
1081 | case never executed: Rgb:case Rgb: never executed: case Rgb: | 0 | ||||||||||||||||||
1082 | return never executed: toRgb();return toRgb(); never executed: return toRgb(); | 0 | ||||||||||||||||||
1083 | case never executed: Hsv:case Hsv: never executed: case Hsv: | 0 | ||||||||||||||||||
1084 | return never executed: toHsv();return toHsv(); never executed: return toHsv(); | 0 | ||||||||||||||||||
1085 | case never executed: Cmyk:case Cmyk: never executed: case Cmyk: | 0 | ||||||||||||||||||
1086 | return never executed: toCmyk();return toCmyk(); never executed: return toCmyk(); | 0 | ||||||||||||||||||
1087 | case never executed: Hsl:case Hsl: never executed: case Hsl: | 0 | ||||||||||||||||||
1088 | return never executed: toHsl();return toHsl(); never executed: return toHsl(); | 0 | ||||||||||||||||||
1089 | case never executed: Invalid:case Invalid: never executed: case Invalid: | 0 | ||||||||||||||||||
1090 | break; never executed: break; | 0 | ||||||||||||||||||
1091 | } | - | ||||||||||||||||||
1092 | return never executed: QColor();return QColor(); never executed: return QColor(); | 0 | ||||||||||||||||||
1093 | } | - | ||||||||||||||||||
1094 | QColor QColor::fromRgb(QRgb rgb) noexcept | - | ||||||||||||||||||
1095 | { | - | ||||||||||||||||||
1096 | return never executed: fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb));return fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb)); never executed: return fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb)); | 0 | ||||||||||||||||||
1097 | } | - | ||||||||||||||||||
1098 | QColor QColor::fromRgba(QRgb rgba) noexcept | - | ||||||||||||||||||
1099 | { | - | ||||||||||||||||||
1100 | return never executed: fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba));return fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba)); never executed: return fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba)); | 0 | ||||||||||||||||||
1101 | } | - | ||||||||||||||||||
1102 | QColor QColor::fromRgb(int r, int g, int b, int a) | - | ||||||||||||||||||
1103 | { | - | ||||||||||||||||||
1104 | if (r < 0 || r > 255 | - | ||||||||||||||||||
1105 | || g < 0 || g > 255 | - | ||||||||||||||||||
1106 | || b < 0 || b > 255 | - | ||||||||||||||||||
1107 | || a < 0 || a > 255) { | - | ||||||||||||||||||
1108 | QMessageLogger(__FILE__, 19251931, __PRETTY_FUNCTION__).warning("QColor::fromRgb: RGB parameters out of range"); | - | ||||||||||||||||||
1109 | return QColor(); | - | ||||||||||||||||||
1110 | } | - | ||||||||||||||||||
1111 | - | |||||||||||||||||||
1112 | QColor color; | - | ||||||||||||||||||
1113 | color.cspec = Rgb; | - | ||||||||||||||||||
1114 | color.ct.argb.alpha = a * 0x101; | - | ||||||||||||||||||
1115 | color.ct.argb.red = r * 0x101; | - | ||||||||||||||||||
1116 | color.ct.argb.green = g * 0x101; | - | ||||||||||||||||||
1117 | color.ct.argb.blue = b * 0x101; | - | ||||||||||||||||||
1118 | color.ct.argb.pad = 0; | - | ||||||||||||||||||
1119 | return color; | - | ||||||||||||||||||
1120 | } | - | ||||||||||||||||||
1121 | QColor QColor::fromRgbF(qreal r, qreal g, qreal b, qreal a) | - | ||||||||||||||||||
1122 | { | - | ||||||||||||||||||
1123 | if (r < qreal(0.0) || r > qreal(1.0) | - | ||||||||||||||||||
1124 | || g < qreal(0.0) || g > qreal(1.0) | - | ||||||||||||||||||
1125 | || b < qreal(0.0) || b > qreal(1.0) | - | ||||||||||||||||||
1126 | || a < qreal(0.0) || a > qreal(1.0)) { | - | ||||||||||||||||||
1127 | QMessageLogger(__FILE__, 19541960, __PRETTY_FUNCTION__).warning("QColor::fromRgbF: RGB parameters out of range"); | - | ||||||||||||||||||
1128 | return QColor(); | - | ||||||||||||||||||
1129 | } | - | ||||||||||||||||||
1130 | - | |||||||||||||||||||
1131 | QColor color; | - | ||||||||||||||||||
1132 | color.cspec = Rgb; | - | ||||||||||||||||||
1133 | color.ct.argb.alpha = qRound(a * (32767 * 2 + 1)); | - | ||||||||||||||||||
1134 | color.ct.argb.red = qRound(r * (32767 * 2 + 1)); | - | ||||||||||||||||||
1135 | color.ct.argb.green = qRound(g * (32767 * 2 + 1)); | - | ||||||||||||||||||
1136 | color.ct.argb.blue = qRound(b * (32767 * 2 + 1)); | - | ||||||||||||||||||
1137 | color.ct.argb.pad = 0; | - | ||||||||||||||||||
1138 | return color; | - | ||||||||||||||||||
1139 | } | - | ||||||||||||||||||
1140 | QColor QColor::fromRgba64(ushort r, ushort g, ushort b, ushort a) noexcept | - | ||||||||||||||||||
1141 | { | - | ||||||||||||||||||
1142 | QColor color; | - | ||||||||||||||||||
1143 | color.setRgba64(qRgba64(r, g, b, a)); | - | ||||||||||||||||||
1144 | return never executed: color;return color; never executed: return color; | 0 | ||||||||||||||||||
1145 | } | - | ||||||||||||||||||
1146 | QColor QColor::fromRgba64(QRgba64 rgba64) noexcept | - | ||||||||||||||||||
1147 | { | - | ||||||||||||||||||
1148 | QColor color; | - | ||||||||||||||||||
1149 | color.setRgba64(rgba64); | - | ||||||||||||||||||
1150 | return never executed: color;return color; never executed: return color; | 0 | ||||||||||||||||||
1151 | } | - | ||||||||||||||||||
1152 | QColor QColor::fromHsv(int h, int s, int v, int a) | - | ||||||||||||||||||
1153 | { | - | ||||||||||||||||||
1154 | if (((h < 0 || h >= 360) && h != -1) | - | ||||||||||||||||||
1155 | || s < 0 || s > 255 | - | ||||||||||||||||||
1156 | || v < 0 || v > 255 | - | ||||||||||||||||||
1157 | || a < 0 || a > 255) { | - | ||||||||||||||||||
1158 | QMessageLogger(__FILE__, 20162022, __PRETTY_FUNCTION__).warning("QColor::fromHsv: HSV parameters out of range"); | - | ||||||||||||||||||
1159 | return QColor(); | - | ||||||||||||||||||
1160 | } | - | ||||||||||||||||||
1161 | - | |||||||||||||||||||
1162 | QColor color; | - | ||||||||||||||||||
1163 | color.cspec = Hsv; | - | ||||||||||||||||||
1164 | color.ct.ahsv.alpha = a * 0x101; | - | ||||||||||||||||||
1165 | color.ct.ahsv.hue = h == -1 ? (32767 * 2 + 1) : (h % 360) * 100; | - | ||||||||||||||||||
1166 | color.ct.ahsv.saturation = s * 0x101; | - | ||||||||||||||||||
1167 | color.ct.ahsv.value = v * 0x101; | - | ||||||||||||||||||
1168 | color.ct.ahsv.pad = 0; | - | ||||||||||||||||||
1169 | return color; | - | ||||||||||||||||||
1170 | } | - | ||||||||||||||||||
1171 | QColor QColor::fromHsvF(qreal h, qreal s, qreal v, qreal a) | - | ||||||||||||||||||
1172 | { | - | ||||||||||||||||||
1173 | if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0)) | - | ||||||||||||||||||
1174 | || (s < qreal(0.0) || s > qreal(1.0)) | - | ||||||||||||||||||
1175 | || (v < qreal(0.0) || v > qreal(1.0)) | - | ||||||||||||||||||
1176 | || (a < qreal(0.0) || a > qreal(1.0))) { | - | ||||||||||||||||||
1177 | QMessageLogger(__FILE__, 20472053, __PRETTY_FUNCTION__).warning("QColor::fromHsvF: HSV parameters out of range"); | - | ||||||||||||||||||
1178 | return QColor(); | - | ||||||||||||||||||
1179 | } | - | ||||||||||||||||||
1180 | - | |||||||||||||||||||
1181 | QColor color; | - | ||||||||||||||||||
1182 | color.cspec = Hsv; | - | ||||||||||||||||||
1183 | color.ct.ahsv.alpha = qRound(a * (32767 * 2 + 1)); | - | ||||||||||||||||||
1184 | color.ct.ahsv.hue = h == qreal(-1.0) ? (32767 * 2 + 1) : qRound(h * 36000); | - | ||||||||||||||||||
1185 | color.ct.ahsv.saturation = qRound(s * (32767 * 2 + 1)); | - | ||||||||||||||||||
1186 | color.ct.ahsv.value = qRound(v * (32767 * 2 + 1)); | - | ||||||||||||||||||
1187 | color.ct.ahsv.pad = 0; | - | ||||||||||||||||||
1188 | return color; | - | ||||||||||||||||||
1189 | } | - | ||||||||||||||||||
1190 | QColor QColor::fromHsl(int h, int s, int l, int a) | - | ||||||||||||||||||
1191 | { | - | ||||||||||||||||||
1192 | if (((h < 0 || h >= 360) && h != -1) | - | ||||||||||||||||||
1193 | || s < 0 || s > 255 | - | ||||||||||||||||||
1194 | || l < 0 || l > 255 | - | ||||||||||||||||||
1195 | || a < 0 || a > 255) { | - | ||||||||||||||||||
1196 | QMessageLogger(__FILE__, 20792085, __PRETTY_FUNCTION__).warning("QColor::fromHsl: HSL parameters out of range"); | - | ||||||||||||||||||
1197 | return QColor(); | - | ||||||||||||||||||
1198 | } | - | ||||||||||||||||||
1199 | - | |||||||||||||||||||
1200 | QColor color; | - | ||||||||||||||||||
1201 | color.cspec = Hsl; | - | ||||||||||||||||||
1202 | color.ct.ahsl.alpha = a * 0x101; | - | ||||||||||||||||||
1203 | color.ct.ahsl.hue = h == -1 ? (32767 * 2 + 1) : (h % 360) * 100; | - | ||||||||||||||||||
1204 | color.ct.ahsl.saturation = s * 0x101; | - | ||||||||||||||||||
1205 | color.ct.ahsl.lightness = l * 0x101; | - | ||||||||||||||||||
1206 | color.ct.ahsl.pad = 0; | - | ||||||||||||||||||
1207 | return color; | - | ||||||||||||||||||
1208 | } | - | ||||||||||||||||||
1209 | QColor QColor::fromHslF(qreal h, qreal s, qreal l, qreal a) | - | ||||||||||||||||||
1210 | { | - | ||||||||||||||||||
1211 | if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0)) | - | ||||||||||||||||||
1212 | || (s < qreal(0.0) || s > qreal(1.0)) | - | ||||||||||||||||||
1213 | || (l < qreal(0.0) || l > qreal(1.0)) | - | ||||||||||||||||||
1214 | || (a < qreal(0.0) || a > qreal(1.0))) { | - | ||||||||||||||||||
1215 | QMessageLogger(__FILE__, 21112117, __PRETTY_FUNCTION__).warning("QColor::fromHslF: HSL parameters out of range"); | - | ||||||||||||||||||
1216 | return QColor(); | - | ||||||||||||||||||
1217 | } | - | ||||||||||||||||||
1218 | - | |||||||||||||||||||
1219 | QColor color; | - | ||||||||||||||||||
1220 | color.cspec = Hsl; | - | ||||||||||||||||||
1221 | color.ct.ahsl.alpha = qRound(a * (32767 * 2 + 1)); | - | ||||||||||||||||||
1222 | color.ct.ahsl.hue = (h == qreal(-1.0)) ? (32767 * 2 + 1) : qRound(h * 36000); | - | ||||||||||||||||||
1223 | if (color.ct.ahsl.hue == 36000) | - | ||||||||||||||||||
1224 | color.ct.ahsl.hue = 0; | - | ||||||||||||||||||
1225 | color.ct.ahsl.saturation = qRound(s * (32767 * 2 + 1)); | - | ||||||||||||||||||
1226 | color.ct.ahsl.lightness = qRound(l * (32767 * 2 + 1)); | - | ||||||||||||||||||
1227 | color.ct.ahsl.pad = 0; | - | ||||||||||||||||||
1228 | return color; | - | ||||||||||||||||||
1229 | } | - | ||||||||||||||||||
1230 | void QColor::getCmyk(int *c, int *m, int *y, int *k, int *a) | - | ||||||||||||||||||
1231 | { | - | ||||||||||||||||||
1232 | if (!c || !m || !y || !k) | - | ||||||||||||||||||
1233 | return; | - | ||||||||||||||||||
1234 | - | |||||||||||||||||||
1235 | if (cspec != Invalid && cspec != Cmyk) { | - | ||||||||||||||||||
1236 | toCmyk().getCmyk(c, m, y, k, a); | - | ||||||||||||||||||
1237 | return; | - | ||||||||||||||||||
1238 | } | - | ||||||||||||||||||
1239 | - | |||||||||||||||||||
1240 | *c = ct.acmyk.cyan >> 8; | - | ||||||||||||||||||
1241 | *m = ct.acmyk.magenta >> 8; | - | ||||||||||||||||||
1242 | *y = ct.acmyk.yellow >> 8; | - | ||||||||||||||||||
1243 | *k = ct.acmyk.black >> 8; | - | ||||||||||||||||||
1244 | - | |||||||||||||||||||
1245 | if (a) | - | ||||||||||||||||||
1246 | *a = ct.acmyk.alpha >> 8; | - | ||||||||||||||||||
1247 | } | - | ||||||||||||||||||
1248 | void QColor::getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a) | - | ||||||||||||||||||
1249 | { | - | ||||||||||||||||||
1250 | if (!c || !m || !y || !k) | - | ||||||||||||||||||
1251 | return; | - | ||||||||||||||||||
1252 | - | |||||||||||||||||||
1253 | if (cspec != Invalid && cspec != Cmyk) { | - | ||||||||||||||||||
1254 | toCmyk().getCmykF(c, m, y, k, a); | - | ||||||||||||||||||
1255 | return; | - | ||||||||||||||||||
1256 | } | - | ||||||||||||||||||
1257 | - | |||||||||||||||||||
1258 | *c = ct.acmyk.cyan / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
1259 | *m = ct.acmyk.magenta / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
1260 | *y = ct.acmyk.yellow / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
1261 | *k = ct.acmyk.black / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
1262 | - | |||||||||||||||||||
1263 | if (a) | - | ||||||||||||||||||
1264 | *a = ct.acmyk.alpha / qreal((32767 * 2 + 1)); | - | ||||||||||||||||||
1265 | } | - | ||||||||||||||||||
1266 | void QColor::setCmyk(int c, int m, int y, int k, int a) | - | ||||||||||||||||||
1267 | { | - | ||||||||||||||||||
1268 | if (c < 0 || c > 255 | - | ||||||||||||||||||
1269 | || m < 0 || m > 255 | - | ||||||||||||||||||
1270 | || y < 0 || y > 255 | - | ||||||||||||||||||
1271 | || k < 0 || k > 255 | - | ||||||||||||||||||
1272 | || a < 0 || a > 255) { | - | ||||||||||||||||||
1273 | QMessageLogger(__FILE__, 22012207, __PRETTY_FUNCTION__).warning("QColor::setCmyk: CMYK parameters out of range"); | - | ||||||||||||||||||
1274 | return; | - | ||||||||||||||||||
1275 | } | - | ||||||||||||||||||
1276 | - | |||||||||||||||||||
1277 | cspec = Cmyk; | - | ||||||||||||||||||
1278 | ct.acmyk.alpha = a * 0x101; | - | ||||||||||||||||||
1279 | ct.acmyk.cyan = c * 0x101; | - | ||||||||||||||||||
1280 | ct.acmyk.magenta = m * 0x101; | - | ||||||||||||||||||
1281 | ct.acmyk.yellow = y * 0x101; | - | ||||||||||||||||||
1282 | ct.acmyk.black = k * 0x101; | - | ||||||||||||||||||
1283 | } | - | ||||||||||||||||||
1284 | void QColor::setCmykF(qreal c, qreal m, qreal y, qreal k, qreal a) | - | ||||||||||||||||||
1285 | { | - | ||||||||||||||||||
1286 | if (c < qreal(0.0) || c > qreal(1.0) | - | ||||||||||||||||||
1287 | || m < qreal(0.0) || m > qreal(1.0) | - | ||||||||||||||||||
1288 | || y < qreal(0.0) || y > qreal(1.0) | - | ||||||||||||||||||
1289 | || k < qreal(0.0) || k > qreal(1.0) | - | ||||||||||||||||||
1290 | || a < qreal(0.0) || a > qreal(1.0)) { | - | ||||||||||||||||||
1291 | QMessageLogger(__FILE__, 22302236, __PRETTY_FUNCTION__).warning("QColor::setCmykF: CMYK parameters out of range"); | - | ||||||||||||||||||
1292 | return; | - | ||||||||||||||||||
1293 | } | - | ||||||||||||||||||
1294 | - | |||||||||||||||||||
1295 | cspec = Cmyk; | - | ||||||||||||||||||
1296 | ct.acmyk.alpha = qRound(a * (32767 * 2 + 1)); | - | ||||||||||||||||||
1297 | ct.acmyk.cyan = qRound(c * (32767 * 2 + 1)); | - | ||||||||||||||||||
1298 | ct.acmyk.magenta = qRound(m * (32767 * 2 + 1)); | - | ||||||||||||||||||
1299 | ct.acmyk.yellow = qRound(y * (32767 * 2 + 1)); | - | ||||||||||||||||||
1300 | ct.acmyk.black = qRound(k * (32767 * 2 + 1)); | - | ||||||||||||||||||
1301 | } | - | ||||||||||||||||||
1302 | QColor QColor::fromCmyk(int c, int m, int y, int k, int a) | - | ||||||||||||||||||
1303 | { | - | ||||||||||||||||||
1304 | if (c < 0 || c > 255 | - | ||||||||||||||||||
1305 | || m < 0 || m > 255 | - | ||||||||||||||||||
1306 | || y < 0 || y > 255 | - | ||||||||||||||||||
1307 | || k < 0 || k > 255 | - | ||||||||||||||||||
1308 | || a < 0 || a > 255) { | - | ||||||||||||||||||
1309 | QMessageLogger(__FILE__, 22582264, __PRETTY_FUNCTION__).warning("QColor::fromCmyk: CMYK parameters out of range"); | - | ||||||||||||||||||
1310 | return QColor(); | - | ||||||||||||||||||
1311 | } | - | ||||||||||||||||||
1312 | - | |||||||||||||||||||
1313 | QColor color; | - | ||||||||||||||||||
1314 | color.cspec = Cmyk; | - | ||||||||||||||||||
1315 | color.ct.acmyk.alpha = a * 0x101; | - | ||||||||||||||||||
1316 | color.ct.acmyk.cyan = c * 0x101; | - | ||||||||||||||||||
1317 | color.ct.acmyk.magenta = m * 0x101; | - | ||||||||||||||||||
1318 | color.ct.acmyk.yellow = y * 0x101; | - | ||||||||||||||||||
1319 | color.ct.acmyk.black = k * 0x101; | - | ||||||||||||||||||
1320 | return color; | - | ||||||||||||||||||
1321 | } | - | ||||||||||||||||||
1322 | QColor QColor::fromCmykF(qreal c, qreal m, qreal y, qreal k, qreal a) | - | ||||||||||||||||||
1323 | { | - | ||||||||||||||||||
1324 | if (c < qreal(0.0) || c > qreal(1.0) | - | ||||||||||||||||||
1325 | || m < qreal(0.0) || m > qreal(1.0) | - | ||||||||||||||||||
1326 | || y < qreal(0.0) || y > qreal(1.0) | - | ||||||||||||||||||
1327 | || k < qreal(0.0) || k > qreal(1.0) | - | ||||||||||||||||||
1328 | || a < qreal(0.0) || a > qreal(1.0)) { | - | ||||||||||||||||||
1329 | QMessageLogger(__FILE__, 22902296, __PRETTY_FUNCTION__).warning("QColor::fromCmykF: CMYK parameters out of range"); | - | ||||||||||||||||||
1330 | return QColor(); | - | ||||||||||||||||||
1331 | } | - | ||||||||||||||||||
1332 | - | |||||||||||||||||||
1333 | QColor color; | - | ||||||||||||||||||
1334 | color.cspec = Cmyk; | - | ||||||||||||||||||
1335 | color.ct.acmyk.alpha = qRound(a * (32767 * 2 + 1)); | - | ||||||||||||||||||
1336 | color.ct.acmyk.cyan = qRound(c * (32767 * 2 + 1)); | - | ||||||||||||||||||
1337 | color.ct.acmyk.magenta = qRound(m * (32767 * 2 + 1)); | - | ||||||||||||||||||
1338 | color.ct.acmyk.yellow = qRound(y * (32767 * 2 + 1)); | - | ||||||||||||||||||
1339 | color.ct.acmyk.black = qRound(k * (32767 * 2 + 1)); | - | ||||||||||||||||||
1340 | return color; | - | ||||||||||||||||||
1341 | } | - | ||||||||||||||||||
1342 | QColor QColor::light(int factor) const noexcept | - | ||||||||||||||||||
1343 | { | - | ||||||||||||||||||
1344 | if (factor <= 0
| 0 | ||||||||||||||||||
1345 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||||||||
1346 | else if (factor < 100
| 0 | ||||||||||||||||||
1347 | return never executed: darker(10000 / factor);return darker(10000 / factor); never executed: return darker(10000 / factor); | 0 | ||||||||||||||||||
1348 | - | |||||||||||||||||||
1349 | QColor hsv = toHsv(); | - | ||||||||||||||||||
1350 | int s = hsv.ct.ahsv.saturation; | - | ||||||||||||||||||
1351 | uint v = hsv.ct.ahsv.value; | - | ||||||||||||||||||
1352 | - | |||||||||||||||||||
1353 | v = (factor*v)/100; | - | ||||||||||||||||||
1354 | if (v > (32767 * 2 + 1)
| 0 | ||||||||||||||||||
1355 | - | |||||||||||||||||||
1356 | s -= v - (32767 * 2 + 1); | - | ||||||||||||||||||
1357 | if (s < 0
| 0 | ||||||||||||||||||
1358 | s = 0; never executed: s = 0; | 0 | ||||||||||||||||||
1359 | v = (32767 * 2 + 1); | - | ||||||||||||||||||
1360 | } never executed: end of block | 0 | ||||||||||||||||||
1361 | - | |||||||||||||||||||
1362 | hsv.ct.ahsv.saturation = s; | - | ||||||||||||||||||
1363 | hsv.ct.ahsv.value = v; | - | ||||||||||||||||||
1364 | - | |||||||||||||||||||
1365 | - | |||||||||||||||||||
1366 | return never executed: hsv.convertTo(cspec);return hsv.convertTo(cspec); never executed: return hsv.convertTo(cspec); | 0 | ||||||||||||||||||
1367 | } | - | ||||||||||||||||||
1368 | QColor QColor::dark(int factor) const noexcept | - | ||||||||||||||||||
1369 | { | - | ||||||||||||||||||
1370 | if (factor <= 0
| 0 | ||||||||||||||||||
1371 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||||||||
1372 | else if (factor < 100
| 0 | ||||||||||||||||||
1373 | return never executed: lighter(10000 / factor);return lighter(10000 / factor); never executed: return lighter(10000 / factor); | 0 | ||||||||||||||||||
1374 | - | |||||||||||||||||||
1375 | QColor hsv = toHsv(); | - | ||||||||||||||||||
1376 | hsv.ct.ahsv.value = (hsv.ct.ahsv.value * 100) / factor; | - | ||||||||||||||||||
1377 | - | |||||||||||||||||||
1378 | - | |||||||||||||||||||
1379 | return never executed: hsv.convertTo(cspec);return hsv.convertTo(cspec); never executed: return hsv.convertTo(cspec); | 0 | ||||||||||||||||||
1380 | } | - | ||||||||||||||||||
1381 | - | |||||||||||||||||||
1382 | - | |||||||||||||||||||
1383 | - | |||||||||||||||||||
1384 | - | |||||||||||||||||||
1385 | - | |||||||||||||||||||
1386 | QColor &QColor::operator=(const QColor &color) noexcept | - | ||||||||||||||||||
1387 | { | - | ||||||||||||||||||
1388 | cspec = color.cspec; | - | ||||||||||||||||||
1389 | ct.argb = color.ct.argb; | - | ||||||||||||||||||
1390 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||||||||
1391 | } | - | ||||||||||||||||||
1392 | - | |||||||||||||||||||
1393 | - | |||||||||||||||||||
1394 | - | |||||||||||||||||||
1395 | - | |||||||||||||||||||
1396 | - | |||||||||||||||||||
1397 | QColor &QColor::operator=(Qt::GlobalColor color) noexcept | - | ||||||||||||||||||
1398 | { | - | ||||||||||||||||||
1399 | return never executed: operator=(QColor(color));return operator=(QColor(color)); never executed: return operator=(QColor(color)); | 0 | ||||||||||||||||||
1400 | } | - | ||||||||||||||||||
1401 | - | |||||||||||||||||||
1402 | - | |||||||||||||||||||
1403 | - | |||||||||||||||||||
1404 | - | |||||||||||||||||||
1405 | - | |||||||||||||||||||
1406 | bool QColor::operator==(const QColor &color) const noexcept | - | ||||||||||||||||||
1407 | { | - | ||||||||||||||||||
1408 | if (cspec == Hsl
| 0 | ||||||||||||||||||
1409 | return never executed: (ct.argb.alpha == color.ct.argb.alphareturn (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 | ||||||||||||||||||
1410 | && ((((ct.ahsl.hue % 36000 )== (color.ct.ahsl.hue % 36000 never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 | ||||||||||||||||||
1411 | ))) never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 | ||||||||||||||||||
|| (ct.ahsl.hue == color.ct.ahsl.hue)) never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); never executed: && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | ||||||||||||||||||||
1412 | || ct.ahsl.lightness == 0 never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 | ||||||||||||||||||
1413 | || color.ct.ahsl.lightness == 0 never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 | ||||||||||||||||||
1414 | || ct.ahsl.lightness == (32767 * 2 + 1) never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 | ||||||||||||||||||
1415 | || color.ct.ahsl.lightness == (32767 * 2 + 1)) never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 | ||||||||||||||||||
1416 | && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 | ||||||||||||||||||
1417 | } else { | - | ||||||||||||||||||
1418 | return never executed: (cspec == color.cspecreturn (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 | ||||||||||||||||||
1419 | && ct.argb.alpha == color.ct.argb.alpha never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 | ||||||||||||||||||
1420 | && (((cspec == QColor::Hsv) never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 | ||||||||||||||||||
1421 | && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 | ||||||||||||||||||
1422 | || (ct.ahsv.hue == color.ct.ahsv.hue)) never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 | ||||||||||||||||||
1423 | && ct.argb.green == color.ct.argb.green never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 | ||||||||||||||||||
1424 | && ct.argb.blue == color.ct.argb.blue never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 | ||||||||||||||||||
1425 | && ct.argb.pad == color.ct.argb.pad); never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 | ||||||||||||||||||
1426 | } | - | ||||||||||||||||||
1427 | } | - | ||||||||||||||||||
1428 | - | |||||||||||||||||||
1429 | - | |||||||||||||||||||
1430 | - | |||||||||||||||||||
1431 | - | |||||||||||||||||||
1432 | - | |||||||||||||||||||
1433 | bool QColor::operator!=(const QColor &color) const noexcept | - | ||||||||||||||||||
1434 | { return never executed: !operator==(color);return !operator==(color); never executed: }return !operator==(color); | 0 | ||||||||||||||||||
1435 | - | |||||||||||||||||||
1436 | - | |||||||||||||||||||
1437 | - | |||||||||||||||||||
1438 | - | |||||||||||||||||||
1439 | - | |||||||||||||||||||
1440 | QColor::operator QVariant() const | - | ||||||||||||||||||
1441 | { | - | ||||||||||||||||||
1442 | return QVariant(QVariant::Color, this); | - | ||||||||||||||||||
1443 | } | - | ||||||||||||||||||
1444 | - | |||||||||||||||||||
1445 | - | |||||||||||||||||||
1446 | - | |||||||||||||||||||
1447 | - | |||||||||||||||||||
1448 | - | |||||||||||||||||||
1449 | - | |||||||||||||||||||
1450 | void QColor::invalidate() noexcept | - | ||||||||||||||||||
1451 | { | - | ||||||||||||||||||
1452 | cspec = Invalid; | - | ||||||||||||||||||
1453 | ct.argb.alpha = (32767 * 2 + 1); | - | ||||||||||||||||||
1454 | ct.argb.red = 0; | - | ||||||||||||||||||
1455 | ct.argb.green = 0; | - | ||||||||||||||||||
1456 | ct.argb.blue = 0; | - | ||||||||||||||||||
1457 | ct.argb.pad = 0; | - | ||||||||||||||||||
1458 | } never executed: end of block | 0 | ||||||||||||||||||
1459 | - | |||||||||||||||||||
1460 | - | |||||||||||||||||||
1461 | - | |||||||||||||||||||
1462 | - | |||||||||||||||||||
1463 | - | |||||||||||||||||||
1464 | - | |||||||||||||||||||
1465 | QDebug operator<<(QDebug dbg, const QColor &c) | - | ||||||||||||||||||
1466 | { | - | ||||||||||||||||||
1467 | QDebugStateSaver saver(dbg); | - | ||||||||||||||||||
1468 | if (!c.isValid()) | - | ||||||||||||||||||
1469 | dbg.nospace() << "QColor(Invalid)"; | - | ||||||||||||||||||
1470 | else if (c.spec() == QColor::Rgb) | - | ||||||||||||||||||
1471 | dbg.nospace() << "QColor(ARGB " << c.alphaF() << ", " << c.redF() << ", " << c.greenF() << ", " << c.blueF() << ')'; | - | ||||||||||||||||||
1472 | else if (c.spec() == QColor::Hsv) | - | ||||||||||||||||||
1473 | dbg.nospace() << "QColor(AHSV " << c.alphaF() << ", " << c.hueF() << ", " << c.saturationF() << ", " << c.valueF() << ')'; | - | ||||||||||||||||||
1474 | else if (c.spec() == QColor::Cmyk) | - | ||||||||||||||||||
1475 | dbg.nospace() << "QColor(ACMYK " << c.alphaF() << ", " << c.cyanF() << ", " << c.magentaF() << ", " << c.yellowF() << ", " | - | ||||||||||||||||||
1476 | << c.blackF()<< ')'; | - | ||||||||||||||||||
1477 | else if (c.spec() == QColor::Hsl) | - | ||||||||||||||||||
1478 | dbg.nospace() << "QColor(AHSL " << c.alphaF() << ", " << c.hslHueF() << ", " << c.hslSaturationF() << ", " << c.lightnessF() << ')'; | - | ||||||||||||||||||
1479 | - | |||||||||||||||||||
1480 | return dbg; | - | ||||||||||||||||||
1481 | } | - | ||||||||||||||||||
1482 | QDataStream &operator<<(QDataStream &stream, const QColor &color) | - | ||||||||||||||||||
1483 | { | - | ||||||||||||||||||
1484 | if (stream.version() < 7) { | - | ||||||||||||||||||
1485 | if (!color.isValid()) | - | ||||||||||||||||||
1486 | return stream << quint32(0x49000000); | - | ||||||||||||||||||
1487 | quint32 p = (quint32)color.rgb(); | - | ||||||||||||||||||
1488 | if (stream.version() == 1) | - | ||||||||||||||||||
1489 | p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00); | - | ||||||||||||||||||
1490 | return stream << p; | - | ||||||||||||||||||
1491 | } | - | ||||||||||||||||||
1492 | - | |||||||||||||||||||
1493 | qint8 s = color.cspec; | - | ||||||||||||||||||
1494 | quint16 a = color.ct.argb.alpha; | - | ||||||||||||||||||
1495 | quint16 r = color.ct.argb.red; | - | ||||||||||||||||||
1496 | quint16 g = color.ct.argb.green; | - | ||||||||||||||||||
1497 | quint16 b = color.ct.argb.blue; | - | ||||||||||||||||||
1498 | quint16 p = color.ct.argb.pad; | - | ||||||||||||||||||
1499 | - | |||||||||||||||||||
1500 | stream << s; | - | ||||||||||||||||||
1501 | stream << a; | - | ||||||||||||||||||
1502 | stream << r; | - | ||||||||||||||||||
1503 | stream << g; | - | ||||||||||||||||||
1504 | stream << b; | - | ||||||||||||||||||
1505 | stream << p; | - | ||||||||||||||||||
1506 | - | |||||||||||||||||||
1507 | return stream; | - | ||||||||||||||||||
1508 | } | - | ||||||||||||||||||
1509 | QDataStream &operator>>(QDataStream &stream, QColor &color) | - | ||||||||||||||||||
1510 | { | - | ||||||||||||||||||
1511 | if (stream.version() < 7) { | - | ||||||||||||||||||
1512 | quint32 p; | - | ||||||||||||||||||
1513 | stream >> p; | - | ||||||||||||||||||
1514 | if (p == 0x49000000) { | - | ||||||||||||||||||
1515 | color.invalidate(); | - | ||||||||||||||||||
1516 | return stream; | - | ||||||||||||||||||
1517 | } | - | ||||||||||||||||||
1518 | if (stream.version() == 1) | - | ||||||||||||||||||
1519 | p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00); | - | ||||||||||||||||||
1520 | color.setRgb(p); | - | ||||||||||||||||||
1521 | return stream; | - | ||||||||||||||||||
1522 | } | - | ||||||||||||||||||
1523 | - | |||||||||||||||||||
1524 | qint8 s; | - | ||||||||||||||||||
1525 | quint16 a, r, g, b, p; | - | ||||||||||||||||||
1526 | stream >> s; | - | ||||||||||||||||||
1527 | stream >> a; | - | ||||||||||||||||||
1528 | stream >> r; | - | ||||||||||||||||||
1529 | stream >> g; | - | ||||||||||||||||||
1530 | stream >> b; | - | ||||||||||||||||||
1531 | stream >> p; | - | ||||||||||||||||||
1532 | - | |||||||||||||||||||
1533 | color.cspec = QColor::Spec(s); | - | ||||||||||||||||||
1534 | color.ct.argb.alpha = a; | - | ||||||||||||||||||
1535 | color.ct.argb.red = r; | - | ||||||||||||||||||
1536 | color.ct.argb.green = g; | - | ||||||||||||||||||
1537 | color.ct.argb.blue = b; | - | ||||||||||||||||||
1538 | color.ct.argb.pad = p; | - | ||||||||||||||||||
1539 | - | |||||||||||||||||||
1540 | return stream; | - | ||||||||||||||||||
1541 | } | - | ||||||||||||||||||
1542 | - | |||||||||||||||||||
1543 | - | |||||||||||||||||||
1544 | - | |||||||||||||||||||
1545 | const uint qt_inv_premul_factor[256] = { | - | ||||||||||||||||||
1546 | 0, 16711935, 8355967, 5570645, 4177983, 3342387, 2785322, 2387419, | - | ||||||||||||||||||
1547 | 2088991, 1856881, 1671193, 1519266, 1392661, 1285533, 1193709, 1114129, | - | ||||||||||||||||||
1548 | 1044495, 983055, 928440, 879575, 835596, 795806, 759633, 726605, | - | ||||||||||||||||||
1549 | 696330, 668477, 642766, 618960, 596854, 576273, 557064, 539094, | - | ||||||||||||||||||
1550 | 522247, 506422, 491527, 477483, 464220, 451673, 439787, 428511, | - | ||||||||||||||||||
1551 | 417798, 407608, 397903, 388649, 379816, 371376, 363302, 355573, | - | ||||||||||||||||||
1552 | 348165, 341059, 334238, 327685, 321383, 315319, 309480, 303853, | - | ||||||||||||||||||
1553 | 298427, 293191, 288136, 283253, 278532, 273966, 269547, 265268, | - | ||||||||||||||||||
1554 | 261123, 257106, 253211, 249431, 245763, 242201, 238741, 235379, | - | ||||||||||||||||||
1555 | 232110, 228930, 225836, 222825, 219893, 217038, 214255, 211543, | - | ||||||||||||||||||
1556 | 208899, 206320, 203804, 201348, 198951, 196611, 194324, 192091, | - | ||||||||||||||||||
1557 | 189908, 187774, 185688, 183647, 181651, 179698, 177786, 175915, | - | ||||||||||||||||||
1558 | 174082, 172287, 170529, 168807, 167119, 165464, 163842, 162251, | - | ||||||||||||||||||
1559 | 160691, 159161, 157659, 156186, 154740, 153320, 151926, 150557, | - | ||||||||||||||||||
1560 | 149213, 147893, 146595, 145321, 144068, 142837, 141626, 140436, | - | ||||||||||||||||||
1561 | 139266, 138115, 136983, 135869, 134773, 133695, 132634, 131590, | - | ||||||||||||||||||
1562 | 130561, 129549, 128553, 127572, 126605, 125653, 124715, 123792, | - | ||||||||||||||||||
1563 | 122881, 121984, 121100, 120229, 119370, 118524, 117689, 116866, | - | ||||||||||||||||||
1564 | 116055, 115254, 114465, 113686, 112918, 112160, 111412, 110675, | - | ||||||||||||||||||
1565 | 109946, 109228, 108519, 107818, 107127, 106445, 105771, 105106, | - | ||||||||||||||||||
1566 | 104449, 103800, 103160, 102527, 101902, 101284, 100674, 100071, | - | ||||||||||||||||||
1567 | 99475, 98887, 98305, 97730, 97162, 96600, 96045, 95496, | - | ||||||||||||||||||
1568 | 94954, 94417, 93887, 93362, 92844, 92331, 91823, 91322, | - | ||||||||||||||||||
1569 | 90825, 90334, 89849, 89368, 88893, 88422, 87957, 87497, | - | ||||||||||||||||||
1570 | 87041, 86590, 86143, 85702, 85264, 84832, 84403, 83979, | - | ||||||||||||||||||
1571 | 83559, 83143, 82732, 82324, 81921, 81521, 81125, 80733, | - | ||||||||||||||||||
1572 | 80345, 79961, 79580, 79203, 78829, 78459, 78093, 77729, | - | ||||||||||||||||||
1573 | 77370, 77013, 76660, 76310, 75963, 75619, 75278, 74941, | - | ||||||||||||||||||
1574 | 74606, 74275, 73946, 73620, 73297, 72977, 72660, 72346, | - | ||||||||||||||||||
1575 | 72034, 71725, 71418, 71114, 70813, 70514, 70218, 69924, | - | ||||||||||||||||||
1576 | 69633, 69344, 69057, 68773, 68491, 68211, 67934, 67659, | - | ||||||||||||||||||
1577 | 67386, 67116, 66847, 66581, 66317, 66055, 65795, 65537 | - | ||||||||||||||||||
1578 | }; | - | ||||||||||||||||||
1579 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |