qcolor.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qcolor.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5QColor::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
42QColor::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
51QColor::QColor(QRgba64 rgba64) noexcept-
52{-
53 setRgba64(rgba64);-
54}
never executed: end of block
0
55QColor::QColor(Spec spec) noexcept-
56{-
57 switch (spec) {-
58 case
never executed: case Invalid:
Invalid:
never executed: case Invalid:
0
59 invalidate();-
60 break;
never executed: break;
0
61 case
never executed: case Rgb:
Rgb:
never executed: case Rgb:
0
62 setRgb(0, 0, 0);-
63 break;
never executed: break;
0
64 case
never executed: case Hsv:
Hsv:
never executed: case Hsv:
0
65 setHsv(0, 0, 0);-
66 break;
never executed: break;
0
67 case
never executed: case Cmyk:
Cmyk:
never executed: case Cmyk:
0
68 setCmyk(0, 0, 0, 0);-
69 break;
never executed: break;
0
70 case
never executed: case Hsl:
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
75QString QColor::name() const-
76{-
77 return
never executed: return name(HexRgb);
name(HexRgb);
never executed: return name(HexRgb);
0
78}-
79QString QColor::name(NameFormat format) const-
80{-
81 switch (format) {-
82 case
never executed: case HexRgb:
HexRgb:
never executed: case HexRgb:
0
83 return
never executed: return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6);
QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6);
never executed: return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6);
0
84 case
never executed: case HexArgb:
HexArgb:
never executed: case HexArgb:
0
85-
86 return
never executed: return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8);
QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8);
never executed: return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8);
0
87 }-
88 return
never executed: return QString();
QString();
never executed: return QString();
0
89}-
90void QColor::setNamedColor(const QString &name)-
91{-
92 setColorFromString(name);-
93}
never executed: end of block
0
94bool QColor::isValidColor(const QString &name)-
95{-
96 return
never executed: return !name.isEmpty() && QColor().setColorFromString(name);
!name.isEmpty() && QColor().setColorFromString(name);
never executed: return !name.isEmpty() && QColor().setColorFromString(name);
0
97}-
98-
99bool QColor::setColorFromString(const QString &name)-
100{-
101 if (name.isEmpty()
name.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
102 invalidate();-
103 return
never executed: return true;
true;
never executed: return true;
0
104 }-
105-
106 if (name.startsWith(QLatin1Char('#'))
name.startsWit...tin1Char('#'))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
107 QRgb rgba;-
108 if (qt_get_hex_rgb(name.constData(), name.length(), &rgba)
qt_get_hex_rgb...ngth(), &rgba)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
109 setRgba(rgba);-
110 return
never executed: return true;
true;
never executed: return true;
0
111 } else {-
112 invalidate();-
113 return
never executed: return false;
false;
never executed: return false;
0
114 }-
115 }-
116-
117-
118 QRgb rgb;-
119 if (qt_get_named_rgb(name.constData(), name.length(), &rgb)
qt_get_named_r...ength(), &rgb)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
120 setRgba(rgb);-
121 return
never executed: return true;
true;
never executed: return true;
0
122 } else-
123-
124 {-
125 invalidate();-
126 return
never executed: return false;
false;
never executed: return false;
0
127 }-
128}-
129-
130-
131-
132-
133-
134-
135QStringList QColor::colorNames()-
136{-
137-
138 return
never executed: return qt_get_colornames();
qt_get_colornames();
never executed: return qt_get_colornames();
0
139-
140-
141-
142}-
143void QColor::getHsvF(qreal *h, qreal *s, qreal *v, qreal *a) const-
144{-
145 if (!h
!hDescription
TRUEnever evaluated
FALSEnever evaluated
|| !s
!sDescription
TRUEnever evaluated
FALSEnever evaluated
|| !v
!vDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
146 return;
never executed: return;
0
147-
148 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsv
cspec != HsvDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
149 toHsv().getHsvF(h, s, v, a);-
150 return;
never executed: return;
0
151 }-
152-
153 *h = ct.ahsv.hue == (32767 * 2 + 1)
ct.ahsv.hue == (32767 * 2 + 1)Description
TRUEnever evaluated
FALSEnever evaluated
? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0);
0
154 *s = ct.ahsv.saturation / qreal((32767 * 2 + 1));-
155 *v = ct.ahsv.value / qreal((32767 * 2 + 1));-
156-
157 if (a
aDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
158 *
never executed: *a = ct.ahsv.alpha / qreal((32767 * 2 + 1));
a = ct.ahsv.alpha / qreal((32767 * 2 + 1));
never executed: *a = ct.ahsv.alpha / qreal((32767 * 2 + 1));
0
159}
never executed: end of block
0
160void QColor::getHsv(int *h, int *s, int *v, int *a) const-
161{-
162 if (!h
!hDescription
TRUEnever evaluated
FALSEnever evaluated
|| !s
!sDescription
TRUEnever evaluated
FALSEnever evaluated
|| !v
!vDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
163 return;
never executed: return;
0
164-
165 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsv
cspec != HsvDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
166 toHsv().getHsv(h, s, v, a);-
167 return;
never executed: return;
0
168 }-
169-
170 *h = ct.ahsv.hue == (32767 * 2 + 1)
ct.ahsv.hue == (32767 * 2 + 1)Description
TRUEnever evaluated
FALSEnever evaluated
? -1 : ct.ahsv.hue / 100;
0
171 *s = ct.ahsv.saturation >> 8;-
172 *v = ct.ahsv.value >> 8;-
173-
174 if (a
aDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
175 *
never executed: *a = ct.ahsv.alpha >> 8;
a = ct.ahsv.alpha >> 8;
never executed: *a = ct.ahsv.alpha >> 8;
0
176}
never executed: end of block
0
177void QColor::setHsvF(qreal h, qreal s, qreal v, qreal a)-
178{-
179 if (((h < qreal(0.0)
h < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| h > qreal(1.0)
h > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
) && h != qreal(-1.0)
h != qreal(-1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
180 || (s < qreal(0.0)
s < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| s > qreal(1.0)
s > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
181 || (v < qreal(0.0)
v < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| v > qreal(1.0)
v > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
182 || (a < qreal(0.0)
a < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| a > qreal(1.0)
a > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
183 QMessageLogger(__FILE__, 697, __PRETTY_FUNCTION__).warning("QColor::setHsvF: HSV parameters out of range");-
184 return;
never executed: return;
0
185 }-
186-
187 cspec = Hsv;-
188 ct.ahsv.alpha = qRound(a * (32767 * 2 + 1));-
189 ct.ahsv.hue = h == qreal(-1.0)
h == qreal(-1.0)Description
TRUEnever evaluated
FALSEnever evaluated
? (32767 * 2 + 1) : qRound(h * 36000);
0
190 ct.ahsv.saturation = qRound(s * (32767 * 2 + 1));-
191 ct.ahsv.value = qRound(v * (32767 * 2 + 1));-
192 ct.ahsv.pad = 0;-
193}
never executed: end of block
0
194void QColor::setHsv(int h, int s, int v, int a)-
195{-
196 if (h < -1
h < -1Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(uint)s > 255Description
TRUEnever evaluated
FALSEnever evaluated
uint)s > 255
(uint)s > 255Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(uint)v > 255Description
TRUEnever evaluated
FALSEnever evaluated
uint)v > 255
(uint)v > 255Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(uint)a > 255Description
TRUEnever evaluated
FALSEnever evaluated
uint)a > 255
(uint)a > 255Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
197 QMessageLogger(__FILE__, 721, __PRETTY_FUNCTION__).warning("QColor::setHsv: HSV parameters out of range");-
198 invalidate();-
199 return;
never executed: return;
0
200 }-
201-
202 cspec = Hsv;-
203 ct.ahsv.alpha = a * 0x101;-
204 ct.ahsv.hue = h == -1
h == -1Description
TRUEnever evaluated
FALSEnever evaluated
? (32767 * 2 + 1) : (h % 360) * 100;
0
205 ct.ahsv.saturation = s * 0x101;-
206 ct.ahsv.value = v * 0x101;-
207 ct.ahsv.pad = 0;-
208}
never executed: end of block
0
209void QColor::getHslF(qreal *h, qreal *s, qreal *l, qreal *a) const-
210{-
211 if (!h
!hDescription
TRUEnever evaluated
FALSEnever evaluated
|| !s
!sDescription
TRUEnever evaluated
FALSEnever evaluated
|| !l
!lDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
212 return;
never executed: return;
0
213-
214 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsl
cspec != HslDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
215 toHsl().getHslF(h, s, l, a);-
216 return;
never executed: return;
0
217 }-
218-
219 *h = ct.ahsl.hue == (32767 * 2 + 1)
ct.ahsl.hue == (32767 * 2 + 1)Description
TRUEnever evaluated
FALSEnever evaluated
? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0);
0
220 *s = ct.ahsl.saturation / qreal((32767 * 2 + 1));-
221 *l = ct.ahsl.lightness / qreal((32767 * 2 + 1));-
222-
223 if (a
aDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
224 *
never executed: *a = ct.ahsl.alpha / qreal((32767 * 2 + 1));
a = ct.ahsl.alpha / qreal((32767 * 2 + 1));
never executed: *a = ct.ahsl.alpha / qreal((32767 * 2 + 1));
0
225}
never executed: end of block
0
226void QColor::getHsl(int *h, int *s, int *l, int *a) const-
227{-
228 if (!h
!hDescription
TRUEnever evaluated
FALSEnever evaluated
|| !s
!sDescription
TRUEnever evaluated
FALSEnever evaluated
|| !l
!lDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
229 return;
never executed: return;
0
230-
231 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsl
cspec != HslDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
232 toHsl().getHsl(h, s, l, a);-
233 return;
never executed: return;
0
234 }-
235-
236 *h = ct.ahsl.hue == (32767 * 2 + 1)
ct.ahsl.hue == (32767 * 2 + 1)Description
TRUEnever evaluated
FALSEnever evaluated
? -1 : ct.ahsl.hue / 100;
0
237 *s = ct.ahsl.saturation >> 8;-
238 *l = ct.ahsl.lightness >> 8;-
239-
240 if (a
aDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
241 *
never executed: *a = ct.ahsl.alpha >> 8;
a = ct.ahsl.alpha >> 8;
never executed: *a = ct.ahsl.alpha >> 8;
0
242}
never executed: end of block
0
243void QColor::setHslF(qreal h, qreal s, qreal l, qreal a)-
244{-
245 if (((h < qreal(0.0)
h < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| h > qreal(1.0)
h > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
) && h != qreal(-1.0)
h != qreal(-1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
246 || (s < qreal(0.0)
s < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| s > qreal(1.0)
s > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
247 || (l < qreal(0.0)
l < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| l > qreal(1.0)
l > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
248 || (a < qreal(0.0)
a < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| a > qreal(1.0)
a > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
249 QMessageLogger(__FILE__, 810, __PRETTY_FUNCTION__).warning("QColor::setHsvF: HSV parameters out of range");-
250 return;
never executed: return;
0
251 }-
252-
253 cspec = Hsl;-
254 ct.ahsl.alpha = qRound(a * (32767 * 2 + 1));-
255 ct.ahsl.hue = h == qreal(-1.0)
h == qreal(-1.0)Description
TRUEnever evaluated
FALSEnever evaluated
? (32767 * 2 + 1) : qRound(h * 36000);
0
256 ct.ahsl.saturation = qRound(s * (32767 * 2 + 1));-
257 ct.ahsl.lightness = qRound(l * (32767 * 2 + 1));-
258 ct.ahsl.pad = 0;-
259}
never executed: end of block
0
260void QColor::setHsl(int h, int s, int l, int a)-
261{-
262 if (h < -1
h < -1Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(uint)s > 255Description
TRUEnever evaluated
FALSEnever evaluated
uint)s > 255
(uint)s > 255Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(uint)l > 255Description
TRUEnever evaluated
FALSEnever evaluated
uint)l > 255
(uint)l > 255Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(uint)a > 255Description
TRUEnever evaluated
FALSEnever evaluated
uint)a > 255
(uint)a > 255Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
263 QMessageLogger(__FILE__, 836, __PRETTY_FUNCTION__).warning("QColor::setHsv: HSV parameters out of range");-
264 invalidate();-
265 return;
never executed: return;
0
266 }-
267-
268 cspec = Hsl;-
269 ct.ahsl.alpha = a * 0x101;-
270 ct.ahsl.hue = h == -1
h == -1Description
TRUEnever evaluated
FALSEnever evaluated
? (32767 * 2 + 1) : (h % 360) * 100;
0
271 ct.ahsl.saturation = s * 0x101;-
272 ct.ahsl.lightness = l * 0x101;-
273 ct.ahsl.pad = 0;-
274}
never executed: end of block
0
275void QColor::getRgbF(qreal *r, qreal *g, qreal *b, qreal *a) const-
276{-
277 if (!r
!rDescription
TRUEnever evaluated
FALSEnever evaluated
|| !g
!gDescription
TRUEnever evaluated
FALSEnever evaluated
|| !b
!bDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
278 return;
never executed: return;
0
279-
280 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
281 toRgb().getRgbF(r, g, b, a);-
282 return;
never executed: return;
0
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
aDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
290 *
never executed: *a = ct.argb.alpha / qreal((32767 * 2 + 1));
a = ct.argb.alpha / qreal((32767 * 2 + 1));
never executed: *a = ct.argb.alpha / qreal((32767 * 2 + 1));
0
291-
292}
never executed: end of block
0
293void QColor::getRgb(int *r, int *g, int *b, int *a) const-
294{-
295 if (!r
!rDescription
TRUEnever evaluated
FALSEnever evaluated
|| !g
!gDescription
TRUEnever evaluated
FALSEnever evaluated
|| !b
!bDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
296 return;
never executed: return;
0
297-
298 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
299 toRgb().getRgb(r, g, b, a);-
300 return;
never executed: return;
0
301 }-
302-
303 *r = ct.argb.red >> 8;-
304 *g = ct.argb.green >> 8;-
305 *b = ct.argb.blue >> 8;-
306-
307 if (a
aDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
308 *
never executed: *a = ct.argb.alpha >> 8;
a = ct.argb.alpha >> 8;
never executed: *a = ct.argb.alpha >> 8;
0
309}
never executed: end of block
0
310void QColor::setRgbF(qreal r, qreal g, qreal b, qreal a)-
311{-
312 if (r < qreal(0.0)
r < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| r > qreal(1.0)
r > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
313 || g < qreal(0.0)
g < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| g > qreal(1.0)
g > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
314 || b < qreal(0.0)
b < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| b > qreal(1.0)
b > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
315 || a < qreal(0.0)
a < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| a > qreal(1.0)
a > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
316 QMessageLogger(__FILE__, 922, __PRETTY_FUNCTION__).warning("QColor::setRgbF: RGB parameters out of range");-
317 invalidate();-
318 return;
never executed: return;
0
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}
never executed: end of block
0
328void QColor::setRgb(int r, int g, int b, int a)-
329{-
330 if ((
(uint)r > 255Description
TRUEnever evaluated
FALSEnever evaluated
uint)r > 255
(uint)r > 255Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(uint)g > 255Description
TRUEnever evaluated
FALSEnever evaluated
uint)g > 255
(uint)g > 255Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(uint)b > 255Description
TRUEnever evaluated
FALSEnever evaluated
uint)b > 255
(uint)b > 255Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(uint)a > 255Description
TRUEnever evaluated
FALSEnever evaluated
uint)a > 255
(uint)a > 255Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
331 QMessageLogger(__FILE__, 945, __PRETTY_FUNCTION__).warning("QColor::setRgb: RGB parameters out of range");-
332 invalidate();-
333 return;
never executed: return;
0
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}
never executed: end of block
0
343QRgb QColor::rgba() const noexcept-
344{-
345 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
346 return
never executed: return toRgb().rgba();
toRgb().rgba();
never executed: return toRgb().rgba();
0
347 return
never executed: return qRgba(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8, ct.argb.alpha >> 8);
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-
355void 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
364QRgba64 QColor::rgba64() const noexcept-
365{-
366 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
367 return
never executed: return toRgb().rgba64();
toRgb().rgba64();
never executed: return toRgb().rgba64();
0
368 return
never executed: return qRgba64(ct.argb.red, ct.argb.green, ct.argb.blue, ct.argb.alpha);
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}-
370void 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
379QRgb QColor::rgb() const noexcept-
380{-
381 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
382 return
never executed: return toRgb().rgb();
toRgb().rgb();
never executed: return toRgb().rgb();
0
383 return
never executed: return qRgb(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8);
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-
391void 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-
406int QColor::alpha() const noexcept-
407{ return
never executed: return ct.argb.alpha >> 8;
ct.argb.alpha >> 8;
never executed: return ct.argb.alpha >> 8;
}
0
408void QColor::setAlpha(int alpha)-
409{-
410 do { if (alpha < 0
alpha < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| alpha > 255
alpha > 255Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 1071, __PRETTY_FUNCTION__).warning("\"QColor::setAlpha\""": invalid value %d", alpha); alpha = qMax(0, qMin(alpha, 255)); }
never executed: end of block
} while (0);
0
411 ct.argb.alpha = alpha * 0x101;-
412}
never executed: end of block
0
413-
414-
415-
416-
417-
418-
419qreal QColor::alphaF() const noexcept-
420{ return
never executed: return ct.argb.alpha / qreal((32767 * 2 + 1));
ct.argb.alpha / qreal((32767 * 2 + 1));
never executed: return ct.argb.alpha / qreal((32767 * 2 + 1));
}
0
421void QColor::setAlphaF(qreal alpha)-
422{-
423 do { if (alpha < qreal(0.0)
alpha < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| alpha > qreal(1.0)
alpha > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 1092, __PRETTY_FUNCTION__).warning("\"QColor::setAlphaF\""": invalid value %g", alpha); alpha = qMax(qreal(0.0), qMin(alpha, qreal(1.0))); }
never executed: end of block
} while (0);
0
424 qreal tmp = alpha * (32767 * 2 + 1);-
425 ct.argb.alpha = qRound(tmp);-
426}
never executed: end of block
0
427-
428-
429-
430-
431-
432-
433-
434int QColor::red() const noexcept-
435{-
436 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
437 return
never executed: return toRgb().red();
toRgb().red();
never executed: return toRgb().red();
0
438 return
never executed: return ct.argb.red >> 8;
ct.argb.red >> 8;
never executed: return ct.argb.red >> 8;
0
439}-
440-
441-
442-
443-
444-
445-
446-
447void QColor::setRed(int red)-
448{-
449 do { if (red < 0
red < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| red > 255
red > 255Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 1118, __PRETTY_FUNCTION__).warning("\"QColor::setRed\""": invalid value %d", red); red = qMax(0, qMin(red, 255)); }
never executed: end of block
} while (0);
0
450 if (cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
451 setRgb(red, green(), blue(), alpha());
never executed: setRgb(red, green(), blue(), alpha());
0
452 else-
453 ct.argb.red = red * 0x101;
never executed: ct.argb.red = red * 0x101;
0
454}-
455-
456-
457-
458-
459-
460-
461int QColor::green() const noexcept-
462{-
463 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
464 return
never executed: return toRgb().green();
toRgb().green();
never executed: return toRgb().green();
0
465 return
never executed: return ct.argb.green >> 8;
ct.argb.green >> 8;
never executed: return ct.argb.green >> 8;
0
466}-
467-
468-
469-
470-
471-
472-
473-
474void QColor::setGreen(int green)-
475{-
476 do { if (green < 0
green < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| green > 255
green > 255Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 1145, __PRETTY_FUNCTION__).warning("\"QColor::setGreen\""": invalid value %d", green); green = qMax(0, qMin(green, 255)); }
never executed: end of block
} while (0);
0
477 if (cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
478 setRgb(red(), green, blue(), alpha());
never executed: setRgb(red(), green, blue(), alpha());
0
479 else-
480 ct.argb.green = green * 0x101;
never executed: ct.argb.green = green * 0x101;
0
481}-
482-
483-
484-
485-
486-
487-
488-
489int QColor::blue() const noexcept-
490{-
491 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
492 return
never executed: return toRgb().blue();
toRgb().blue();
never executed: return toRgb().blue();
0
493 return
never executed: return ct.argb.blue >> 8;
ct.argb.blue >> 8;
never executed: return ct.argb.blue >> 8;
0
494}-
495void QColor::setBlue(int blue)-
496{-
497 do { if (blue < 0
blue < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| blue > 255
blue > 255Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 1174, __PRETTY_FUNCTION__).warning("\"QColor::setBlue\""": invalid value %d", blue); blue = qMax(0, qMin(blue, 255)); }
never executed: end of block
} while (0);
0
498 if (cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
499 setRgb(red(), green(), blue, alpha());
never executed: setRgb(red(), green(), blue, alpha());
0
500 else-
501 ct.argb.blue = blue * 0x101;
never executed: ct.argb.blue = blue * 0x101;
0
502}-
503-
504-
505-
506-
507-
508-
509qreal QColor::redF() const noexcept-
510{-
511 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
512 return
never executed: return toRgb().redF();
toRgb().redF();
never executed: return toRgb().redF();
0
513 return
never executed: return ct.argb.red / qreal((32767 * 2 + 1));
ct.argb.red / qreal((32767 * 2 + 1));
never executed: return ct.argb.red / qreal((32767 * 2 + 1));
0
514}-
515void QColor::setRedF(qreal red)-
516{-
517 do { if (red < qreal(0.0)
red < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| red > qreal(1.0)
red > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 1202, __PRETTY_FUNCTION__).warning("\"QColor::setRedF\""": invalid value %g", red); red = qMax(qreal(0.0), qMin(red, qreal(1.0))); }
never executed: end of block
} while (0);
0
518 if (cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
519 setRgbF(red, greenF(), blueF(), alphaF());
never executed: setRgbF(red, greenF(), blueF(), alphaF());
0
520 else-
521 ct.argb.red = qRound(red * (32767 * 2 + 1));
never executed: ct.argb.red = qRound(red * (32767 * 2 + 1));
0
522}-
523-
524-
525-
526-
527-
528-
529qreal QColor::greenF() const noexcept-
530{-
531 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
532 return
never executed: return toRgb().greenF();
toRgb().greenF();
never executed: return toRgb().greenF();
0
533 return
never executed: return ct.argb.green / qreal((32767 * 2 + 1));
ct.argb.green / qreal((32767 * 2 + 1));
never executed: return ct.argb.green / qreal((32767 * 2 + 1));
0
534}-
535void QColor::setGreenF(qreal green)-
536{-
537 do { if (green < qreal(0.0)
green < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| green > qreal(1.0)
green > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 1230, __PRETTY_FUNCTION__).warning("\"QColor::setGreenF\""": invalid value %g", green); green = qMax(qreal(0.0), qMin(green, qreal(1.0))); }
never executed: end of block
} while (0);
0
538 if (cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
539 setRgbF(redF(), green, blueF(), alphaF());
never executed: setRgbF(redF(), green, blueF(), alphaF());
0
540 else-
541 ct.argb.green = qRound(green * (32767 * 2 + 1));
never executed: ct.argb.green = qRound(green * (32767 * 2 + 1));
0
542}-
543-
544-
545-
546-
547-
548-
549qreal QColor::blueF() const noexcept-
550{-
551 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
552 return
never executed: return toRgb().blueF();
toRgb().blueF();
never executed: return toRgb().blueF();
0
553 return
never executed: return ct.argb.blue / qreal((32767 * 2 + 1));
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-
562void QColor::setBlueF(qreal blue)-
563{-
564 do { if (blue < qreal(0.0)
blue < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| blue > qreal(1.0)
blue > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 1257, __PRETTY_FUNCTION__).warning("\"QColor::setBlueF\""": invalid value %g", blue); blue = qMax(qreal(0.0), qMin(blue, qreal(1.0))); }
never executed: end of block
} while (0);
0
565 if (cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
566 setRgbF(redF(), greenF(), blue, alphaF());
never executed: setRgbF(redF(), greenF(), blue, alphaF());
0
567 else-
568 ct.argb.blue = qRound(blue * (32767 * 2 + 1));
never executed: ct.argb.blue = qRound(blue * (32767 * 2 + 1));
0
569}-
570int QColor::hue() const noexcept-
571{-
572 return
never executed: return hsvHue();
hsvHue();
never executed: return hsvHue();
0
573}-
574-
575-
576-
577-
578-
579-
580int QColor::hsvHue() const noexcept-
581{-
582 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsv
cspec != HsvDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
583 return
never executed: return toHsv().hue();
toHsv().hue();
never executed: return toHsv().hue();
0
584 return
never executed: return ct.ahsv.hue == (32767 * 2 + 1) ? -1 : ct.ahsv.hue / 100;
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}-
586int QColor::saturation() const noexcept-
587{-
588 return
never executed: return hsvSaturation();
hsvSaturation();
never executed: return hsvSaturation();
0
589}-
590-
591-
592-
593-
594-
595-
596int QColor::hsvSaturation() const noexcept-
597{-
598 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsv
cspec != HsvDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
599 return
never executed: return toHsv().saturation();
toHsv().saturation();
never executed: return toHsv().saturation();
0
600 return
never executed: return ct.ahsv.saturation >> 8;
ct.ahsv.saturation >> 8;
never executed: return ct.ahsv.saturation >> 8;
0
601}-
602-
603-
604-
605-
606-
607-
608int QColor::value() const noexcept-
609{-
610 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsv
cspec != HsvDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
611 return
never executed: return toHsv().value();
toHsv().value();
never executed: return toHsv().value();
0
612 return
never executed: return ct.ahsv.value >> 8;
ct.ahsv.value >> 8;
never executed: return ct.ahsv.value >> 8;
0
613}-
614qreal QColor::hueF() const noexcept-
615{-
616 return
never executed: return hsvHueF();
hsvHueF();
never executed: return hsvHueF();
0
617}-
618-
619-
620-
621-
622-
623-
624-
625qreal QColor::hsvHueF() const noexcept-
626{-
627 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsv
cspec != HsvDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
628 return
never executed: return toHsv().hueF();
toHsv().hueF();
never executed: return toHsv().hueF();
0
629 return
never executed: return ct.ahsv.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0);
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}-
631qreal QColor::saturationF() const noexcept-
632{-
633 return
never executed: return hsvSaturationF();
hsvSaturationF();
never executed: return hsvSaturationF();
0
634}-
635-
636-
637-
638-
639-
640-
641qreal QColor::hsvSaturationF() const noexcept-
642{-
643 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsv
cspec != HsvDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
644 return
never executed: return toHsv().saturationF();
toHsv().saturationF();
never executed: return toHsv().saturationF();
0
645 return
never executed: return ct.ahsv.saturation / qreal((32767 * 2 + 1));
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-
653qreal QColor::valueF() const noexcept-
654{-
655 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsv
cspec != HsvDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
656 return
never executed: return toHsv().valueF();
toHsv().valueF();
never executed: return toHsv().valueF();
0
657 return
never executed: return ct.ahsv.value / qreal((32767 * 2 + 1));
ct.ahsv.value / qreal((32767 * 2 + 1));
never executed: return ct.ahsv.value / qreal((32767 * 2 + 1));
0
658}-
659int QColor::hslHue() const noexcept-
660{-
661 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsl
cspec != HslDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
662 return
never executed: return toHsl().hslHue();
toHsl().hslHue();
never executed: return toHsl().hslHue();
0
663 return
never executed: return ct.ahsl.hue == (32767 * 2 + 1) ? -1 : ct.ahsl.hue / 100;
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}-
665int QColor::hslSaturation() const noexcept-
666{-
667 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsl
cspec != HslDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
668 return
never executed: return toHsl().hslSaturation();
toHsl().hslSaturation();
never executed: return toHsl().hslSaturation();
0
669 return
never executed: return ct.ahsl.saturation >> 8;
ct.ahsl.saturation >> 8;
never executed: return ct.ahsl.saturation >> 8;
0
670}-
671int QColor::lightness() const noexcept-
672{-
673 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsl
cspec != HslDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
674 return
never executed: return toHsl().lightness();
toHsl().lightness();
never executed: return toHsl().lightness();
0
675 return
never executed: return ct.ahsl.lightness >> 8;
ct.ahsl.lightness >> 8;
never executed: return ct.ahsl.lightness >> 8;
0
676}-
677qreal QColor::hslHueF() const noexcept-
678{-
679 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsl
cspec != HslDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
680 return
never executed: return toHsl().hslHueF();
toHsl().hslHueF();
never executed: return toHsl().hslHueF();
0
681 return
never executed: return ct.ahsl.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0);
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}-
683qreal QColor::hslSaturationF() const noexcept-
684{-
685 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsl
cspec != HslDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
686 return
never executed: return toHsl().hslSaturationF();
toHsl().hslSaturationF();
never executed: return toHsl().hslSaturationF();
0
687 return
never executed: return ct.ahsl.saturation / qreal((32767 * 2 + 1));
ct.ahsl.saturation / qreal((32767 * 2 + 1));
never executed: return ct.ahsl.saturation / qreal((32767 * 2 + 1));
0
688}-
689qreal QColor::lightnessF() const noexcept-
690{-
691 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Hsl
cspec != HslDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
692 return
never executed: return toHsl().lightnessF();
toHsl().lightnessF();
never executed: return toHsl().lightnessF();
0
693 return
never executed: return ct.ahsl.lightness / qreal((32767 * 2 + 1));
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-
701int QColor::cyan() const noexcept-
702{-
703 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Cmyk
cspec != CmykDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
704 return
never executed: return toCmyk().cyan();
toCmyk().cyan();
never executed: return toCmyk().cyan();
0
705 return
never executed: return ct.acmyk.cyan >> 8;
ct.acmyk.cyan >> 8;
never executed: return ct.acmyk.cyan >> 8;
0
706}-
707-
708-
709-
710-
711-
712-
713int QColor::magenta() const noexcept-
714{-
715 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Cmyk
cspec != CmykDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
716 return
never executed: return toCmyk().magenta();
toCmyk().magenta();
never executed: return toCmyk().magenta();
0
717 return
never executed: return ct.acmyk.magenta >> 8;
ct.acmyk.magenta >> 8;
never executed: return ct.acmyk.magenta >> 8;
0
718}-
719-
720-
721-
722-
723-
724-
725int QColor::yellow() const noexcept-
726{-
727 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Cmyk
cspec != CmykDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
728 return
never executed: return toCmyk().yellow();
toCmyk().yellow();
never executed: return toCmyk().yellow();
0
729 return
never executed: return ct.acmyk.yellow >> 8;
ct.acmyk.yellow >> 8;
never executed: return ct.acmyk.yellow >> 8;
0
730}-
731-
732-
733-
734-
735-
736-
737-
738int QColor::black() const noexcept-
739{-
740 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Cmyk
cspec != CmykDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
741 return
never executed: return toCmyk().black();
toCmyk().black();
never executed: return toCmyk().black();
0
742 return
never executed: return ct.acmyk.black >> 8;
ct.acmyk.black >> 8;
never executed: return ct.acmyk.black >> 8;
0
743}-
744-
745-
746-
747-
748-
749-
750qreal QColor::cyanF() const noexcept-
751{-
752 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Cmyk
cspec != CmykDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
753 return
never executed: return toCmyk().cyanF();
toCmyk().cyanF();
never executed: return toCmyk().cyanF();
0
754 return
never executed: return ct.acmyk.cyan / qreal((32767 * 2 + 1));
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-
762qreal QColor::magentaF() const noexcept-
763{-
764 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Cmyk
cspec != CmykDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
765 return
never executed: return toCmyk().magentaF();
toCmyk().magentaF();
never executed: return toCmyk().magentaF();
0
766 return
never executed: return ct.acmyk.magenta / qreal((32767 * 2 + 1));
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-
774qreal QColor::yellowF() const noexcept-
775{-
776 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Cmyk
cspec != CmykDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
777 return
never executed: return toCmyk().yellowF();
toCmyk().yellowF();
never executed: return toCmyk().yellowF();
0
778 return
never executed: return ct.acmyk.yellow / qreal((32767 * 2 + 1));
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-
786qreal QColor::blackF() const noexcept-
787{-
788 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Cmyk
cspec != CmykDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
789 return
never executed: return toCmyk().blackF();
toCmyk().blackF();
never executed: return toCmyk().blackF();
0
790 return
never executed: return ct.acmyk.black / qreal((32767 * 2 + 1));
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-
798QColor QColor::toRgb() const noexcept-
799{-
800 if (!isValid()
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
|| cspec == Rgb
cspec == RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
801 return
never executed: return *this;
*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: case Hsv:
Hsv:
never executed: case Hsv:
0
810 {-
811 if (ct.ahsv.saturation == 0
ct.ahsv.saturation == 0Description
TRUEnever evaluated
FALSEnever evaluated
|| ct.ahsv.hue == (32767 * 2 + 1)
ct.ahsv.hue == (32767 * 2 + 1)Description
TRUEnever evaluated
FALSEnever evaluated
) {
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
ct.ahsv.hue == 36000Description
TRUEnever evaluated
FALSEnever evaluated
? 0 : ct.ahsv.hue / 6000.;
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
i & 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
826 const qreal q = v * (qreal(1.0) - (s * f));-
827-
828 switch (i) {-
829 case
never executed: case 1:
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: case 3:
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: case 5:
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: end of block
else {
0
846 const qreal t = v * (qreal(1.0) - (s * (qreal(1.0) - f)));-
847-
848 switch (i) {-
849 case
never executed: case 0:
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: case 2:
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: case 4:
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: case Hsl:
Hsl:
never executed: case Hsl:
0
869 {-
870 if (ct.ahsl.saturation == 0
ct.ahsl.saturation == 0Description
TRUEnever evaluated
FALSEnever evaluated
|| ct.ahsl.hue == (32767 * 2 + 1)
ct.ahsl.hue == (32767 * 2 + 1)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
871-
872 color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsl.lightness;-
873 }
never executed: end of block
else if (ct.ahsl.lightness == 0
ct.ahsl.lightness == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
874-
875 color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = 0;-
876 }
never executed: end of block
else {
0
877-
878 const qreal h = ct.ahsl.hue == 36000
ct.ahsl.hue == 36000Description
TRUEnever evaluated
FALSEnever evaluated
? 0 : 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)
l < qreal(0.5)Description
TRUEnever evaluated
FALSEnever evaluated
)
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
i != 3Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
894 if (temp3[i] < qreal(0.0)
temp3[i] < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
895 temp3[i] += qreal(1.0);
never executed: temp3[i] += qreal(1.0);
0
896 else if (temp3[i] > qreal(1.0)
temp3[i] > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
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)
sixtemp3 < qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
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 ((
(temp3[i] * qr...) < qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
temp3[i] * qreal(2.0)) < qreal(1.0)
(temp3[i] * qr...) < qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
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 ((
(temp3[i] * qr...) < qreal(2.0)Description
TRUEnever evaluated
FALSEnever evaluated
temp3[i] * qreal(3.0)) < qreal(2.0)
(temp3[i] * qr...) < qreal(2.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
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
color.ct.argb.red == 1Description
TRUEnever evaluated
FALSEnever evaluated
? 0 : color.ct.argb.red;
0
910 color.ct.argb.green = color.ct.argb.green == 1
color.ct.argb.green == 1Description
TRUEnever evaluated
FALSEnever evaluated
? 0 : color.ct.argb.green;
0
911 color.ct.argb.blue = color.ct.argb.blue == 1
color.ct.argb.blue == 1Description
TRUEnever evaluated
FALSEnever evaluated
? 0 : color.ct.argb.blue;
0
912 }
never executed: end of block
0
913 break;
never executed: break;
0
914 }-
915 case
never executed: case Cmyk:
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: return color;
color;
never executed: return color;
0
932}-
933QColor QColor::toHsv() const noexcept-
934{-
935 if (!isValid()
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
|| cspec == Hsv
cspec == HsvDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
936 return
never executed: return *this;
*this;
never executed: return *this;
0
937-
938 if (cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
939 return
never executed: return toRgb().toHsv();
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
r > gDescription
TRUEnever evaluated
FALSEnever evaluated
&& r > b
r > bDescription
TRUEnever evaluated
FALSEnever evaluated
) ? r : (g > b
g > bDescription
TRUEnever evaluated
FALSEnever evaluated
? g : b) );
0
950 const qreal min = ( ( r < g
r < gDescription
TRUEnever evaluated
FALSEnever evaluated
&& r < b
r < bDescription
TRUEnever evaluated
FALSEnever evaluated
) ? r : (g < b
g < bDescription
TRUEnever evaluated
FALSEnever evaluated
? g : b) );
0
951 const qreal delta = max - min;-
952 color.ct.ahsv.value = qRound(max * (32767 * 2 + 1));-
953 if (qFuzzyIsNull(delta)
qFuzzyIsNull(delta)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
954-
955 color.ct.ahsv.hue = (32767 * 2 + 1);-
956 color.ct.ahsv.saturation = 0;-
957 }
never executed: end of block
else {
0
958-
959 qreal hue = 0;-
960 color.ct.ahsv.saturation = qRound((delta / max) * (32767 * 2 + 1));-
961 if (qFuzzyCompare(r, max)
qFuzzyCompare(r, max)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
962 hue = ((g - b) /delta);-
963 }
never executed: end of block
else if (qFuzzyCompare(g, max)
qFuzzyCompare(g, max)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
964 hue = (qreal(2.0) + (b - r) / delta);-
965 }
never executed: end of block
else if (qFuzzyCompare(b, max)
qFuzzyCompare(b, max)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
966 hue = (qreal(4.0) + (r - g) / delta);-
967 }
never executed: end of block
else {
0
968 ((!(false)) ? qt_assert_x("QColor::toHsv", "internal error",__FILE__,1756) : qt_noop());-
969 }
never executed: end of block
0
970 hue *= qreal(60.0);-
971 if (hue < qreal(0.0)
hue < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
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: return color;
color;
never executed: return color;
0
977}-
978-
979-
980-
981-
982-
983-
984QColor QColor::toHsl() const noexcept-
985{-
986 if (!isValid()
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
|| cspec == Hsl
cspec == HslDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
987 return
never executed: return *this;
*this;
never executed: return *this;
0
988-
989 if (cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
990 return
never executed: return toRgb().toHsl();
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
r > gDescription
TRUEnever evaluated
FALSEnever evaluated
&& r > b
r > bDescription
TRUEnever evaluated
FALSEnever evaluated
) ? r : (g > b
g > bDescription
TRUEnever evaluated
FALSEnever evaluated
? g : b) );
0
1001 const qreal min = ( ( r < g
r < gDescription
TRUEnever evaluated
FALSEnever evaluated
&& r < b
r < bDescription
TRUEnever evaluated
FALSEnever evaluated
) ? r : (g < b
g < bDescription
TRUEnever evaluated
FALSEnever evaluated
? g : b) );
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)
qFuzzyIsNull(delta)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1007-
1008 color.ct.ahsl.hue = (32767 * 2 + 1);-
1009 color.ct.ahsl.saturation = 0;-
1010 }
never executed: end of block
else {
0
1011-
1012 qreal hue = 0;-
1013 if (lightness < qreal(0.5)
lightness < qreal(0.5)Description
TRUEnever evaluated
FALSEnever evaluated
)
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)
qFuzzyCompare(r, max)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1018 hue = ((g - b) /delta);-
1019 }
never executed: end of block
else if (qFuzzyCompare(g, max)
qFuzzyCompare(g, max)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1020 hue = (qreal(2.0) + (b - r) / delta);-
1021 }
never executed: end of block
else if (qFuzzyCompare(b, max)
qFuzzyCompare(b, max)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1022 hue = (qreal(4.0) + (r - g) / delta);-
1023 }
never executed: end of block
else {
0
1024 ((!(false)) ? qt_assert_x("QColor::toHsv", "internal error",__FILE__,1812) : qt_noop());-
1025 }
never executed: end of block
0
1026 hue *= qreal(60.0);-
1027 if (hue < qreal(0.0)
hue < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
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: return color;
color;
never executed: return color;
0
1033}-
1034-
1035-
1036-
1037-
1038-
1039-
1040QColor QColor::toCmyk() const noexcept-
1041{-
1042 if (!isValid()
!isValid()Description
TRUEnever evaluated
FALSEnever evaluated
|| cspec == Cmyk
cspec == CmykDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1043 return
never executed: return *this;
*this;
never executed: return *this;
0
1044 if (cspec != Rgb
cspec != RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1045 return
never executed: return toRgb().toCmyk();
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)
!qFuzzyIsNull(k - 1)Description
TRUEnever evaluated
FALSEnever evaluated
) {
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: return color;
color;
never executed: return color;
0
1074}-
1075-
1076QColor QColor::convertTo(QColor::Spec colorSpec) const noexcept-
1077{-
1078 if (colorSpec == cspec
colorSpec == cspecDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1079 return
never executed: return *this;
*this;
never executed: return *this;
0
1080 switch (colorSpec) {-
1081 case
never executed: case Rgb:
Rgb:
never executed: case Rgb:
0
1082 return
never executed: return toRgb();
toRgb();
never executed: return toRgb();
0
1083 case
never executed: case Hsv:
Hsv:
never executed: case Hsv:
0
1084 return
never executed: return toHsv();
toHsv();
never executed: return toHsv();
0
1085 case
never executed: case Cmyk:
Cmyk:
never executed: case Cmyk:
0
1086 return
never executed: return toCmyk();
toCmyk();
never executed: return toCmyk();
0
1087 case
never executed: case Hsl:
Hsl:
never executed: case Hsl:
0
1088 return
never executed: return toHsl();
toHsl();
never executed: return toHsl();
0
1089 case
never executed: case Invalid:
Invalid:
never executed: case Invalid:
0
1090 break;
never executed: break;
0
1091 }-
1092 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
1093}-
1094QColor QColor::fromRgb(QRgb rgb) noexcept-
1095{-
1096 return
never executed: return fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb));
fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb));
never executed: return fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb));
0
1097}-
1098QColor QColor::fromRgba(QRgb rgba) noexcept-
1099{-
1100 return
never executed: return fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba));
fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba));
never executed: return fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba));
0
1101}-
1102QColor QColor::fromRgb(int r, int g, int b, int a)-
1103{-
1104 if (r < 0
r < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| r > 255
r > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1105 || g < 0
g < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| g > 255
g > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1106 || b < 0
b < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| b > 255
b > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1107 || a < 0
a < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| a > 255
a > 255Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1108 QMessageLogger(__FILE__, 1931, __PRETTY_FUNCTION__).warning("QColor::fromRgb: RGB parameters out of range");-
1109 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
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
never executed: return color;
color;
never executed: return color;
0
1120}-
1121QColor QColor::fromRgbF(qreal r, qreal g, qreal b, qreal a)-
1122{-
1123 if (r < qreal(0.0)
r < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| r > qreal(1.0)
r > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1124 || g < qreal(0.0)
g < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| g > qreal(1.0)
g > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1125 || b < qreal(0.0)
b < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| b > qreal(1.0)
b > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1126 || a < qreal(0.0)
a < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| a > qreal(1.0)
a > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1127 QMessageLogger(__FILE__, 1960, __PRETTY_FUNCTION__).warning("QColor::fromRgbF: RGB parameters out of range");-
1128 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
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
never executed: return color;
color;
never executed: return color;
0
1139}-
1140QColor 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: return color;
color;
never executed: return color;
0
1145}-
1146QColor QColor::fromRgba64(QRgba64 rgba64) noexcept-
1147{-
1148 QColor color;-
1149 color.setRgba64(rgba64);-
1150 return
never executed: return color;
color;
never executed: return color;
0
1151}-
1152QColor QColor::fromHsv(int h, int s, int v, int a)-
1153{-
1154 if (((h < 0
h < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| h >= 360
h >= 360Description
TRUEnever evaluated
FALSEnever evaluated
) && h != -1
h != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1155 || s < 0
s < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| s > 255
s > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1156 || v < 0
v < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| v > 255
v > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1157 || a < 0
a < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| a > 255
a > 255Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1158 QMessageLogger(__FILE__, 2022, __PRETTY_FUNCTION__).warning("QColor::fromHsv: HSV parameters out of range");-
1159 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
1160 }-
1161-
1162 QColor color;-
1163 color.cspec = Hsv;-
1164 color.ct.ahsv.alpha = a * 0x101;-
1165 color.ct.ahsv.hue = h == -1
h == -1Description
TRUEnever evaluated
FALSEnever evaluated
? (32767 * 2 + 1) : (h % 360) * 100;
0
1166 color.ct.ahsv.saturation = s * 0x101;-
1167 color.ct.ahsv.value = v * 0x101;-
1168 color.ct.ahsv.pad = 0;-
1169 return
never executed: return color;
color;
never executed: return color;
0
1170}-
1171QColor QColor::fromHsvF(qreal h, qreal s, qreal v, qreal a)-
1172{-
1173 if (((h < qreal(0.0)
h < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| h > qreal(1.0)
h > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
) && h != qreal(-1.0)
h != qreal(-1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1174 || (s < qreal(0.0)
s < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| s > qreal(1.0)
s > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1175 || (v < qreal(0.0)
v < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| v > qreal(1.0)
v > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1176 || (a < qreal(0.0)
a < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| a > qreal(1.0)
a > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
1177 QMessageLogger(__FILE__, 2053, __PRETTY_FUNCTION__).warning("QColor::fromHsvF: HSV parameters out of range");-
1178 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
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)
h == qreal(-1.0)Description
TRUEnever evaluated
FALSEnever evaluated
? (32767 * 2 + 1) : qRound(h * 36000);
0
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
never executed: return color;
color;
never executed: return color;
0
1189}-
1190QColor QColor::fromHsl(int h, int s, int l, int a)-
1191{-
1192 if (((h < 0
h < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| h >= 360
h >= 360Description
TRUEnever evaluated
FALSEnever evaluated
) && h != -1
h != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1193 || s < 0
s < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| s > 255
s > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1194 || l < 0
l < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| l > 255
l > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1195 || a < 0
a < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| a > 255
a > 255Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1196 QMessageLogger(__FILE__, 2085, __PRETTY_FUNCTION__).warning("QColor::fromHsl: HSL parameters out of range");-
1197 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
1198 }-
1199-
1200 QColor color;-
1201 color.cspec = Hsl;-
1202 color.ct.ahsl.alpha = a * 0x101;-
1203 color.ct.ahsl.hue = h == -1
h == -1Description
TRUEnever evaluated
FALSEnever evaluated
? (32767 * 2 + 1) : (h % 360) * 100;
0
1204 color.ct.ahsl.saturation = s * 0x101;-
1205 color.ct.ahsl.lightness = l * 0x101;-
1206 color.ct.ahsl.pad = 0;-
1207 return
never executed: return color;
color;
never executed: return color;
0
1208}-
1209QColor QColor::fromHslF(qreal h, qreal s, qreal l, qreal a)-
1210{-
1211 if (((h < qreal(0.0)
h < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| h > qreal(1.0)
h > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
) && h != qreal(-1.0)
h != qreal(-1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1212 || (s < qreal(0.0)
s < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| s > qreal(1.0)
s > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1213 || (l < qreal(0.0)
l < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| l > qreal(1.0)
l > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1214 || (a < qreal(0.0)
a < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| a > qreal(1.0)
a > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
1215 QMessageLogger(__FILE__, 2117, __PRETTY_FUNCTION__).warning("QColor::fromHslF: HSL parameters out of range");-
1216 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
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))Description
TRUEnever evaluated
FALSEnever evaluated
h == qreal(-1.0))
(h == qreal(-1.0))Description
TRUEnever evaluated
FALSEnever evaluated
? (32767 * 2 + 1) : qRound(h * 36000);
0
1223 if (color.ct.ahsl.hue == 36000
color.ct.ahsl.hue == 36000Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1224 color.ct.ahsl.hue = 0;
never executed: color.ct.ahsl.hue = 0;
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
never executed: return color;
color;
never executed: return color;
0
1229}-
1230void QColor::getCmyk(int *c, int *m, int *y, int *k, int *a)-
1231{-
1232 if (!c
!cDescription
TRUEnever evaluated
FALSEnever evaluated
|| !m
!mDescription
TRUEnever evaluated
FALSEnever evaluated
|| !y
!yDescription
TRUEnever evaluated
FALSEnever evaluated
|| !k
!kDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1233 return;
never executed: return;
0
1234-
1235 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Cmyk
cspec != CmykDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1236 toCmyk().getCmyk(c, m, y, k, a);-
1237 return;
never executed: return;
0
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
aDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1246 *
never executed: *a = ct.acmyk.alpha >> 8;
a = ct.acmyk.alpha >> 8;
never executed: *a = ct.acmyk.alpha >> 8;
0
1247}
never executed: end of block
0
1248void QColor::getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a)-
1249{-
1250 if (!c
!cDescription
TRUEnever evaluated
FALSEnever evaluated
|| !m
!mDescription
TRUEnever evaluated
FALSEnever evaluated
|| !y
!yDescription
TRUEnever evaluated
FALSEnever evaluated
|| !k
!kDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1251 return;
never executed: return;
0
1252-
1253 if (cspec != Invalid
cspec != InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec != Cmyk
cspec != CmykDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1254 toCmyk().getCmykF(c, m, y, k, a);-
1255 return;
never executed: return;
0
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
aDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1264 *
never executed: *a = ct.acmyk.alpha / qreal((32767 * 2 + 1));
a = ct.acmyk.alpha / qreal((32767 * 2 + 1));
never executed: *a = ct.acmyk.alpha / qreal((32767 * 2 + 1));
0
1265}
never executed: end of block
0
1266void QColor::setCmyk(int c, int m, int y, int k, int a)-
1267{-
1268 if (c < 0
c < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| c > 255
c > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1269 || m < 0
m < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| m > 255
m > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1270 || y < 0
y < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| y > 255
y > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1271 || k < 0
k < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| k > 255
k > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1272 || a < 0
a < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| a > 255
a > 255Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1273 QMessageLogger(__FILE__, 2207, __PRETTY_FUNCTION__).warning("QColor::setCmyk: CMYK parameters out of range");-
1274 return;
never executed: return;
0
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}
never executed: end of block
0
1284void QColor::setCmykF(qreal c, qreal m, qreal y, qreal k, qreal a)-
1285{-
1286 if (c < qreal(0.0)
c < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| c > qreal(1.0)
c > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1287 || m < qreal(0.0)
m < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| m > qreal(1.0)
m > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1288 || y < qreal(0.0)
y < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| y > qreal(1.0)
y > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1289 || k < qreal(0.0)
k < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| k > qreal(1.0)
k > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1290 || a < qreal(0.0)
a < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| a > qreal(1.0)
a > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1291 QMessageLogger(__FILE__, 2236, __PRETTY_FUNCTION__).warning("QColor::setCmykF: CMYK parameters out of range");-
1292 return;
never executed: return;
0
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}
never executed: end of block
0
1302QColor QColor::fromCmyk(int c, int m, int y, int k, int a)-
1303{-
1304 if (c < 0
c < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| c > 255
c > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1305 || m < 0
m < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| m > 255
m > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1306 || y < 0
y < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| y > 255
y > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1307 || k < 0
k < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| k > 255
k > 255Description
TRUEnever evaluated
FALSEnever evaluated
0
1308 || a < 0
a < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| a > 255
a > 255Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1309 QMessageLogger(__FILE__, 2264, __PRETTY_FUNCTION__).warning("QColor::fromCmyk: CMYK parameters out of range");-
1310 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
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
never executed: return color;
color;
never executed: return color;
0
1321}-
1322QColor QColor::fromCmykF(qreal c, qreal m, qreal y, qreal k, qreal a)-
1323{-
1324 if (c < qreal(0.0)
c < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| c > qreal(1.0)
c > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1325 || m < qreal(0.0)
m < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| m > qreal(1.0)
m > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1326 || y < qreal(0.0)
y < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| y > qreal(1.0)
y > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1327 || k < qreal(0.0)
k < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| k > qreal(1.0)
k > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1328 || a < qreal(0.0)
a < qreal(0.0)Description
TRUEnever evaluated
FALSEnever evaluated
|| a > qreal(1.0)
a > qreal(1.0)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1329 QMessageLogger(__FILE__, 2296, __PRETTY_FUNCTION__).warning("QColor::fromCmykF: CMYK parameters out of range");-
1330 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
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
never executed: return color;
color;
never executed: return color;
0
1341}-
1342QColor QColor::light(int factor) const noexcept-
1343{-
1344 if (factor <= 0
factor <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1345 return
never executed: return *this;
*this;
never executed: return *this;
0
1346 else if (factor < 100
factor < 100Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1347 return
never executed: return darker(10000 / factor);
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)
v > (32767 * 2 + 1)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1355-
1356 s -= v - (32767 * 2 + 1);-
1357 if (s < 0
s < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
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: return hsv.convertTo(cspec);
hsv.convertTo(cspec);
never executed: return hsv.convertTo(cspec);
0
1367}-
1368QColor QColor::dark(int factor) const noexcept-
1369{-
1370 if (factor <= 0
factor <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1371 return
never executed: return *this;
*this;
never executed: return *this;
0
1372 else if (factor < 100
factor < 100Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1373 return
never executed: return lighter(10000 / factor);
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: return hsv.convertTo(cspec);
hsv.convertTo(cspec);
never executed: return hsv.convertTo(cspec);
0
1380}-
1381-
1382-
1383-
1384-
1385-
1386QColor &QColor::operator=(const QColor &color) noexcept-
1387{-
1388 cspec = color.cspec;-
1389 ct.argb = color.ct.argb;-
1390 return
never executed: return *this;
*this;
never executed: return *this;
0
1391}-
1392-
1393-
1394-
1395-
1396-
1397QColor &QColor::operator=(Qt::GlobalColor color) noexcept-
1398{-
1399 return
never executed: return operator=(QColor(color));
operator=(QColor(color));
never executed: return operator=(QColor(color));
0
1400}-
1401-
1402-
1403-
1404-
1405-
1406bool QColor::operator==(const QColor &color) const noexcept-
1407{-
1408 if (cspec == Hsl
cspec == HslDescription
TRUEnever evaluated
FALSEnever evaluated
&& cspec == color.cspec
cspec == color.cspecDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1409 return
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);
(ct.argb.alpha == color.ct.argb.alpha
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 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 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
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: 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);
(cspec == color.cspec
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-
1433bool QColor::operator!=(const QColor &color) const noexcept-
1434{ return
never executed: return !operator==(color);
!operator==(color);
never executed: return !operator==(color);
}
0
1435-
1436-
1437-
1438-
1439-
1440QColor::operator QVariant() const-
1441{-
1442 return
never executed: return QVariant(QVariant::Color, this);
QVariant(QVariant::Color, this);
never executed: return QVariant(QVariant::Color, this);
0
1443}-
1444-
1445-
1446-
1447-
1448-
1449-
1450void 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-
1465QDebug operator<<(QDebug dbg, const QColor &c)-
1466{-
1467 QDebugStateSaver saver(dbg);-
1468 if (!c.isValid()
!c.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1469 dbg.nospace() << "QColor(Invalid)";
never executed: dbg.nospace() << "QColor(Invalid)";
0
1470 else if (c.spec() == QColor::Rgb
c.spec() == QColor::RgbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1471 dbg.nospace() << "QColor(ARGB " << c.alphaF() << ", " << c.redF() << ", " << c.greenF() << ", " << c.blueF() << ')';
never executed: dbg.nospace() << "QColor(ARGB " << c.alphaF() << ", " << c.redF() << ", " << c.greenF() << ", " << c.blueF() << ')';
0
1472 else if (c.spec() == QColor::Hsv
c.spec() == QColor::HsvDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1473 dbg.nospace() << "QColor(AHSV " << c.alphaF() << ", " << c.hueF() << ", " << c.saturationF() << ", " << c.valueF() << ')';
never executed: dbg.nospace() << "QColor(AHSV " << c.alphaF() << ", " << c.hueF() << ", " << c.saturationF() << ", " << c.valueF() << ')';
0
1474 else if (c.spec() == QColor::Cmyk
c.spec() == QColor::CmykDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1475 dbg.nospace() << "QColor(ACMYK " << c.alphaF() << ", " << c.cyanF() << ", " << c.magentaF() << ", " << c.yellowF() << ", "
never executed: dbg.nospace() << "QColor(ACMYK " << c.alphaF() << ", " << c.cyanF() << ", " << c.magentaF() << ", " << c.yellowF() << ", " << c.blackF()<< ')';
0
1476 << c.blackF()<< ')';
never executed: dbg.nospace() << "QColor(ACMYK " << c.alphaF() << ", " << c.cyanF() << ", " << c.magentaF() << ", " << c.yellowF() << ", " << c.blackF()<< ')';
0
1477 else if (c.spec() == QColor::Hsl
c.spec() == QColor::HslDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1478 dbg.nospace() << "QColor(AHSL " << c.alphaF() << ", " << c.hslHueF() << ", " << c.hslSaturationF() << ", " << c.lightnessF() << ')';
never executed: dbg.nospace() << "QColor(AHSL " << c.alphaF() << ", " << c.hslHueF() << ", " << c.hslSaturationF() << ", " << c.lightnessF() << ')';
0
1479-
1480 return
never executed: return dbg;
dbg;
never executed: return dbg;
0
1481}-
1482QDataStream &operator<<(QDataStream &stream, const QColor &color)-
1483{-
1484 if (stream.version() < 7
stream.version() < 7Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1485 if (!color.isValid()
!color.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1486 return
never executed: return stream << quint32(0x49000000);
stream << quint32(0x49000000);
never executed: return stream << quint32(0x49000000);
0
1487 quint32 p = (quint32)color.rgb();-
1488 if (stream.version() == 1
stream.version() == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1489 p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
never executed: p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
0
1490 return
never executed: return stream << p;
stream << p;
never executed: return stream << p;
0
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
never executed: return stream;
stream;
never executed: return stream;
0
1508}-
1509QDataStream &operator>>(QDataStream &stream, QColor &color)-
1510{-
1511 if (stream.version() < 7
stream.version() < 7Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1512 quint32 p;-
1513 stream >> p;-
1514 if (p == 0x49000000
p == 0x49000000Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1515 color.invalidate();-
1516 return
never executed: return stream;
stream;
never executed: return stream;
0
1517 }-
1518 if (stream.version() == 1
stream.version() == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1519 p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
never executed: p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
0
1520 color.setRgb(p);-
1521 return
never executed: return stream;
stream;
never executed: return stream;
0
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
never executed: return stream;
stream;
never executed: return stream;
0
1541}-
1542-
1543-
1544-
1545const 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 codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9