painting/qcolor.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qcolor.h" -
43#include "qcolor_p.h" -
44#include "qnamespace.h" -
45#include "qdatastream.h" -
46#include "qvariant.h" -
47#include "qdebug.h" -
48 -
49#include <math.h> -
50#include <stdio.h> -
51#include <limits.h> -
52 -
53QT_BEGIN_NAMESPACE -
54 -
55/*! -
56 \class QColor -
57 \brief The QColor class provides colors based on RGB, HSV or CMYK values. -
58 -
59 \ingroup painting -
60 \ingroup appearance -
61 \inmodule QtGui -
62 -
63 -
64 A color is normally specified in terms of RGB (red, green, and -
65 blue) components, but it is also possible to specify it in terms -
66 of HSV (hue, saturation, and value) and CMYK (cyan, magenta, -
67 yellow and black) components. In addition a color can be specified -
68 using a color name. The color name can be any of the SVG 1.0 color -
69 names. -
70 -
71 \table -
72 \header -
73 \li RGB \li HSV \li CMYK -
74 \row -
75 \li \inlineimage qcolor-rgb.png -
76 \li \inlineimage qcolor-hsv.png -
77 \li \inlineimage qcolor-cmyk.png -
78 \endtable -
79 -
80 The QColor constructor creates the color based on RGB values. To -
81 create a QColor based on either HSV or CMYK values, use the -
82 toHsv() and toCmyk() functions respectively. These functions -
83 return a copy of the color using the desired format. In addition -
84 the static fromRgb(), fromHsv() and fromCmyk() functions create -
85 colors from the specified values. Alternatively, a color can be -
86 converted to any of the three formats using the convertTo() -
87 function (returning a copy of the color in the desired format), or -
88 any of the setRgb(), setHsv() and setCmyk() functions altering \e -
89 this color's format. The spec() function tells how the color was -
90 specified. -
91 -
92 A color can be set by passing an RGB string (such as "#112233"), -
93 or a color name (such as "blue"), to the setNamedColor() function. -
94 The color names are taken from the SVG 1.0 color names. The name() -
95 function returns the name of the color in the format -
96 "#RRGGBB". Colors can also be set using setRgb(), setHsv() and -
97 setCmyk(). To get a lighter or darker color use the lighter() and -
98 darker() functions respectively. -
99 -
100 The isValid() function indicates whether a QColor is legal at -
101 all. For example, a RGB color with RGB values out of range is -
102 illegal. For performance reasons, QColor mostly disregards illegal -
103 colors, and for that reason, the result of using an invalid color -
104 is undefined. -
105 -
106 The color components can be retrieved individually, e.g with -
107 red(), hue() and cyan(). The values of the color components can -
108 also be retrieved in one go using the getRgb(), getHsv() and -
109 getCmyk() functions. Using the RGB color model, the color -
110 components can in addition be accessed with rgb(). -
111 -
112 There are several related non-members: QRgb is a typdef for an -
113 unsigned int representing the RGB value triplet (r, g, b). Note -
114 that it also can hold a value for the alpha-channel (for more -
115 information, see the \l {QColor#Alpha-Blended -
116 Drawing}{Alpha-Blended Drawing} section). The qRed(), qBlue() and -
117 qGreen() functions return the respective component of the given -
118 QRgb value, while the qRgb() and qRgba() functions create and -
119 return the QRgb triplet based on the given component -
120 values. Finally, the qAlpha() function returns the alpha component -
121 of the provided QRgb, and the qGray() function calculates and -
122 return a gray value based on the given value. -
123 -
124 QColor is platform and device independent. The QColormap class -
125 maps the color to the hardware. -
126 -
127 For more information about painting in general, see the \l{Paint -
128 System} documentation. -
129 -
130 \tableofcontents -
131 -
132 \section1 Integer vs. Floating Point Precision -
133 -
134 QColor supports floating point precision and provides floating -
135 point versions of all the color components functions, -
136 e.g. getRgbF(), hueF() and fromCmykF(). Note that since the -
137 components are stored using 16-bit integers, there might be minor -
138 deviations between the values set using, for example, setRgbF() -
139 and the values returned by the getRgbF() function due to rounding. -
140 -
141 While the integer based functions take values in the range 0-255 -
142 (except hue() which must have values within the range 0-359), -
143 the floating point functions accept values in the range 0.0 - 1.0. -
144 -
145 \section1 Alpha-Blended Drawing -
146 -
147 QColor also support alpha-blended outlining and filling. The -
148 alpha channel of a color specifies the transparency effect, 0 -
149 represents a fully transparent color, while 255 represents a fully -
150 opaque color. For example: -
151 -
152 \snippet code/src_gui_painting_qcolor.cpp 0 -
153 -
154 The code above produces the following output: -
155 -
156 \image alphafill.png -
157 -
158 The alpha channel of a color can be retrieved and set using the -
159 alpha() and setAlpha() functions if its value is an integer, and -
160 alphaF() and setAlphaF() if its value is qreal (double). By -
161 default, the alpha-channel is set to 255 (opaque). To retrieve and -
162 set \e all the RGB color components (including the alpha-channel) -
163 in one go, use the rgba() and setRgba() functions. -
164 -
165 \section1 Predefined Colors -
166 -
167 There are 20 predefined QColors described by the Qt::GlobalColor enum, -
168 including black, white, primary and secondary colors, darker versions -
169 of these colors and three shades of gray. QColor also recognizes a -
170 variety of color names; the static colorNames() function returns a -
171 QStringList color names that QColor knows about. -
172 -
173 \image qt-colors.png Qt Colors -
174 -
175 Additionally, the Qt::color0, Qt::color1 and Qt::transparent colors -
176 are used for special purposes. -
177 -
178 Qt::color0 (zero pixel value) and Qt::color1 (non-zero pixel value) -
179 are special colors for drawing in QBitmaps. Painting with Qt::color0 -
180 sets the bitmap bits to 0 (transparent; i.e., background), and painting -
181 with Qt::color1 sets the bits to 1 (opaque; i.e., foreground). -
182 -
183 Qt::transparent is used to indicate a transparent pixel. When painting -
184 with this value, a pixel value will be used that is appropriate for the -
185 underlying pixel format in use. -
186 -
187 \section1 The HSV Color Model -
188 -
189 The RGB model is hardware-oriented. Its representation is close to -
190 what most monitors show. In contrast, HSV represents color in a way -
191 more suited to the human perception of color. For example, the -
192 relationships "stronger than", "darker than", and "the opposite of" -
193 are easily expressed in HSV but are much harder to express in RGB. -
194 -
195 HSV, like RGB, has three components: -
196 -
197 \list -
198 \li H, for hue, is in the range 0 to 359 if the color is chromatic (not -
199 gray), or meaningless if it is gray. It represents degrees on the -
200 color wheel familiar to most people. Red is 0 (degrees), green is -
201 120, and blue is 240. -
202 -
203 \inlineimage qcolor-hue.png -
204 -
205 \li S, for saturation, is in the range 0 to 255, and the bigger it is, -
206 the stronger the color is. Grayish colors have saturation near 0; very -
207 strong colors have saturation near 255. -
208 -
209 \inlineimage qcolor-saturation.png -
210 -
211 \li V, for value, is in the range 0 to 255 and represents lightness or -
212 brightness of the color. 0 is black; 255 is as far from black as -
213 possible. -
214 -
215 \inlineimage qcolor-value.png -
216 \endlist -
217 -
218 Here are some examples: pure red is H=0, S=255, V=255; a dark red, -
219 moving slightly towards the magenta, could be H=350 (equivalent to -
220 -10), S=255, V=180; a grayish light red could have H about 0 (say -
221 350-359 or 0-10), S about 50-100, and S=255. -
222 -
223 Qt returns a hue value of -1 for achromatic colors. If you pass a -
224 hue value that is too large, Qt forces it into range. Hue 360 or 720 is -
225 treated as 0; hue 540 is treated as 180. -
226 -
227 In addition to the standard HSV model, Qt provides an -
228 alpha-channel to feature \l {QColor#Alpha-Blended -
229 Drawing}{alpha-blended drawing}. -
230 -
231 \section1 The HSL Color Model -
232 -
233 HSL is similar to HSV. Instead of value parameter from HSV, -
234 HSL has the lightness parameter. -
235 The lightness parameter goes from black to color and from color to white. -
236 If you go outside at the night its black or dark gray. At day its colorful but -
237 if you look in a really strong light a things they are going to white and -
238 wash out. -
239 -
240 \section1 The CMYK Color Model -
241 -
242 While the RGB and HSV color models are used for display on -
243 computer monitors, the CMYK model is used in the four-color -
244 printing process of printing presses and some hard-copy -
245 devices. -
246 -
247 CMYK has four components, all in the range 0-255: cyan (C), -
248 magenta (M), yellow (Y) and black (K). Cyan, magenta and yellow -
249 are called subtractive colors; the CMYK color model creates color -
250 by starting with a white surface and then subtracting color by -
251 applying the appropriate components. While combining cyan, magenta -
252 and yellow gives the color black, subtracting one or more will -
253 yield any other color. When combined in various percentages, these -
254 three colors can create the entire spectrum of colors. -
255 -
256 Mixing 100 percent of cyan, magenta and yellow \e does produce -
257 black, but the result is unsatisfactory since it wastes ink, -
258 increases drying time, and gives a muddy colour when printing. For -
259 that reason, black is added in professional printing to provide a -
260 solid black tone; hence the term 'four color process'. -
261 -
262 In addition to the standard CMYK model, Qt provides an -
263 alpha-channel to feature \l {QColor#Alpha-Blended -
264 Drawing}{alpha-blended drawing}. -
265 -
266 \sa QPalette, QBrush, QApplication::setColorSpec() -
267*/ -
268 -
269#define QCOLOR_INT_RANGE_CHECK(fn, var) \ -
270 do { \ -
271 if (var < 0 || var > 255) { \ -
272 qWarning(#fn": invalid value %d", var); \ -
273 var = qMax(0, qMin(var, 255)); \ -
274 } \ -
275 } while (0) -
276 -
277#define QCOLOR_REAL_RANGE_CHECK(fn, var) \ -
278 do { \ -
279 if (var < qreal(0.0) || var > qreal(1.0)) { \ -
280 qWarning(#fn": invalid value %g", var); \ -
281 var = qMax(qreal(0.0), qMin(var, qreal(1.0))); \ -
282 } \ -
283 } while (0) -
284 -
285/***************************************************************************** -
286 QColor member functions -
287 *****************************************************************************/ -
288 -
289/*! -
290 \enum QColor::Spec -
291 -
292 The type of color specified, either RGB, HSV, CMYK or HSL. -
293 -
294 \value Rgb -
295 \value Hsv -
296 \value Cmyk -
297 \value Hsl -
298 \value Invalid -
299 -
300 \sa spec(), convertTo() -
301*/ -
302 -
303/*! -
304 \fn Spec QColor::spec() const -
305 -
306 Returns how the color was specified. -
307 -
308 \sa Spec, convertTo() -
309*/ -
310 -
311 -
312/*! -
313 \fn QColor::QColor() -
314 -
315 Constructs an invalid color with the RGB value (0, 0, 0). An -
316 invalid color is a color that is not properly set up for the -
317 underlying window system. -
318 -
319 The alpha value of an invalid color is unspecified. -
320 -
321 \sa isValid() -
322*/ -
323 -
324/*! -
325 \overload -
326 -
327 Constructs a new color with a color value of \a color. -
328 -
329 \sa isValid(), {QColor#Predefined Colors}{Predefined Colors} -
330 */ -
331QColor::QColor(Qt::GlobalColor color) -
332{ -
333#define QRGB(r, g, b) \ -
334 QRgb(((0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff))) -
335#define QRGBA(r, g, b, a) \ -
336 QRgb(((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff)) -
337 -
338 static const QRgb global_colors[] = { -
339 QRGB(255, 255, 255), // Qt::color0 -
340 QRGB( 0, 0, 0), // Qt::color1 -
341 QRGB( 0, 0, 0), // black -
342 QRGB(255, 255, 255), // white -
343 /* -
344 * From the "The Palette Manager: How and Why" by Ron Gery, -
345 * March 23, 1992, archived on MSDN: -
346 * -
347 * The Windows system palette is broken up into two -
348 * sections, one with fixed colors and one with colors -
349 * that can be changed by applications. The system palette -
350 * predefines 20 entries; these colors are known as the -
351 * static or reserved colors and consist of the 16 colors -
352 * found in the Windows version 3.0 VGA driver and 4 -
353 * additional colors chosen for their visual appeal. The -
354 * DEFAULT_PALETTE stock object is, as the name implies, -
355 * the default palette selected into a device context (DC) -
356 * and consists of these static colors. Applications can -
357 * set the remaining 236 colors using the Palette Manager. -
358 * -
359 * The 20 reserved entries have indices in [0,9] and -
360 * [246,255]. We reuse 17 of them. -
361 */ -
362 QRGB(128, 128, 128), // index 248 medium gray -
363 QRGB(160, 160, 164), // index 247 light gray -
364 QRGB(192, 192, 192), // index 7 light gray -
365 QRGB(255, 0, 0), // index 249 red -
366 QRGB( 0, 255, 0), // index 250 green -
367 QRGB( 0, 0, 255), // index 252 blue -
368 QRGB( 0, 255, 255), // index 254 cyan -
369 QRGB(255, 0, 255), // index 253 magenta -
370 QRGB(255, 255, 0), // index 251 yellow -
371 QRGB(128, 0, 0), // index 1 dark red -
372 QRGB( 0, 128, 0), // index 2 dark green -
373 QRGB( 0, 0, 128), // index 4 dark blue -
374 QRGB( 0, 128, 128), // index 6 dark cyan -
375 QRGB(128, 0, 128), // index 5 dark magenta -
376 QRGB(128, 128, 0), // index 3 dark yellow -
377 QRGBA(0, 0, 0, 0) // transparent -
378 }; -
379#undef QRGB -
380#undef QRGBA -
381 -
382 setRgb(qRed(global_colors[color]),
executed (the execution status of this line is deduced): setRgb(qRed(global_colors[color]),
-
383 qGreen(global_colors[color]),
executed (the execution status of this line is deduced): qGreen(global_colors[color]),
-
384 qBlue(global_colors[color]),
executed (the execution status of this line is deduced): qBlue(global_colors[color]),
-
385 qAlpha(global_colors[color]));
executed (the execution status of this line is deduced): qAlpha(global_colors[color]));
-
386}
executed: }
Execution Count:3790070
3790070
387 -
388/*! -
389 \fn QColor::QColor(int r, int g, int b, int a = 255) -
390 -
391 Constructs a color with the RGB value \a r, \a g, \a b, and the -
392 alpha-channel (transparency) value of \a a. -
393 -
394 The color is left invalid if any of the arguments are invalid. -
395 -
396 \sa setRgba(), isValid() -
397*/ -
398 -
399/*! -
400 Constructs a color with the value \a color. The alpha component is -
401 ignored and set to solid. -
402 -
403 \sa fromRgb(), isValid() -
404*/ -
405 -
406QColor::QColor(QRgb color) -
407{ -
408 cspec = Rgb;
executed (the execution status of this line is deduced): cspec = Rgb;
-
409 ct.argb.alpha = 0xffff;
executed (the execution status of this line is deduced): ct.argb.alpha = 0xffff;
-
410 ct.argb.red = qRed(color) * 0x101;
executed (the execution status of this line is deduced): ct.argb.red = qRed(color) * 0x101;
-
411 ct.argb.green = qGreen(color) * 0x101;
executed (the execution status of this line is deduced): ct.argb.green = qGreen(color) * 0x101;
-
412 ct.argb.blue = qBlue(color) * 0x101;
executed (the execution status of this line is deduced): ct.argb.blue = qBlue(color) * 0x101;
-
413 ct.argb.pad = 0;
executed (the execution status of this line is deduced): ct.argb.pad = 0;
-
414}
executed: }
Execution Count:826680
826680
415 -
416 -
417/*! -
418 \internal -
419 -
420 Constructs a color with the given \a spec. -
421 -
422 This function is primarly present to avoid that QColor::Invalid -
423 becomes a valid color by accident. -
424*/ -
425 -
426QColor::QColor(Spec spec) -
427{ -
428 switch (spec) { -
429 case Invalid: -
430 invalidate();
executed (the execution status of this line is deduced): invalidate();
-
431 break;
executed: break;
Execution Count:1
1
432 case Rgb: -
433 setRgb(0, 0, 0);
executed (the execution status of this line is deduced): setRgb(0, 0, 0);
-
434 break;
executed: break;
Execution Count:1
1
435 case Hsv: -
436 setHsv(0, 0, 0);
executed (the execution status of this line is deduced): setHsv(0, 0, 0);
-
437 break;
executed: break;
Execution Count:1
1
438 case Cmyk: -
439 setCmyk(0, 0, 0, 0);
executed (the execution status of this line is deduced): setCmyk(0, 0, 0, 0);
-
440 break;
executed: break;
Execution Count:1
1
441 case Hsl: -
442 setHsl(0, 0, 0, 0);
never executed (the execution status of this line is deduced): setHsl(0, 0, 0, 0);
-
443 break;
never executed: break;
0
444 } -
445}
executed: }
Execution Count:4
4
446 -
447/*! -
448 \fn QColor::QColor(const QString &name) -
449 -
450 Constructs a named color in the same way as setNamedColor() using -
451 the given \a name. -
452 -
453 The color is left invalid if the \a name cannot be parsed. -
454 -
455 \sa setNamedColor(), name(), isValid() -
456*/ -
457 -
458/*! -
459 \fn QColor::QColor(const char *name) -
460 -
461 Constructs a named color in the same way as setNamedColor() using -
462 the given \a name. -
463 -
464 The color is left invalid if the \a name cannot be parsed. -
465 -
466 \sa setNamedColor(), name(), isValid() -
467*/ -
468 -
469/*! -
470 \fn QColor::QColor(const QColor &color) -
471 -
472 Constructs a color that is a copy of \a color. -
473 -
474 \sa isValid() -
475*/ -
476 -
477/*! -
478 \fn bool QColor::isValid() const -
479 -
480 Returns true if the color is valid; otherwise returns false. -
481*/ -
482 -
483/*! -
484 Returns the name of the color in the format "#RRGGBB"; i.e. a "#" -
485 character followed by three two-digit hexadecimal numbers. -
486 -
487 \sa setNamedColor() -
488*/ -
489 -
490QString QColor::name() const -
491{ -
492 QString s;
executed (the execution status of this line is deduced): QString s;
-
493 s.sprintf("#%02x%02x%02x", red(), green(), blue());
executed (the execution status of this line is deduced): s.sprintf("#%02x%02x%02x", red(), green(), blue());
-
494 return s;
executed: return s;
Execution Count:47
47
495} -
496 -
497/*! -
498 Sets the RGB value of this QColor to \a name, which may be in one -
499 of these formats: -
500 -
501 \list -
502 \li #RGB (each of R, G, and B is a single hex digit) -
503 \li #RRGGBB -
504 \li #RRRGGGBBB -
505 \li #RRRRGGGGBBBB -
506 \li A name from the list of colors defined in the list of \l{http://www.w3.org/TR/SVG/types.html#ColorKeywords}{SVG color keyword names} -
507 provided by the World Wide Web Consortium; for example, "steelblue" or "gainsboro". -
508 These color names work on all platforms. Note that these color names are \e not the -
509 same as defined by the Qt::GlobalColor enums, e.g. "green" and Qt::green does not -
510 refer to the same color. -
511 \li \c transparent - representing the absence of a color. -
512 \endlist -
513 -
514 The color is invalid if \a name cannot be parsed. -
515 -
516 \sa QColor(), name(), isValid() -
517*/ -
518 -
519void QColor::setNamedColor(const QString &name) -
520{ -
521 setColorFromString(name);
executed (the execution status of this line is deduced): setColorFromString(name);
-
522}
executed: }
Execution Count:296
296
523 -
524/*! -
525 \since 4.7 -
526 -
527 Returns true if the \a name is a valid color name and can -
528 be used to construct a valid QColor object, otherwise returns -
529 false. -
530 -
531 It uses the same algorithm used in setNamedColor(). -
532 -
533 \sa setNamedColor() -
534*/ -
535bool QColor::isValidColor(const QString &name) -
536{ -
537 return !name.isEmpty() && QColor().setColorFromString(name);
never executed: return !name.isEmpty() && QColor().setColorFromString(name);
0
538} -
539 -
540bool QColor::setColorFromString(const QString &name) -
541{ -
542 if (name.isEmpty()) {
evaluated: name.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:295
1-295
543 invalidate();
executed (the execution status of this line is deduced): invalidate();
-
544 return true;
executed: return true;
Execution Count:1
1
545 } -
546 -
547 if (name.startsWith(QLatin1Char('#'))) {
evaluated: name.startsWith(QLatin1Char('#'))
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:249
46-249
548 QRgb rgb;
executed (the execution status of this line is deduced): QRgb rgb;
-
549 if (qt_get_hex_rgb(name.constData(), name.length(), &rgb)) {
evaluated: qt_get_hex_rgb(name.constData(), name.length(), &rgb)
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:3
3-43
550 setRgb(rgb);
executed (the execution status of this line is deduced): setRgb(rgb);
-
551 return true;
executed: return true;
Execution Count:43
43
552 } else { -
553 invalidate();
executed (the execution status of this line is deduced): invalidate();
-
554 return false;
executed: return false;
Execution Count:3
3
555 } -
556 } -
557 -
558#ifndef QT_NO_COLORNAMES -
559 QRgb rgb;
executed (the execution status of this line is deduced): QRgb rgb;
-
560 if (qt_get_named_rgb(name.constData(), name.length(), &rgb)) {
evaluated: qt_get_named_rgb(name.constData(), name.length(), &rgb)
TRUEFALSE
yes
Evaluation Count:248
yes
Evaluation Count:1
1-248
561 setRgba(rgb);
executed (the execution status of this line is deduced): setRgba(rgb);
-
562 return true;
executed: return true;
Execution Count:248
248
563 } else -
564#endif -
565 { -
566 invalidate();
executed (the execution status of this line is deduced): invalidate();
-
567 return false;
executed: return false;
Execution Count:1
1
568 } -
569} -
570 -
571/*! -
572 Returns a QStringList containing the color names Qt knows about. -
573 -
574 \sa {QColor#Predefined Colors}{Predefined Colors} -
575*/ -
576QStringList QColor::colorNames() -
577{ -
578#ifndef QT_NO_COLORNAMES -
579 return qt_get_colornames();
executed: return qt_get_colornames();
Execution Count:1
1
580#else -
581 return QStringList(); -
582#endif -
583} -
584 -
585/*! -
586 Sets the contents pointed to by \a h, \a s, \a v, and \a a, to the hue, -
587 saturation, value, and alpha-channel (transparency) components of the -
588 color's HSV value. -
589 -
590 These components can be retrieved individually using the hueF(), -
591 saturationF(), valueF() and alphaF() functions. -
592 -
593 \sa setHsv(), {QColor#The HSV Color Model}{The HSV Color Model} -
594*/ -
595void QColor::getHsvF(qreal *h, qreal *s, qreal *v, qreal *a) const -
596{ -
597 if (!h || !s || !v)
partially evaluated: !h
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: !s
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: !v
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
598 return;
never executed: return;
0
599 -
600 if (cspec != Invalid && cspec != Hsv) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:232608
no
Evaluation Count:0
partially evaluated: cspec != Hsv
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
601 toHsv().getHsvF(h, s, v, a);
never executed (the execution status of this line is deduced): toHsv().getHsvF(h, s, v, a);
-
602 return;
never executed: return;
0
603 } -
604 -
605 *h = ct.ahsv.hue == USHRT_MAX ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0);
partially evaluated: ct.ahsv.hue == (32767 * 2 + 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
606 *s = ct.ahsv.saturation / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): *s = ct.ahsv.saturation / qreal((32767 * 2 + 1));
-
607 *v = ct.ahsv.value / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): *v = ct.ahsv.value / qreal((32767 * 2 + 1));
-
608 -
609 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:232608
no
Evaluation Count:0
0-232608
610 *a = ct.ahsv.alpha / qreal(USHRT_MAX);
executed: *a = ct.ahsv.alpha / qreal((32767 * 2 + 1));
Execution Count:232608
232608
611}
executed: }
Execution Count:232608
232608
612 -
613/*! -
614 Sets the contents pointed to by \a h, \a s, \a v, and \a a, to the hue, -
615 saturation, value, and alpha-channel (transparency) components of the -
616 color's HSV value. -
617 -
618 These components can be retrieved individually using the hue(), -
619 saturation(), value() and alpha() functions. -
620 -
621 \sa setHsv(), {QColor#The HSV Color Model}{The HSV Color Model} -
622*/ -
623void QColor::getHsv(int *h, int *s, int *v, int *a) const -
624{ -
625 if (!h || !s || !v)
partially evaluated: !h
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:366268
partially evaluated: !s
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:366268
partially evaluated: !v
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:366268
0-366268
626 return;
never executed: return;
0
627 -
628 if (cspec != Invalid && cspec != Hsv) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:366268
no
Evaluation Count:0
evaluated: cspec != Hsv
TRUEFALSE
yes
Evaluation Count:66830
yes
Evaluation Count:299438
0-366268
629 toHsv().getHsv(h, s, v, a);
executed (the execution status of this line is deduced): toHsv().getHsv(h, s, v, a);
-
630 return;
executed: return;
Execution Count:66830
66830
631 } -
632 -
633 *h = ct.ahsv.hue == USHRT_MAX ? -1 : ct.ahsv.hue / 100;
evaluated: ct.ahsv.hue == (32767 * 2 + 1)
TRUEFALSE
yes
Evaluation Count:66794
yes
Evaluation Count:232644
66794-232644
634 *s = ct.ahsv.saturation >> 8;
executed (the execution status of this line is deduced): *s = ct.ahsv.saturation >> 8;
-
635 *v = ct.ahsv.value >> 8;
executed (the execution status of this line is deduced): *v = ct.ahsv.value >> 8;
-
636 -
637 if (a)
evaluated: a
TRUEFALSE
yes
Evaluation Count:298144
yes
Evaluation Count:1294
1294-298144
638 *a = ct.ahsv.alpha >> 8;
executed: *a = ct.ahsv.alpha >> 8;
Execution Count:298144
298144
639}
executed: }
Execution Count:299438
299438
640 -
641/*! -
642 Sets a HSV color value; \a h is the hue, \a s is the saturation, \a v is -
643 the value and \a a is the alpha component of the HSV color. -
644 -
645 All the values must be in the range 0.0-1.0. -
646 -
647 \sa getHsvF(), setHsv(), {QColor#The HSV Color Model}{The HSV Color Model} -
648*/ -
649void QColor::setHsvF(qreal h, qreal s, qreal v, qreal a) -
650{ -
651 if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))
partially evaluated: h < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: h > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
never evaluated: h != qreal(-1.0)
0-232608
652 || (s < qreal(0.0) || s > qreal(1.0))
partially evaluated: s < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: s > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
653 || (v < qreal(0.0) || v > qreal(1.0))
partially evaluated: v < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: v > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
654 || (a < qreal(0.0) || a > qreal(1.0))) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
655 qWarning("QColor::setHsvF: HSV parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 655, __PRETTY_FUNCTION__).warning("QColor::setHsvF: HSV parameters out of range");
-
656 return;
never executed: return;
0
657 } -
658 -
659 cspec = Hsv;
executed (the execution status of this line is deduced): cspec = Hsv;
-
660 ct.ahsv.alpha = qRound(a * USHRT_MAX);
executed (the execution status of this line is deduced): ct.ahsv.alpha = qRound(a * (32767 * 2 + 1));
-
661 ct.ahsv.hue = h == qreal(-1.0) ? USHRT_MAX : qRound(h * 36000);
partially evaluated: h == qreal(-1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
662 ct.ahsv.saturation = qRound(s * USHRT_MAX);
executed (the execution status of this line is deduced): ct.ahsv.saturation = qRound(s * (32767 * 2 + 1));
-
663 ct.ahsv.value = qRound(v * USHRT_MAX);
executed (the execution status of this line is deduced): ct.ahsv.value = qRound(v * (32767 * 2 + 1));
-
664 ct.ahsv.pad = 0;
executed (the execution status of this line is deduced): ct.ahsv.pad = 0;
-
665}
executed: }
Execution Count:232608
232608
666 -
667/*! -
668 Sets a HSV color value; \a h is the hue, \a s is the saturation, \a v is -
669 the value and \a a is the alpha component of the HSV color. -
670 -
671 The saturation, value and alpha-channel values must be in the range 0-255, -
672 and the hue value must be greater than -1. -
673 -
674 \sa getHsv(), setHsvF(), {QColor#The HSV Color Model}{The HSV Color Model} -
675*/ -
676void QColor::setHsv(int h, int s, int v, int a) -
677{ -
678 if (h < -1 || (uint)s > 255 || (uint)v > 255 || (uint)a > 255) {
partially evaluated: h < -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:326675
partially evaluated: (uint)s > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:326675
partially evaluated: (uint)v > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:326675
partially evaluated: (uint)a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:326675
0-326675
679 qWarning("QColor::setHsv: HSV parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 679, __PRETTY_FUNCTION__).warning("QColor::setHsv: HSV parameters out of range");
-
680 invalidate();
never executed (the execution status of this line is deduced): invalidate();
-
681 return;
never executed: return;
0
682 } -
683 -
684 cspec = Hsv;
executed (the execution status of this line is deduced): cspec = Hsv;
-
685 ct.ahsv.alpha = a * 0x101;
executed (the execution status of this line is deduced): ct.ahsv.alpha = a * 0x101;
-
686 ct.ahsv.hue = h == -1 ? USHRT_MAX : (h % 360) * 100;
evaluated: h == -1
TRUEFALSE
yes
Evaluation Count:5200
yes
Evaluation Count:321475
5200-321475
687 ct.ahsv.saturation = s * 0x101;
executed (the execution status of this line is deduced): ct.ahsv.saturation = s * 0x101;
-
688 ct.ahsv.value = v * 0x101;
executed (the execution status of this line is deduced): ct.ahsv.value = v * 0x101;
-
689 ct.ahsv.pad = 0;
executed (the execution status of this line is deduced): ct.ahsv.pad = 0;
-
690}
executed: }
Execution Count:326675
326675
691 -
692/*! -
693 \since 4.6 -
694 -
695 Sets the contents pointed to by \a h, \a s, \a l, and \a a, to the hue, -
696 saturation, lightness, and alpha-channel (transparency) components of the -
697 color's HSL value. -
698 -
699 These components can be retrieved individually using the hueHslF(), -
700 saturationHslF(), lightnessF() and alphaF() functions. -
701 -
702 \sa setHsl() -
703*/ -
704void QColor::getHslF(qreal *h, qreal *s, qreal *l, qreal *a) const -
705{ -
706 if (!h || !s || !l)
partially evaluated: !h
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: !s
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: !l
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
707 return;
never executed: return;
0
708 -
709 if (cspec != Invalid && cspec != Hsl) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:232608
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
710 toHsl().getHslF(h, s, l, a);
never executed (the execution status of this line is deduced): toHsl().getHslF(h, s, l, a);
-
711 return;
never executed: return;
0
712 } -
713 -
714 *h = ct.ahsl.hue == USHRT_MAX ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0);
partially evaluated: ct.ahsl.hue == (32767 * 2 + 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
715 *s = ct.ahsl.saturation / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): *s = ct.ahsl.saturation / qreal((32767 * 2 + 1));
-
716 *l = ct.ahsl.lightness / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): *l = ct.ahsl.lightness / qreal((32767 * 2 + 1));
-
717 -
718 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:232608
no
Evaluation Count:0
0-232608
719 *a = ct.ahsl.alpha / qreal(USHRT_MAX);
executed: *a = ct.ahsl.alpha / qreal((32767 * 2 + 1));
Execution Count:232608
232608
720}
executed: }
Execution Count:232608
232608
721 -
722/*! -
723 \since 4.6 -
724 -
725 Sets the contents pointed to by \a h, \a s, \a l, and \a a, to the hue, -
726 saturation, lightness, and alpha-channel (transparency) components of the -
727 color's HSL value. -
728 -
729 These components can be retrieved individually using the hueHsl(), -
730 saturationHsl(), lightness() and alpha() functions. -
731 -
732 \sa setHsl() -
733*/ -
734void QColor::getHsl(int *h, int *s, int *l, int *a) const -
735{ -
736 if (!h || !s || !l)
partially evaluated: !h
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:167072
partially evaluated: !s
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:167072
partially evaluated: !l
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:167072
0-167072
737 return;
never executed: return;
0
738 -
739 if (cspec != Invalid && cspec != Hsl) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:167072
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:167072
0-167072
740 toHsl().getHsl(h, s, l, a);
never executed (the execution status of this line is deduced): toHsl().getHsl(h, s, l, a);
-
741 return;
never executed: return;
0
742 } -
743 -
744 *h = ct.ahsl.hue == USHRT_MAX ? -1 : ct.ahsl.hue / 100;
partially evaluated: ct.ahsl.hue == (32767 * 2 + 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:167072
0-167072
745 *s = ct.ahsl.saturation >> 8;
executed (the execution status of this line is deduced): *s = ct.ahsl.saturation >> 8;
-
746 *l = ct.ahsl.lightness >> 8;
executed (the execution status of this line is deduced): *l = ct.ahsl.lightness >> 8;
-
747 -
748 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:167072
no
Evaluation Count:0
0-167072
749 *a = ct.ahsl.alpha >> 8;
executed: *a = ct.ahsl.alpha >> 8;
Execution Count:167072
167072
750}
executed: }
Execution Count:167072
167072
751 -
752/*! -
753 \since 4.6 -
754 -
755 Sets a HSL color lightness; \a h is the hue, \a s is the saturation, \a l is -
756 the lightness and \a a is the alpha component of the HSL color. -
757 -
758 All the values must be in the range 0.0-1.0. -
759 -
760 \sa getHslF(), setHsl() -
761*/ -
762void QColor::setHslF(qreal h, qreal s, qreal l, qreal a) -
763{ -
764 if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))
partially evaluated: h < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: h > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
never evaluated: h != qreal(-1.0)
0-232608
765 || (s < qreal(0.0) || s > qreal(1.0))
partially evaluated: s < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: s > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
766 || (l < qreal(0.0) || l > qreal(1.0))
partially evaluated: l < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: l > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
767 || (a < qreal(0.0) || a > qreal(1.0))) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
768 qWarning("QColor::setHsvF: HSV parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 768, __PRETTY_FUNCTION__).warning("QColor::setHsvF: HSV parameters out of range");
-
769 return;
never executed: return;
0
770 } -
771 -
772 cspec = Hsl;
executed (the execution status of this line is deduced): cspec = Hsl;
-
773 ct.ahsl.alpha = qRound(a * USHRT_MAX);
executed (the execution status of this line is deduced): ct.ahsl.alpha = qRound(a * (32767 * 2 + 1));
-
774 ct.ahsl.hue = h == qreal(-1.0) ? USHRT_MAX : qRound(h * 36000);
partially evaluated: h == qreal(-1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
775 ct.ahsl.saturation = qRound(s * USHRT_MAX);
executed (the execution status of this line is deduced): ct.ahsl.saturation = qRound(s * (32767 * 2 + 1));
-
776 ct.ahsl.lightness = qRound(l * USHRT_MAX);
executed (the execution status of this line is deduced): ct.ahsl.lightness = qRound(l * (32767 * 2 + 1));
-
777 ct.ahsl.pad = 0;
executed (the execution status of this line is deduced): ct.ahsl.pad = 0;
-
778}
executed: }
Execution Count:232608
232608
779 -
780/*! -
781 \since 4.6 -
782 -
783 Sets a HSL color value; \a h is the hue, \a s is the saturation, \a l is -
784 the lightness and \a a is the alpha component of the HSL color. -
785 -
786 The saturation, value and alpha-channel values must be in the range 0-255, -
787 and the hue value must be greater than -1. -
788 -
789 \sa getHsl(), setHslF() -
790*/ -
791void QColor::setHsl(int h, int s, int l, int a) -
792{ -
793 if (h < -1 || (uint)s > 255 || (uint)l > 255 || (uint)a > 255) {
partially evaluated: h < -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: (uint)s > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: (uint)l > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: (uint)a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
794 qWarning("QColor::setHsv: HSV parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 794, __PRETTY_FUNCTION__).warning("QColor::setHsv: HSV parameters out of range");
-
795 invalidate();
never executed (the execution status of this line is deduced): invalidate();
-
796 return;
never executed: return;
0
797 } -
798 -
799 cspec = Hsl;
executed (the execution status of this line is deduced): cspec = Hsl;
-
800 ct.ahsl.alpha = a * 0x101;
executed (the execution status of this line is deduced): ct.ahsl.alpha = a * 0x101;
-
801 ct.ahsl.hue = h == -1 ? USHRT_MAX : (h % 360) * 100;
partially evaluated: h == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
802 ct.ahsl.saturation = s * 0x101;
executed (the execution status of this line is deduced): ct.ahsl.saturation = s * 0x101;
-
803 ct.ahsl.lightness = l * 0x101;
executed (the execution status of this line is deduced): ct.ahsl.lightness = l * 0x101;
-
804 ct.ahsl.pad = 0;
executed (the execution status of this line is deduced): ct.ahsl.pad = 0;
-
805}
executed: }
Execution Count:232608
232608
806 -
807/*! -
808 Sets the contents pointed to by \a r, \a g, \a b, and \a a, to the red, -
809 green, blue, and alpha-channel (transparency) components of the color's -
810 RGB value. -
811 -
812 These components can be retrieved individually using the redF(), greenF(), -
813 blueF() and alphaF() functions. -
814 -
815 \sa rgb(), setRgb() -
816*/ -
817void QColor::getRgbF(qreal *r, qreal *g, qreal *b, qreal *a) const -
818{ -
819 if (!r || !g || !b)
partially evaluated: !r
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
partially evaluated: !g
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
partially evaluated: !b
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
0-262144
820 return;
never executed: return;
0
821 -
822 if (cspec != Invalid && cspec != Rgb) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:262144
no
Evaluation Count:0
partially evaluated: cspec != Rgb
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
0-262144
823 toRgb().getRgbF(r, g, b, a);
never executed (the execution status of this line is deduced): toRgb().getRgbF(r, g, b, a);
-
824 return;
never executed: return;
0
825 } -
826 -
827 *r = ct.argb.red / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): *r = ct.argb.red / qreal((32767 * 2 + 1));
-
828 *g = ct.argb.green / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): *g = ct.argb.green / qreal((32767 * 2 + 1));
-
829 *b = ct.argb.blue / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): *b = ct.argb.blue / qreal((32767 * 2 + 1));
-
830 -
831 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:262144
no
Evaluation Count:0
0-262144
832 *a = ct.argb.alpha / qreal(USHRT_MAX);
executed: *a = ct.argb.alpha / qreal((32767 * 2 + 1));
Execution Count:262144
262144
833 -
834}
executed: }
Execution Count:262144
262144
835 -
836/*! -
837 Sets the contents pointed to by \a r, \a g, \a b, and \a a, to the red, -
838 green, blue, and alpha-channel (transparency) components of the color's -
839 RGB value. -
840 -
841 These components can be retrieved individually using the red(), green(), -
842 blue() and alpha() functions. -
843 -
844 \sa rgb(), setRgb() -
845*/ -
846void QColor::getRgb(int *r, int *g, int *b, int *a) const -
847{ -
848 if (!r || !g || !b)
partially evaluated: !r
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
partially evaluated: !g
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
partially evaluated: !b
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
0-262144
849 return;
never executed: return;
0
850 -
851 if (cspec != Invalid && cspec != Rgb) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:262144
no
Evaluation Count:0
partially evaluated: cspec != Rgb
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
0-262144
852 toRgb().getRgb(r, g, b, a);
never executed (the execution status of this line is deduced): toRgb().getRgb(r, g, b, a);
-
853 return;
never executed: return;
0
854 } -
855 -
856 *r = ct.argb.red >> 8;
executed (the execution status of this line is deduced): *r = ct.argb.red >> 8;
-
857 *g = ct.argb.green >> 8;
executed (the execution status of this line is deduced): *g = ct.argb.green >> 8;
-
858 *b = ct.argb.blue >> 8;
executed (the execution status of this line is deduced): *b = ct.argb.blue >> 8;
-
859 -
860 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:262144
no
Evaluation Count:0
0-262144
861 *a = ct.argb.alpha >> 8;
executed: *a = ct.argb.alpha >> 8;
Execution Count:262144
262144
862}
executed: }
Execution Count:262144
262144
863 -
864/*! -
865 \fn void QColor::setRgbF(qreal r, qreal g, qreal b, qreal a) -
866 -
867 Sets the color channels of this color to \a r (red), \a g (green), -
868 \a b (blue) and \a a (alpha, transparency). -
869 -
870 All values must be in the range 0.0-1.0. -
871 -
872 \sa rgb(), getRgbF(), setRgb() -
873*/ -
874void QColor::setRgbF(qreal r, qreal g, qreal b, qreal a) -
875{ -
876 if (r < qreal(0.0) || r > qreal(1.0)
partially evaluated: r < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
partially evaluated: r > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
0-262147
877 || g < qreal(0.0) || g > qreal(1.0)
partially evaluated: g < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
partially evaluated: g > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
0-262147
878 || b < qreal(0.0) || b > qreal(1.0)
partially evaluated: b < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
partially evaluated: b > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
0-262147
879 || a < qreal(0.0) || a > qreal(1.0)) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
0-262147
880 qWarning("QColor::setRgbF: RGB parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 880, __PRETTY_FUNCTION__).warning("QColor::setRgbF: RGB parameters out of range");
-
881 invalidate();
never executed (the execution status of this line is deduced): invalidate();
-
882 return;
never executed: return;
0
883 } -
884 -
885 cspec = Rgb;
executed (the execution status of this line is deduced): cspec = Rgb;
-
886 ct.argb.alpha = qRound(a * USHRT_MAX);
executed (the execution status of this line is deduced): ct.argb.alpha = qRound(a * (32767 * 2 + 1));
-
887 ct.argb.red = qRound(r * USHRT_MAX);
executed (the execution status of this line is deduced): ct.argb.red = qRound(r * (32767 * 2 + 1));
-
888 ct.argb.green = qRound(g * USHRT_MAX);
executed (the execution status of this line is deduced): ct.argb.green = qRound(g * (32767 * 2 + 1));
-
889 ct.argb.blue = qRound(b * USHRT_MAX);
executed (the execution status of this line is deduced): ct.argb.blue = qRound(b * (32767 * 2 + 1));
-
890 ct.argb.pad = 0;
executed (the execution status of this line is deduced): ct.argb.pad = 0;
-
891}
executed: }
Execution Count:262147
262147
892 -
893/*! -
894 Sets the RGB value to \a r, \a g, \a b and the alpha value to \a a. -
895 -
896 All the values must be in the range 0-255. -
897 -
898 \sa rgb(), getRgb(), setRgbF() -
899*/ -
900void QColor::setRgb(int r, int g, int b, int a) -
901{ -
902 if ((uint)r > 255 || (uint)g > 255 || (uint)b > 255 || (uint)a > 255) {
partially evaluated: (uint)r > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4286925
partially evaluated: (uint)g > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4286926
evaluated: (uint)b > 255
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4286925
partially evaluated: (uint)a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4286925
0-4286926
903 qWarning("QColor::setRgb: RGB parameters out of range");
executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 903, __PRETTY_FUNCTION__).warning("QColor::setRgb: RGB parameters out of range");
-
904 invalidate();
executed (the execution status of this line is deduced): invalidate();
-
905 return;
executed: return;
Execution Count:1
1
906 } -
907 -
908 cspec = Rgb;
executed (the execution status of this line is deduced): cspec = Rgb;
-
909 ct.argb.alpha = a * 0x101;
executed (the execution status of this line is deduced): ct.argb.alpha = a * 0x101;
-
910 ct.argb.red = r * 0x101;
executed (the execution status of this line is deduced): ct.argb.red = r * 0x101;
-
911 ct.argb.green = g * 0x101;
executed (the execution status of this line is deduced): ct.argb.green = g * 0x101;
-
912 ct.argb.blue = b * 0x101;
executed (the execution status of this line is deduced): ct.argb.blue = b * 0x101;
-
913 ct.argb.pad = 0;
executed (the execution status of this line is deduced): ct.argb.pad = 0;
-
914}
executed: }
Execution Count:4286921
4286921
915 -
916/*! -
917 \fn QRgb QColor::rgba() const -
918 -
919 Returns the RGB value of the color, including its alpha. -
920 -
921 For an invalid color, the alpha value of the returned color is unspecified. -
922 -
923 \sa setRgba(), rgb() -
924*/ -
925 -
926QRgb QColor::rgba() const -
927{ -
928 if (cspec != Invalid && cspec != Rgb)
evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:497468
yes
Evaluation Count:9
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:1464
yes
Evaluation Count:496026
9-497468
929 return toRgb().rgba();
executed: return toRgb().rgba();
Execution Count:1464
1464
930 return qRgba(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8, ct.argb.alpha >> 8);
executed: return qRgba(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8, ct.argb.alpha >> 8);
Execution Count:496039
496039
931} -
932 -
933/*! -
934 Sets the RGB value to \a rgba, including its alpha. -
935 -
936 \sa rgba(), rgb() -
937*/ -
938void QColor::setRgba(QRgb rgba) -
939{ -
940 cspec = Rgb;
executed (the execution status of this line is deduced): cspec = Rgb;
-
941 ct.argb.alpha = qAlpha(rgba) * 0x101;
executed (the execution status of this line is deduced): ct.argb.alpha = qAlpha(rgba) * 0x101;
-
942 ct.argb.red = qRed(rgba) * 0x101;
executed (the execution status of this line is deduced): ct.argb.red = qRed(rgba) * 0x101;
-
943 ct.argb.green = qGreen(rgba) * 0x101;
executed (the execution status of this line is deduced): ct.argb.green = qGreen(rgba) * 0x101;
-
944 ct.argb.blue = qBlue(rgba) * 0x101;
executed (the execution status of this line is deduced): ct.argb.blue = qBlue(rgba) * 0x101;
-
945 ct.argb.pad = 0;
executed (the execution status of this line is deduced): ct.argb.pad = 0;
-
946}
executed: }
Execution Count:671
671
947 -
948/*! -
949 \fn QRgb QColor::rgb() const -
950 -
951 Returns the RGB value of the color. The alpha value is opaque. -
952 -
953 \sa getRgb(), rgba() -
954*/ -
955QRgb QColor::rgb() const -
956{ -
957 if (cspec != Invalid && cspec != Rgb)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:816716
no
Evaluation Count:0
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:93200
yes
Evaluation Count:723516
0-816716
958 return toRgb().rgb();
executed: return toRgb().rgb();
Execution Count:93200
93200
959 return qRgb(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8);
executed: return qRgb(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8);
Execution Count:723516
723516
960} -
961 -
962/*! -
963 \overload -
964 -
965 Sets the RGB value to \a rgb. The alpha value is set to opaque. -
966*/ -
967void QColor::setRgb(QRgb rgb) -
968{ -
969 cspec = Rgb;
executed (the execution status of this line is deduced): cspec = Rgb;
-
970 ct.argb.alpha = 0xffff;
executed (the execution status of this line is deduced): ct.argb.alpha = 0xffff;
-
971 ct.argb.red = qRed(rgb) * 0x101;
executed (the execution status of this line is deduced): ct.argb.red = qRed(rgb) * 0x101;
-
972 ct.argb.green = qGreen(rgb) * 0x101;
executed (the execution status of this line is deduced): ct.argb.green = qGreen(rgb) * 0x101;
-
973 ct.argb.blue = qBlue(rgb) * 0x101;
executed (the execution status of this line is deduced): ct.argb.blue = qBlue(rgb) * 0x101;
-
974 ct.argb.pad = 0;
executed (the execution status of this line is deduced): ct.argb.pad = 0;
-
975}
executed: }
Execution Count:262829
262829
976 -
977/*! -
978 Returns the alpha color component of this color. -
979 -
980 \sa setAlpha(), alphaF(), {QColor#Alpha-Blended Drawing}{Alpha-Blended Drawing} -
981*/ -
982int QColor::alpha() const -
983{ return ct.argb.alpha >> 8; }
executed: return ct.argb.alpha >> 8;
Execution Count:498467
498467
984 -
985 -
986/*! -
987 Sets the alpha of this color to \a alpha. Integer alpha is specified in the -
988 range 0-255. -
989 -
990 \sa alpha(), alphaF(), {QColor#Alpha-Blended Drawing}{Alpha-Blended Drawing} -
991*/ -
992 -
993void QColor::setAlpha(int alpha) -
994{ -
995 QCOLOR_INT_RANGE_CHECK("QColor::setAlpha", alpha);
executed: }
Execution Count:3
executed: }
Execution Count:66139
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:66139
evaluated: alpha < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:66137
evaluated: alpha > 255
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:66136
0-66139
996 ct.argb.alpha = alpha * 0x101;
executed (the execution status of this line is deduced): ct.argb.alpha = alpha * 0x101;
-
997}
executed: }
Execution Count:66139
66139
998 -
999/*! -
1000 Returns the alpha color component of this color. -
1001 -
1002 \sa setAlphaF(), alpha(), {QColor#Alpha-Blended Drawing}{Alpha-Blended Drawing} -
1003*/ -
1004qreal QColor::alphaF() const -
1005{ return ct.argb.alpha / qreal(USHRT_MAX); }
executed: return ct.argb.alpha / qreal((32767 * 2 + 1));
Execution Count:327694
327694
1006 -
1007/*! -
1008 Sets the alpha of this color to \a alpha. qreal alpha is specified in the -
1009 range 0.0-1.0. -
1010 -
1011 \sa alphaF(), alpha(), {QColor#Alpha-Blended Drawing}{Alpha-Blended Drawing} -
1012 -
1013*/ -
1014void QColor::setAlphaF(qreal alpha) -
1015{ -
1016 QCOLOR_REAL_RANGE_CHECK("QColor::setAlphaF", alpha);
executed: }
Execution Count:2
executed: }
Execution Count:65559
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65559
evaluated: alpha < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:65558
evaluated: alpha > qreal(1.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:65557
0-65559
1017 qreal tmp = alpha * USHRT_MAX;
executed (the execution status of this line is deduced): qreal tmp = alpha * (32767 * 2 + 1);
-
1018 ct.argb.alpha = qRound(tmp);
executed (the execution status of this line is deduced): ct.argb.alpha = qRound(tmp);
-
1019}
executed: }
Execution Count:65559
65559
1020 -
1021 -
1022/*! -
1023 Returns the red color component of this color. -
1024 -
1025 \sa setRed(), redF(), getRgb() -
1026*/ -
1027int QColor::red() const -
1028{ -
1029 if (cspec != Invalid && cspec != Rgb)
evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:972972
yes
Evaluation Count:5
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:297
yes
Evaluation Count:972675
5-972972
1030 return toRgb().red();
executed: return toRgb().red();
Execution Count:297
297
1031 return ct.argb.red >> 8;
executed: return ct.argb.red >> 8;
Execution Count:972680
972680
1032} -
1033 -
1034/*! -
1035 Sets the red color component of this color to \a red. Integer components -
1036 are specified in the range 0-255. -
1037 -
1038 \sa red(), redF(), setRgb() -
1039*/ -
1040void QColor::setRed(int red) -
1041{ -
1042 QCOLOR_INT_RANGE_CHECK("QColor::setRed", red);
executed: }
Execution Count:3
executed: }
Execution Count:315
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:315
evaluated: red < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:313
evaluated: red > 255
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:312
0-315
1043 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:152
yes
Evaluation Count:163
152-163
1044 setRgb(red, green(), blue(), alpha());
executed: setRgb(red, green(), blue(), alpha());
Execution Count:152
152
1045 else -
1046 ct.argb.red = red * 0x101;
executed: ct.argb.red = red * 0x101;
Execution Count:163
163
1047} -
1048 -
1049/*! -
1050 Returns the green color component of this color. -
1051 -
1052 \sa setGreen(), greenF(), getRgb() -
1053*/ -
1054int QColor::green() const -
1055{ -
1056 if (cspec != Invalid && cspec != Rgb)
evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:973122
yes
Evaluation Count:6
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:297
yes
Evaluation Count:972825
6-973122
1057 return toRgb().green();
executed: return toRgb().green();
Execution Count:297
297
1058 return ct.argb.green >> 8;
executed: return ct.argb.green >> 8;
Execution Count:972831
972831
1059} -
1060 -
1061/*! -
1062 Sets the green color component of this color to \a green. Integer -
1063 components are specified in the range 0-255. -
1064 -
1065 \sa green(), greenF(), setRgb() -
1066*/ -
1067void QColor::setGreen(int green) -
1068{ -
1069 QCOLOR_INT_RANGE_CHECK("QColor::setGreen", green);
executed: }
Execution Count:3
executed: }
Execution Count:315
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:315
evaluated: green < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:313
evaluated: green > 255
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:312
0-315
1070 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:314
1-314
1071 setRgb(red(), green, blue(), alpha());
executed: setRgb(red(), green, blue(), alpha());
Execution Count:1
1
1072 else -
1073 ct.argb.green = green * 0x101;
executed: ct.argb.green = green * 0x101;
Execution Count:314
314
1074} -
1075 -
1076 -
1077/*! -
1078 Returns the blue color component of this color. -
1079 -
1080 \sa setBlue(), blueF(), getRgb() -
1081*/ -
1082int QColor::blue() const -
1083{ -
1084 if (cspec != Invalid && cspec != Rgb)
evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:973122
yes
Evaluation Count:6
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:297
yes
Evaluation Count:972825
6-973122
1085 return toRgb().blue();
executed: return toRgb().blue();
Execution Count:297
297
1086 return ct.argb.blue >> 8;
executed: return ct.argb.blue >> 8;
Execution Count:972831
972831
1087} -
1088 -
1089 -
1090/*! -
1091 Sets the blue color component of this color to \a blue. Integer components -
1092 are specified in the range 0-255. -
1093 -
1094 \sa blue(), blueF(), setRgb() -
1095*/ -
1096void QColor::setBlue(int blue) -
1097{ -
1098 QCOLOR_INT_RANGE_CHECK("QColor::setBlue", blue);
executed: }
Execution Count:3
executed: }
Execution Count:315
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:315
evaluated: blue < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:313
evaluated: blue > 255
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:312
0-315
1099 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:314
1-314
1100 setRgb(red(), green(), blue, alpha());
executed: setRgb(red(), green(), blue, alpha());
Execution Count:1
1
1101 else -
1102 ct.argb.blue = blue * 0x101;
executed: ct.argb.blue = blue * 0x101;
Execution Count:314
314
1103} -
1104 -
1105/*! -
1106 Returns the red color component of this color. -
1107 -
1108 \sa setRedF(), red(), getRgbF() -
1109*/ -
1110qreal QColor::redF() const -
1111{ -
1112 if (cspec != Invalid && cspec != Rgb)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65551
no
Evaluation Count:0
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:65549
0-65551
1113 return toRgb().redF();
executed: return toRgb().redF();
Execution Count:2
2
1114 return ct.argb.red / qreal(USHRT_MAX);
executed: return ct.argb.red / qreal((32767 * 2 + 1));
Execution Count:65549
65549
1115} -
1116 -
1117 -
1118/*! -
1119 Sets the red color component of this color to \a red. Float components -
1120 are specified in the range 0.0-1.0. -
1121 -
1122 \sa redF(), red(), setRgbF() -
1123*/ -
1124void QColor::setRedF(qreal red) -
1125{ -
1126 QCOLOR_REAL_RANGE_CHECK("QColor::setRedF", red);
executed: }
Execution Count:2
executed: }
Execution Count:4
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
evaluated: red < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
evaluated: red > qreal(1.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
0-4
1127 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
1128 setRgbF(red, greenF(), blueF(), alphaF());
executed: setRgbF(red, greenF(), blueF(), alphaF());
Execution Count:1
1
1129 else -
1130 ct.argb.red = qRound(red * USHRT_MAX);
executed: ct.argb.red = qRound(red * (32767 * 2 + 1));
Execution Count:3
3
1131} -
1132 -
1133/*! -
1134 Returns the green color component of this color. -
1135 -
1136 \sa setGreenF(), green(), getRgbF() -
1137*/ -
1138qreal QColor::greenF() const -
1139{ -
1140 if (cspec != Invalid && cspec != Rgb)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65551
no
Evaluation Count:0
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:65549
0-65551
1141 return toRgb().greenF();
executed: return toRgb().greenF();
Execution Count:2
2
1142 return ct.argb.green / qreal(USHRT_MAX);
executed: return ct.argb.green / qreal((32767 * 2 + 1));
Execution Count:65549
65549
1143} -
1144 -
1145 -
1146/*! -
1147 Sets the green color component of this color to \a green. Float components -
1148 are specified in the range 0.0-1.0. -
1149 -
1150 \sa greenF(), green(), setRgbF() -
1151*/ -
1152void QColor::setGreenF(qreal green) -
1153{ -
1154 QCOLOR_REAL_RANGE_CHECK("QColor::setGreenF", green);
executed: }
Execution Count:2
executed: }
Execution Count:4
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
evaluated: green < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
evaluated: green > qreal(1.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
0-4
1155 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
1156 setRgbF(redF(), green, blueF(), alphaF());
executed: setRgbF(redF(), green, blueF(), alphaF());
Execution Count:1
1
1157 else -
1158 ct.argb.green = qRound(green * USHRT_MAX);
executed: ct.argb.green = qRound(green * (32767 * 2 + 1));
Execution Count:3
3
1159} -
1160 -
1161/*! -
1162 Returns the blue color component of this color. -
1163 -
1164 \sa setBlueF(), blue(), getRgbF() -
1165*/ -
1166qreal QColor::blueF() const -
1167{ -
1168 if (cspec != Invalid && cspec != Rgb)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65551
no
Evaluation Count:0
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:65549
0-65551
1169 return toRgb().blueF();
executed: return toRgb().blueF();
Execution Count:2
2
1170 return ct.argb.blue / qreal(USHRT_MAX);
executed: return ct.argb.blue / qreal((32767 * 2 + 1));
Execution Count:65549
65549
1171} -
1172 -
1173/*! -
1174 Sets the blue color component of this color to \a blue. Float components -
1175 are specified in the range 0.0-1.0. -
1176 -
1177 \sa blueF(), blue(), setRgbF() -
1178*/ -
1179void QColor::setBlueF(qreal blue) -
1180{ -
1181 QCOLOR_REAL_RANGE_CHECK("QColor::setBlueF", blue);
executed: }
Execution Count:2
executed: }
Execution Count:4
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
evaluated: blue < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
evaluated: blue > qreal(1.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
0-4
1182 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
1183 setRgbF(redF(), greenF(), blue, alphaF());
executed: setRgbF(redF(), greenF(), blue, alphaF());
Execution Count:1
1
1184 else -
1185 ct.argb.blue = qRound(blue * USHRT_MAX);
executed: ct.argb.blue = qRound(blue * (32767 * 2 + 1));
Execution Count:3
3
1186} -
1187 -
1188/*! -
1189 Returns the hue color component of this color. -
1190 -
1191 The color is implicitly converted to HSV. -
1192 -
1193 \sa hsvHue(), hueF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model} -
1194*/ -
1195 -
1196int QColor::hue() const -
1197{ -
1198 return hsvHue();
executed: return hsvHue();
Execution Count:37731
37731
1199} -
1200 -
1201/*! -
1202 Returns the hue color component of this color. -
1203 -
1204 \sa hueF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model} -
1205*/ -
1206int QColor::hsvHue() const -
1207{ -
1208 if (cspec != Invalid && cspec != Hsv)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:37731
no
Evaluation Count:0
evaluated: cspec != Hsv
TRUEFALSE
yes
Evaluation Count:865
yes
Evaluation Count:36866
0-37731
1209 return toHsv().hue();
executed: return toHsv().hue();
Execution Count:865
865
1210 return ct.ahsv.hue == USHRT_MAX ? -1 : ct.ahsv.hue / 100;
executed: return ct.ahsv.hue == (32767 * 2 + 1) ? -1 : ct.ahsv.hue / 100;
Execution Count:36866
36866
1211} -
1212 -
1213/*! -
1214 Returns the saturation color component of this color. -
1215 -
1216 The color is implicitly converted to HSV. -
1217 -
1218 \sa hsvSaturation(), saturationF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color -
1219 Model} -
1220*/ -
1221 -
1222int QColor::saturation() const -
1223{ -
1224 return hsvSaturation();
executed: return hsvSaturation();
Execution Count:67267
67267
1225} -
1226 -
1227/*! -
1228 Returns the saturation color component of this color. -
1229 -
1230 \sa saturationF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model} -
1231*/ -
1232int QColor::hsvSaturation() const -
1233{ -
1234 if (cspec != Invalid && cspec != Hsv)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:67267
no
Evaluation Count:0
evaluated: cspec != Hsv
TRUEFALSE
yes
Evaluation Count:865
yes
Evaluation Count:66402
0-67267
1235 return toHsv().saturation();
executed: return toHsv().saturation();
Execution Count:865
865
1236 return ct.ahsv.saturation >> 8;
executed: return ct.ahsv.saturation >> 8;
Execution Count:66402
66402
1237} -
1238 -
1239/*! -
1240 Returns the value color component of this color. -
1241 -
1242 \sa valueF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model} -
1243*/ -
1244int QColor::value() const -
1245{ -
1246 if (cspec != Invalid && cspec != Hsv)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:68859
no
Evaluation Count:0
evaluated: cspec != Hsv
TRUEFALSE
yes
Evaluation Count:1661
yes
Evaluation Count:67198
0-68859
1247 return toHsv().value();
executed: return toHsv().value();
Execution Count:1661
1661
1248 return ct.ahsv.value >> 8;
executed: return ct.ahsv.value >> 8;
Execution Count:67198
67198
1249} -
1250 -
1251/*! -
1252 Returns the hue color component of this color. -
1253 -
1254 The color is implicitly converted to HSV. -
1255 -
1256 \sa hsvHueF(), hue(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model} -
1257*/ -
1258qreal QColor::hueF() const -
1259{ -
1260 return hsvHueF();
executed: return hsvHueF();
Execution Count:36000
36000
1261} -
1262 -
1263/*! -
1264 Returns the hue color component of this color. -
1265 -
1266 \sa hue(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color -
1267 Model} -
1268*/ -
1269qreal QColor::hsvHueF() const -
1270{ -
1271 if (cspec != Invalid && cspec != Hsv)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:36000
no
Evaluation Count:0
partially evaluated: cspec != Hsv
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36000
0-36000
1272 return toHsv().hueF();
never executed: return toHsv().hueF();
0
1273 return ct.ahsv.hue == USHRT_MAX ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0);
executed: return ct.ahsv.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0);
Execution Count:36000
36000
1274} -
1275 -
1276/*! -
1277 Returns the saturation color component of this color. -
1278 -
1279 The color is implicitly converted to HSV. -
1280 -
1281 \sa hsvSaturationF(), saturation(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color -
1282 Model} -
1283*/ -
1284qreal QColor::saturationF() const -
1285{ -
1286 return hsvSaturationF();
executed: return hsvSaturationF();
Execution Count:65536
65536
1287} -
1288 -
1289/*! -
1290 Returns the saturation color component of this color. -
1291 -
1292 \sa saturation(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model} -
1293*/ -
1294qreal QColor::hsvSaturationF() const -
1295{ -
1296 if (cspec != Invalid && cspec != Hsv)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Hsv
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1297 return toHsv().saturationF();
never executed: return toHsv().saturationF();
0
1298 return ct.ahsv.saturation / qreal(USHRT_MAX);
executed: return ct.ahsv.saturation / qreal((32767 * 2 + 1));
Execution Count:65536
65536
1299} -
1300 -
1301/*! -
1302 Returns the value color component of this color. -
1303 -
1304 \sa value(), getHsvF(), {QColor#The HSV Color Model}{The HSV Color Model} -
1305*/ -
1306qreal QColor::valueF() const -
1307{ -
1308 if (cspec != Invalid && cspec != Hsv)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Hsv
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1309 return toHsv().valueF();
never executed: return toHsv().valueF();
0
1310 return ct.ahsv.value / qreal(USHRT_MAX);
executed: return ct.ahsv.value / qreal((32767 * 2 + 1));
Execution Count:65536
65536
1311} -
1312 -
1313/*! -
1314 \since 4.6 -
1315 -
1316 Returns the hue color component of this color. -
1317 -
1318 \sa getHslF(), getHsl() -
1319*/ -
1320int QColor::hslHue() const -
1321{ -
1322 if (cspec != Invalid && cspec != Hsl)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:36001
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36001
0-36001
1323 return toHsl().hslHue();
never executed: return toHsl().hslHue();
0
1324 return ct.ahsl.hue == USHRT_MAX ? -1 : ct.ahsl.hue / 100;
executed: return ct.ahsl.hue == (32767 * 2 + 1) ? -1 : ct.ahsl.hue / 100;
Execution Count:36001
36001
1325} -
1326 -
1327/*! -
1328 \since 4.6 -
1329 -
1330 Returns the saturation color component of this color. -
1331 -
1332 \sa saturationF(), getHsv(), {QColor#The HSV Color Model}{The HSV Color Model} -
1333*/ -
1334int QColor::hslSaturation() const -
1335{ -
1336 if (cspec != Invalid && cspec != Hsl)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1337 return toHsl().hslSaturation();
never executed: return toHsl().hslSaturation();
0
1338 return ct.ahsl.saturation >> 8;
executed: return ct.ahsl.saturation >> 8;
Execution Count:65536
65536
1339} -
1340 -
1341/*! -
1342 \since 4.6 -
1343 -
1344 Returns the lightness color component of this color. -
1345 -
1346 \sa lightnessF(), getHsl() -
1347*/ -
1348int QColor::lightness() const -
1349{ -
1350 if (cspec != Invalid && cspec != Hsl)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1351 return toHsl().lightness();
never executed: return toHsl().lightness();
0
1352 return ct.ahsl.lightness >> 8;
executed: return ct.ahsl.lightness >> 8;
Execution Count:65536
65536
1353} -
1354 -
1355/*! -
1356 \since 4.6 -
1357 -
1358 Returns the hue color component of this color. -
1359 -
1360 \sa hue(), getHslF() -
1361*/ -
1362qreal QColor::hslHueF() const -
1363{ -
1364 if (cspec != Invalid && cspec != Hsl)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:36000
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36000
0-36000
1365 return toHsl().hslHueF();
never executed: return toHsl().hslHueF();
0
1366 return ct.ahsl.hue == USHRT_MAX ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0);
executed: return ct.ahsl.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0);
Execution Count:36000
36000
1367} -
1368 -
1369/*! -
1370 \since 4.6 -
1371 -
1372 Returns the saturation color component of this color. -
1373 -
1374 \sa saturationF(), getHslF() -
1375*/ -
1376qreal QColor::hslSaturationF() const -
1377{ -
1378 if (cspec != Invalid && cspec != Hsl)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1379 return toHsl().hslSaturationF();
never executed: return toHsl().hslSaturationF();
0
1380 return ct.ahsl.saturation / qreal(USHRT_MAX);
executed: return ct.ahsl.saturation / qreal((32767 * 2 + 1));
Execution Count:65536
65536
1381} -
1382 -
1383/*! -
1384 \since 4.6 -
1385 -
1386 Returns the lightness color component of this color. -
1387 -
1388 \sa value(), getHslF() -
1389*/ -
1390qreal QColor::lightnessF() const -
1391{ -
1392 if (cspec != Invalid && cspec != Hsl)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1393 return toHsl().lightnessF();
never executed: return toHsl().lightnessF();
0
1394 return ct.ahsl.lightness / qreal(USHRT_MAX);
executed: return ct.ahsl.lightness / qreal((32767 * 2 + 1));
Execution Count:65536
65536
1395} -
1396 -
1397/*! -
1398 Returns the cyan color component of this color. -
1399 -
1400 \sa cyanF(), getCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
1401*/ -
1402int QColor::cyan() const -
1403{ -
1404 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1405 return toCmyk().cyan();
never executed: return toCmyk().cyan();
0
1406 return ct.acmyk.cyan >> 8;
executed: return ct.acmyk.cyan >> 8;
Execution Count:65536
65536
1407} -
1408 -
1409/*! -
1410 Returns the magenta color component of this color. -
1411 -
1412 \sa magentaF(), getCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
1413*/ -
1414int QColor::magenta() const -
1415{ -
1416 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1417 return toCmyk().magenta();
never executed: return toCmyk().magenta();
0
1418 return ct.acmyk.magenta >> 8;
executed: return ct.acmyk.magenta >> 8;
Execution Count:65536
65536
1419} -
1420 -
1421/*! -
1422 Returns the yellow color component of this color. -
1423 -
1424 \sa yellowF(), getCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
1425*/ -
1426int QColor::yellow() const -
1427{ -
1428 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1429 return toCmyk().yellow();
never executed: return toCmyk().yellow();
0
1430 return ct.acmyk.yellow >> 8;
executed: return ct.acmyk.yellow >> 8;
Execution Count:65536
65536
1431} -
1432 -
1433/*! -
1434 Returns the black color component of this color. -
1435 -
1436 \sa blackF(), getCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
1437 -
1438*/ -
1439int QColor::black() const -
1440{ -
1441 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1442 return toCmyk().black();
never executed: return toCmyk().black();
0
1443 return ct.acmyk.black >> 8;
executed: return ct.acmyk.black >> 8;
Execution Count:65536
65536
1444} -
1445 -
1446/*! -
1447 Returns the cyan color component of this color. -
1448 -
1449 \sa cyan(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
1450*/ -
1451qreal QColor::cyanF() const -
1452{ -
1453 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1454 return toCmyk().cyanF();
never executed: return toCmyk().cyanF();
0
1455 return ct.acmyk.cyan / qreal(USHRT_MAX);
executed: return ct.acmyk.cyan / qreal((32767 * 2 + 1));
Execution Count:65536
65536
1456} -
1457 -
1458/*! -
1459 Returns the magenta color component of this color. -
1460 -
1461 \sa magenta(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
1462*/ -
1463qreal QColor::magentaF() const -
1464{ -
1465 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1466 return toCmyk().magentaF();
never executed: return toCmyk().magentaF();
0
1467 return ct.acmyk.magenta / qreal(USHRT_MAX);
executed: return ct.acmyk.magenta / qreal((32767 * 2 + 1));
Execution Count:65536
65536
1468} -
1469 -
1470/*! -
1471 Returns the yellow color component of this color. -
1472 -
1473 \sa yellow(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
1474*/ -
1475qreal QColor::yellowF() const -
1476{ -
1477 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1478 return toCmyk().yellowF();
never executed: return toCmyk().yellowF();
0
1479 return ct.acmyk.yellow / qreal(USHRT_MAX);
executed: return ct.acmyk.yellow / qreal((32767 * 2 + 1));
Execution Count:65536
65536
1480} -
1481 -
1482/*! -
1483 Returns the black color component of this color. -
1484 -
1485 \sa black(), getCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
1486*/ -
1487qreal QColor::blackF() const -
1488{ -
1489 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
1490 return toCmyk().blackF();
never executed: return toCmyk().blackF();
0
1491 return ct.acmyk.black / qreal(USHRT_MAX);
executed: return ct.acmyk.black / qreal((32767 * 2 + 1));
Execution Count:65536
65536
1492} -
1493 -
1494/*! -
1495 Create and returns an RGB QColor based on this color. -
1496 -
1497 \sa fromRgb(), convertTo(), isValid() -
1498*/ -
1499QColor QColor::toRgb() const -
1500{ -
1501 if (!isValid() || cspec == Rgb)
evaluated: !isValid()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:168344
evaluated: cspec == Rgb
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:168343
1-168344
1502 return *this;
executed: return *this;
Execution Count:10
10
1503 -
1504 QColor color;
executed (the execution status of this line is deduced): QColor color;
-
1505 color.cspec = Rgb;
executed (the execution status of this line is deduced): color.cspec = Rgb;
-
1506 color.ct.argb.alpha = ct.argb.alpha;
executed (the execution status of this line is deduced): color.ct.argb.alpha = ct.argb.alpha;
-
1507 color.ct.argb.pad = 0;
executed (the execution status of this line is deduced): color.ct.argb.pad = 0;
-
1508 -
1509 switch (cspec) { -
1510 case Hsv: -
1511 { -
1512 if (ct.ahsv.saturation == 0 || ct.ahsv.hue == USHRT_MAX) {
evaluated: ct.ahsv.saturation == 0
TRUEFALSE
yes
Evaluation Count:9673
yes
Evaluation Count:93109
partially evaluated: ct.ahsv.hue == (32767 * 2 + 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:93109
0-93109
1513 // achromatic case -
1514 color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsv.value;
executed (the execution status of this line is deduced): color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsv.value;
-
1515 break;
executed: break;
Execution Count:9673
9673
1516 } -
1517 -
1518 // chromatic case -
1519 const qreal h = ct.ahsv.hue == 36000 ? 0 : ct.ahsv.hue / 6000.;
evaluated: ct.ahsv.hue == 36000
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:93108
1-93108
1520 const qreal s = ct.ahsv.saturation / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal s = ct.ahsv.saturation / qreal((32767 * 2 + 1));
-
1521 const qreal v = ct.ahsv.value / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal v = ct.ahsv.value / qreal((32767 * 2 + 1));
-
1522 const int i = int(h);
executed (the execution status of this line is deduced): const int i = int(h);
-
1523 const qreal f = h - i;
executed (the execution status of this line is deduced): const qreal f = h - i;
-
1524 const qreal p = v * (qreal(1.0) - s);
executed (the execution status of this line is deduced): const qreal p = v * (qreal(1.0) - s);
-
1525 -
1526 if (i & 1) {
evaluated: i & 1
TRUEFALSE
yes
Evaluation Count:44194
yes
Evaluation Count:48915
44194-48915
1527 const qreal q = v * (qreal(1.0) - (s * f));
executed (the execution status of this line is deduced): const qreal q = v * (qreal(1.0) - (s * f));
-
1528 -
1529 switch (i) { -
1530 case 1: -
1531 color.ct.argb.red = qRound(q * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.red = qRound(q * (32767 * 2 + 1));
-
1532 color.ct.argb.green = qRound(v * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.green = qRound(v * (32767 * 2 + 1));
-
1533 color.ct.argb.blue = qRound(p * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.blue = qRound(p * (32767 * 2 + 1));
-
1534 break;
executed: break;
Execution Count:14737
14737
1535 case 3: -
1536 color.ct.argb.red = qRound(p * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.red = qRound(p * (32767 * 2 + 1));
-
1537 color.ct.argb.green = qRound(q * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.green = qRound(q * (32767 * 2 + 1));
-
1538 color.ct.argb.blue = qRound(v * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.blue = qRound(v * (32767 * 2 + 1));
-
1539 break;
executed: break;
Execution Count:14729
14729
1540 case 5: -
1541 color.ct.argb.red = qRound(v * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.red = qRound(v * (32767 * 2 + 1));
-
1542 color.ct.argb.green = qRound(p * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.green = qRound(p * (32767 * 2 + 1));
-
1543 color.ct.argb.blue = qRound(q * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.blue = qRound(q * (32767 * 2 + 1));
-
1544 break;
executed: break;
Execution Count:14728
14728
1545 } -
1546 } else {
executed: }
Execution Count:44194
44194
1547 const qreal t = v * (qreal(1.0) - (s * (qreal(1.0) - f)));
executed (the execution status of this line is deduced): const qreal t = v * (qreal(1.0) - (s * (qreal(1.0) - f)));
-
1548 -
1549 switch (i) { -
1550 case 0: -
1551 color.ct.argb.red = qRound(v * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.red = qRound(v * (32767 * 2 + 1));
-
1552 color.ct.argb.green = qRound(t * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.green = qRound(t * (32767 * 2 + 1));
-
1553 color.ct.argb.blue = qRound(p * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.blue = qRound(p * (32767 * 2 + 1));
-
1554 break;
executed: break;
Execution Count:19379
19379
1555 case 2: -
1556 color.ct.argb.red = qRound(p * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.red = qRound(p * (32767 * 2 + 1));
-
1557 color.ct.argb.green = qRound(v * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.green = qRound(v * (32767 * 2 + 1));
-
1558 color.ct.argb.blue = qRound(t * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.blue = qRound(t * (32767 * 2 + 1));
-
1559 break;
executed: break;
Execution Count:14344
14344
1560 case 4: -
1561 color.ct.argb.red = qRound(t * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.red = qRound(t * (32767 * 2 + 1));
-
1562 color.ct.argb.green = qRound(p * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.green = qRound(p * (32767 * 2 + 1));
-
1563 color.ct.argb.blue = qRound(v * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.blue = qRound(v * (32767 * 2 + 1));
-
1564 break;
executed: break;
Execution Count:15192
15192
1565 } -
1566 }
executed: }
Execution Count:48915
48915
1567 break;
executed: break;
Execution Count:93109
93109
1568 } -
1569 case Hsl: -
1570 { -
1571 if (ct.ahsl.saturation == 0 || ct.ahsl.hue == USHRT_MAX) {
evaluated: ct.ahsl.saturation == 0
TRUEFALSE
yes
Evaluation Count:65540
yes
Evaluation Count:8
partially evaluated: ct.ahsl.hue == (32767 * 2 + 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-65540
1572 // achromatic case -
1573 color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsl.lightness;
executed (the execution status of this line is deduced): color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsl.lightness;
-
1574 } else if (ct.ahsl.lightness == 0) {
executed: }
Execution Count:65540
partially evaluated: ct.ahsl.lightness == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-65540
1575 // lightness 0 -
1576 color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = 0;
never executed (the execution status of this line is deduced): color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = 0;
-
1577 } else {
never executed: }
0
1578 // chromatic case -
1579 const qreal h = ct.ahsl.hue == 36000 ? 0 : ct.ahsl.hue / 36000.;
partially evaluated: ct.ahsl.hue == 36000
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1580 const qreal s = ct.ahsl.saturation / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal s = ct.ahsl.saturation / qreal((32767 * 2 + 1));
-
1581 const qreal l = ct.ahsl.lightness / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal l = ct.ahsl.lightness / qreal((32767 * 2 + 1));
-
1582 -
1583 qreal temp2;
executed (the execution status of this line is deduced): qreal temp2;
-
1584 if (l < qreal(0.5))
partially evaluated: l < qreal(0.5)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1585 temp2 = l * (qreal(1.0) + s);
never executed: temp2 = l * (qreal(1.0) + s);
0
1586 else -
1587 temp2 = l + s - (l * s);
executed: temp2 = l + s - (l * s);
Execution Count:8
8
1588 -
1589 const qreal temp1 = (qreal(2.0) * l) - temp2;
executed (the execution status of this line is deduced): const qreal temp1 = (qreal(2.0) * l) - temp2;
-
1590 qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)),
executed (the execution status of this line is deduced): qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)),
-
1591 h,
executed (the execution status of this line is deduced): h,
-
1592 h - (qreal(1.0) / qreal(3.0)) };
executed (the execution status of this line is deduced): h - (qreal(1.0) / qreal(3.0)) };
-
1593 -
1594 for (int i = 0; i != 3; ++i) {
evaluated: i != 3
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:8
8-24
1595 if (temp3[i] < qreal(0.0))
evaluated: temp3[i] < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:22
2-22
1596 temp3[i] += qreal(1.0);
executed: temp3[i] += qreal(1.0);
Execution Count:2
2
1597 else if (temp3[i] > qreal(1.0))
evaluated: temp3[i] > qreal(1.0)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:20
2-20
1598 temp3[i] -= qreal(1.0);
executed: temp3[i] -= qreal(1.0);
Execution Count:2
2
1599 -
1600 const qreal sixtemp3 = temp3[i] * qreal(6.0);
executed (the execution status of this line is deduced): const qreal sixtemp3 = temp3[i] * qreal(6.0);
-
1601 if (sixtemp3 < qreal(1.0))
evaluated: sixtemp3 < qreal(1.0)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:22
2-22
1602 color.ct.array[i+1] = qRound((temp1 + (temp2 - temp1) * sixtemp3) * USHRT_MAX);
executed: color.ct.array[i+1] = qRound((temp1 + (temp2 - temp1) * sixtemp3) * (32767 * 2 + 1));
Execution Count:2
2
1603 else if ((temp3[i] * qreal(2.0)) < qreal(1.0))
evaluated: (temp3[i] * qreal(2.0)) < qreal(1.0)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:14
8-14
1604 color.ct.array[i+1] = qRound(temp2 * USHRT_MAX);
executed: color.ct.array[i+1] = qRound(temp2 * (32767 * 2 + 1));
Execution Count:8
8
1605 else if ((temp3[i] * qreal(3.0)) < qreal(2.0))
evaluated: (temp3[i] * qreal(3.0)) < qreal(2.0)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:9
5-9
1606 color.ct.array[i+1] = qRound((temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0)) * USHRT_MAX);
executed: color.ct.array[i+1] = qRound((temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0)) * (32767 * 2 + 1));
Execution Count:5
5
1607 else -
1608 color.ct.array[i+1] = qRound(temp1 * USHRT_MAX);
executed: color.ct.array[i+1] = qRound(temp1 * (32767 * 2 + 1));
Execution Count:9
9
1609 } -
1610 color.ct.argb.red = color.ct.argb.red == 1 ? 0 : color.ct.argb.red;
evaluated: color.ct.argb.red == 1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
1611 color.ct.argb.green = color.ct.argb.green == 1 ? 0 : color.ct.argb.green;
evaluated: color.ct.argb.green == 1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
1612 color.ct.argb.blue = color.ct.argb.blue == 1 ? 0 : color.ct.argb.blue;
evaluated: color.ct.argb.blue == 1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5
3-5
1613 }
executed: }
Execution Count:8
8
1614 break;
executed: break;
Execution Count:65548
65548
1615 } -
1616 case Cmyk: -
1617 { -
1618 const qreal c = ct.acmyk.cyan / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal c = ct.acmyk.cyan / qreal((32767 * 2 + 1));
-
1619 const qreal m = ct.acmyk.magenta / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal m = ct.acmyk.magenta / qreal((32767 * 2 + 1));
-
1620 const qreal y = ct.acmyk.yellow / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal y = ct.acmyk.yellow / qreal((32767 * 2 + 1));
-
1621 const qreal k = ct.acmyk.black / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal k = ct.acmyk.black / qreal((32767 * 2 + 1));
-
1622 -
1623 color.ct.argb.red = qRound((qreal(1.0) - (c * (qreal(1.0) - k) + k)) * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.red = qRound((qreal(1.0) - (c * (qreal(1.0) - k) + k)) * (32767 * 2 + 1));
-
1624 color.ct.argb.green = qRound((qreal(1.0) - (m * (qreal(1.0) - k) + k)) * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.green = qRound((qreal(1.0) - (m * (qreal(1.0) - k) + k)) * (32767 * 2 + 1));
-
1625 color.ct.argb.blue = qRound((qreal(1.0) - (y * (qreal(1.0) - k) + k)) * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.blue = qRound((qreal(1.0) - (y * (qreal(1.0) - k) + k)) * (32767 * 2 + 1));
-
1626 break;
executed: break;
Execution Count:13
13
1627 } -
1628 default: -
1629 break;
never executed: break;
0
1630 } -
1631 -
1632 return color;
executed: return color;
Execution Count:168343
168343
1633} -
1634 -
1635 -
1636#define Q_MAX_3(a, b, c) ( ( a > b && a > c) ? a : (b > c ? b : c) ) -
1637#define Q_MIN_3(a, b, c) ( ( a < b && a < c) ? a : (b < c ? b : c) ) -
1638 -
1639 -
1640/*! -
1641 Creates and returns an HSV QColor based on this color. -
1642 -
1643 \sa fromHsv(), convertTo(), isValid(), {QColor#The HSV Color Model}{The HSV Color Model} -
1644*/ -
1645QColor QColor::toHsv() const -
1646{ -
1647 if (!isValid() || cspec == Hsv)
evaluated: !isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:144624
evaluated: cspec == Hsv
TRUEFALSE
yes
Evaluation Count:1643
yes
Evaluation Count:142981
2-144624
1648 return *this;
executed: return *this;
Execution Count:1645
1645
1649 -
1650 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:65539
yes
Evaluation Count:77442
65539-77442
1651 return toRgb().toHsv();
executed: return toRgb().toHsv();
Execution Count:65539
65539
1652 -
1653 QColor color;
executed (the execution status of this line is deduced): QColor color;
-
1654 color.cspec = Hsv;
executed (the execution status of this line is deduced): color.cspec = Hsv;
-
1655 color.ct.ahsv.alpha = ct.argb.alpha;
executed (the execution status of this line is deduced): color.ct.ahsv.alpha = ct.argb.alpha;
-
1656 color.ct.ahsv.pad = 0;
executed (the execution status of this line is deduced): color.ct.ahsv.pad = 0;
-
1657 -
1658 const qreal r = ct.argb.red / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal r = ct.argb.red / qreal((32767 * 2 + 1));
-
1659 const qreal g = ct.argb.green / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal g = ct.argb.green / qreal((32767 * 2 + 1));
-
1660 const qreal b = ct.argb.blue / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal b = ct.argb.blue / qreal((32767 * 2 + 1));
-
1661 const qreal max = Q_MAX_3(r, g, b);
evaluated: r > g
TRUEFALSE
yes
Evaluation Count:5162
yes
Evaluation Count:72280
evaluated: r > b
TRUEFALSE
yes
Evaluation Count:5143
yes
Evaluation Count:19
19-72280
1662 const qreal min = Q_MIN_3(r, g, b);
evaluated: r < g
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:77415
evaluated: r < b
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:18
9-77415
1663 const qreal delta = max - min;
executed (the execution status of this line is deduced): const qreal delta = max - min;
-
1664 color.ct.ahsv.value = qRound(max * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.ahsv.value = qRound(max * (32767 * 2 + 1));
-
1665 if (qFuzzyIsNull(delta)) {
evaluated: qFuzzyIsNull(delta)
TRUEFALSE
yes
Evaluation Count:70593
yes
Evaluation Count:6849
6849-70593
1666 // achromatic case, hue is undefined -
1667 color.ct.ahsv.hue = USHRT_MAX;
executed (the execution status of this line is deduced): color.ct.ahsv.hue = (32767 * 2 + 1);
-
1668 color.ct.ahsv.saturation = 0;
executed (the execution status of this line is deduced): color.ct.ahsv.saturation = 0;
-
1669 } else {
executed: }
Execution Count:70593
70593
1670 // chromatic case -
1671 qreal hue = 0;
executed (the execution status of this line is deduced): qreal hue = 0;
-
1672 color.ct.ahsv.saturation = qRound((delta / max) * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.ahsv.saturation = qRound((delta / max) * (32767 * 2 + 1));
-
1673 if (qFuzzyCompare(r, max)) {
evaluated: qFuzzyCompare(r, max)
TRUEFALSE
yes
Evaluation Count:5156
yes
Evaluation Count:1693
1693-5156
1674 hue = ((g - b) /delta);
executed (the execution status of this line is deduced): hue = ((g - b) /delta);
-
1675 } else if (qFuzzyCompare(g, max)) {
executed: }
Execution Count:5156
evaluated: qFuzzyCompare(g, max)
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:1670
23-5156
1676 hue = (qreal(2.0) + (b - r) / delta);
executed (the execution status of this line is deduced): hue = (qreal(2.0) + (b - r) / delta);
-
1677 } else if (qFuzzyCompare(b, max)) {
executed: }
Execution Count:23
partially evaluated: qFuzzyCompare(b, max)
TRUEFALSE
yes
Evaluation Count:1670
no
Evaluation Count:0
0-1670
1678 hue = (qreal(4.0) + (r - g) / delta);
executed (the execution status of this line is deduced): hue = (qreal(4.0) + (r - g) / delta);
-
1679 } else {
executed: }
Execution Count:1670
1670
1680 Q_ASSERT_X(false, "QColor::toHsv", "internal error");
never executed (the execution status of this line is deduced): qt_noop();
-
1681 }
never executed: }
0
1682 hue *= qreal(60.0);
executed (the execution status of this line is deduced): hue *= qreal(60.0);
-
1683 if (hue < qreal(0.0))
evaluated: hue < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:6846
3-6846
1684 hue += qreal(360.0);
executed: hue += qreal(360.0);
Execution Count:3
3
1685 color.ct.ahsv.hue = qRound(hue * 100);
executed (the execution status of this line is deduced): color.ct.ahsv.hue = qRound(hue * 100);
-
1686 }
executed: }
Execution Count:6849
6849
1687 -
1688 return color;
executed: return color;
Execution Count:77442
77442
1689} -
1690 -
1691/*! -
1692 Creates and returns an HSL QColor based on this color. -
1693 -
1694 \sa fromHsl(), convertTo(), isValid() -
1695*/ -
1696QColor QColor::toHsl() const -
1697{ -
1698 if (!isValid() || cspec == Hsl)
evaluated: !isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:14
evaluated: cspec == Hsl
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13
1-14
1699 return *this;
executed: return *this;
Execution Count:3
3
1700 -
1701 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:9
4-9
1702 return toRgb().toHsl();
executed: return toRgb().toHsl();
Execution Count:4
4
1703 -
1704 QColor color;
executed (the execution status of this line is deduced): QColor color;
-
1705 color.cspec = Hsl;
executed (the execution status of this line is deduced): color.cspec = Hsl;
-
1706 color.ct.ahsl.alpha = ct.argb.alpha;
executed (the execution status of this line is deduced): color.ct.ahsl.alpha = ct.argb.alpha;
-
1707 color.ct.ahsl.pad = 0;
executed (the execution status of this line is deduced): color.ct.ahsl.pad = 0;
-
1708 -
1709 const qreal r = ct.argb.red / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal r = ct.argb.red / qreal((32767 * 2 + 1));
-
1710 const qreal g = ct.argb.green / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal g = ct.argb.green / qreal((32767 * 2 + 1));
-
1711 const qreal b = ct.argb.blue / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal b = ct.argb.blue / qreal((32767 * 2 + 1));
-
1712 const qreal max = Q_MAX_3(r, g, b);
evaluated: r > g
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3
evaluated: r > b
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3-6
1713 const qreal min = Q_MIN_3(r, g, b);
partially evaluated: r < g
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
never evaluated: r < b
0-9
1714 const qreal delta = max - min;
executed (the execution status of this line is deduced): const qreal delta = max - min;
-
1715 const qreal delta2 = max + min;
executed (the execution status of this line is deduced): const qreal delta2 = max + min;
-
1716 const qreal lightness = qreal(0.5) * delta2;
executed (the execution status of this line is deduced): const qreal lightness = qreal(0.5) * delta2;
-
1717 color.ct.ahsl.lightness = qRound(lightness * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.ahsl.lightness = qRound(lightness * (32767 * 2 + 1));
-
1718 if (qFuzzyIsNull(delta)) {
evaluated: qFuzzyIsNull(delta)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:6
3-6
1719 // achromatic case, hue is undefined -
1720 color.ct.ahsl.hue = USHRT_MAX;
executed (the execution status of this line is deduced): color.ct.ahsl.hue = (32767 * 2 + 1);
-
1721 color.ct.ahsl.saturation = 0;
executed (the execution status of this line is deduced): color.ct.ahsl.saturation = 0;
-
1722 } else {
executed: }
Execution Count:3
3
1723 // chromatic case -
1724 qreal hue = 0;
executed (the execution status of this line is deduced): qreal hue = 0;
-
1725 if (lightness < qreal(0.5))
partially evaluated: lightness < qreal(0.5)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1726 color.ct.ahsl.saturation = qRound((delta / delta2) * USHRT_MAX);
never executed: color.ct.ahsl.saturation = qRound((delta / delta2) * (32767 * 2 + 1));
0
1727 else -
1728 color.ct.ahsl.saturation = qRound((delta / (qreal(2.0) - delta2)) * USHRT_MAX);
executed: color.ct.ahsl.saturation = qRound((delta / (qreal(2.0) - delta2)) * (32767 * 2 + 1));
Execution Count:6
6
1729 if (qFuzzyCompare(r, max)) {
partially evaluated: qFuzzyCompare(r, max)
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
1730 hue = ((g - b) /delta);
executed (the execution status of this line is deduced): hue = ((g - b) /delta);
-
1731 } else if (qFuzzyCompare(g, max)) {
executed: }
Execution Count:6
never evaluated: qFuzzyCompare(g, max)
0-6
1732 hue = (qreal(2.0) + (b - r) / delta);
never executed (the execution status of this line is deduced): hue = (qreal(2.0) + (b - r) / delta);
-
1733 } else if (qFuzzyCompare(b, max)) {
never executed: }
never evaluated: qFuzzyCompare(b, max)
0
1734 hue = (qreal(4.0) + (r - g) / delta);
never executed (the execution status of this line is deduced): hue = (qreal(4.0) + (r - g) / delta);
-
1735 } else {
never executed: }
0
1736 Q_ASSERT_X(false, "QColor::toHsv", "internal error");
never executed (the execution status of this line is deduced): qt_noop();
-
1737 }
never executed: }
0
1738 hue *= qreal(60.0);
executed (the execution status of this line is deduced): hue *= qreal(60.0);
-
1739 if (hue < qreal(0.0))
evaluated: hue < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3
1740 hue += qreal(360.0);
executed: hue += qreal(360.0);
Execution Count:3
3
1741 color.ct.ahsl.hue = qRound(hue * 100);
executed (the execution status of this line is deduced): color.ct.ahsl.hue = qRound(hue * 100);
-
1742 }
executed: }
Execution Count:6
6
1743 -
1744 return color;
executed: return color;
Execution Count:9
9
1745} -
1746 -
1747/*! -
1748 Creates and returns a CMYK QColor based on this color. -
1749 -
1750 \sa fromCmyk(), convertTo(), isValid(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
1751*/ -
1752QColor QColor::toCmyk() const -
1753{ -
1754 if (!isValid() || cspec == Cmyk)
evaluated: !isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:14
evaluated: cspec == Cmyk
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13
1-14
1755 return *this;
executed: return *this;
Execution Count:3
3
1756 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:7
6-7
1757 return toRgb().toCmyk();
executed: return toRgb().toCmyk();
Execution Count:6
6
1758 -
1759 QColor color;
executed (the execution status of this line is deduced): QColor color;
-
1760 color.cspec = Cmyk;
executed (the execution status of this line is deduced): color.cspec = Cmyk;
-
1761 color.ct.acmyk.alpha = ct.argb.alpha;
executed (the execution status of this line is deduced): color.ct.acmyk.alpha = ct.argb.alpha;
-
1762 -
1763 // rgb -> cmy -
1764 const qreal r = ct.argb.red / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal r = ct.argb.red / qreal((32767 * 2 + 1));
-
1765 const qreal g = ct.argb.green / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal g = ct.argb.green / qreal((32767 * 2 + 1));
-
1766 const qreal b = ct.argb.blue / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): const qreal b = ct.argb.blue / qreal((32767 * 2 + 1));
-
1767 qreal c = qreal(1.0) - r;
executed (the execution status of this line is deduced): qreal c = qreal(1.0) - r;
-
1768 qreal m = qreal(1.0) - g;
executed (the execution status of this line is deduced): qreal m = qreal(1.0) - g;
-
1769 qreal y = qreal(1.0) - b;
executed (the execution status of this line is deduced): qreal y = qreal(1.0) - b;
-
1770 -
1771 // cmy -> cmyk -
1772 const qreal k = qMin(c, qMin(m, y));
executed (the execution status of this line is deduced): const qreal k = qMin(c, qMin(m, y));
-
1773 -
1774 if (!qFuzzyIsNull(k - 1)) {
evaluated: !qFuzzyIsNull(k - 1)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
3-4
1775 c = (c - k) / (qreal(1.0) - k);
executed (the execution status of this line is deduced): c = (c - k) / (qreal(1.0) - k);
-
1776 m = (m - k) / (qreal(1.0) - k);
executed (the execution status of this line is deduced): m = (m - k) / (qreal(1.0) - k);
-
1777 y = (y - k) / (qreal(1.0) - k);
executed (the execution status of this line is deduced): y = (y - k) / (qreal(1.0) - k);
-
1778 }
executed: }
Execution Count:3
3
1779 -
1780 color.ct.acmyk.cyan = qRound(c * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.acmyk.cyan = qRound(c * (32767 * 2 + 1));
-
1781 color.ct.acmyk.magenta = qRound(m * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.acmyk.magenta = qRound(m * (32767 * 2 + 1));
-
1782 color.ct.acmyk.yellow = qRound(y * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.acmyk.yellow = qRound(y * (32767 * 2 + 1));
-
1783 color.ct.acmyk.black = qRound(k * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.acmyk.black = qRound(k * (32767 * 2 + 1));
-
1784 -
1785 return color;
executed: return color;
Execution Count:7
7
1786} -
1787 -
1788QColor QColor::convertTo(QColor::Spec colorSpec) const -
1789{ -
1790 if (colorSpec == cspec)
evaluated: colorSpec == cspec
TRUEFALSE
yes
Evaluation Count:1642
yes
Evaluation Count:7210
1642-7210
1791 return *this;
executed: return *this;
Execution Count:1642
1642
1792 switch (colorSpec) { -
1793 case Rgb: -
1794 return toRgb();
executed: return toRgb();
Execution Count:7206
7206
1795 case Hsv: -
1796 return toHsv();
executed: return toHsv();
Execution Count:1
1
1797 case Cmyk: -
1798 return toCmyk();
executed: return toCmyk();
Execution Count:1
1
1799 case Hsl: -
1800 return toHsl();
executed: return toHsl();
Execution Count:1
1
1801 case Invalid: -
1802 break;
executed: break;
Execution Count:1
1
1803 } -
1804 return QColor(); // must be invalid
executed: return QColor();
Execution Count:1
1
1805} -
1806 -
1807 -
1808/*! -
1809 Static convenience function that returns a QColor constructed from the -
1810 given QRgb value \a rgb. -
1811 -
1812 The alpha component of \a rgb is ignored (i.e. it is automatically set to -
1813 255), use the fromRgba() function to include the alpha-channel specified by -
1814 the given QRgb value. -
1815 -
1816 \sa fromRgba(), fromRgbF(), toRgb(), isValid() -
1817*/ -
1818 -
1819QColor QColor::fromRgb(QRgb rgb) -
1820{ -
1821 return fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb));
never executed: return fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb));
0
1822} -
1823 -
1824 -
1825/*! -
1826 Static convenience function that returns a QColor constructed from the -
1827 given QRgb value \a rgba. -
1828 -
1829 Unlike the fromRgb() function, the alpha-channel specified by the given -
1830 QRgb value is included. -
1831 -
1832 \sa fromRgb(), isValid() -
1833*/ -
1834 -
1835QColor QColor::fromRgba(QRgb rgba) -
1836{ -
1837 return fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba));
never executed: return fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba));
0
1838} -
1839 -
1840/*! -
1841 Static convenience function that returns a QColor constructed from the RGB -
1842 color values, \a r (red), \a g (green), \a b (blue), and \a a -
1843 (alpha-channel, i.e. transparency). -
1844 -
1845 All the values must be in the range 0-255. -
1846 -
1847 \sa toRgb(), fromRgbF(), isValid() -
1848*/ -
1849QColor QColor::fromRgb(int r, int g, int b, int a) -
1850{ -
1851 if (r < 0 || r > 255
partially evaluated: r < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: r > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1852 || g < 0 || g > 255
partially evaluated: g < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: g > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1853 || b < 0 || b > 255
partially evaluated: b < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: b > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1854 || a < 0 || a > 255) {
partially evaluated: a < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1855 qWarning("QColor::fromRgb: RGB parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 1855, __PRETTY_FUNCTION__).warning("QColor::fromRgb: RGB parameters out of range");
-
1856 return QColor();
never executed: return QColor();
0
1857 } -
1858 -
1859 QColor color;
executed (the execution status of this line is deduced): QColor color;
-
1860 color.cspec = Rgb;
executed (the execution status of this line is deduced): color.cspec = Rgb;
-
1861 color.ct.argb.alpha = a * 0x101;
executed (the execution status of this line is deduced): color.ct.argb.alpha = a * 0x101;
-
1862 color.ct.argb.red = r * 0x101;
executed (the execution status of this line is deduced): color.ct.argb.red = r * 0x101;
-
1863 color.ct.argb.green = g * 0x101;
executed (the execution status of this line is deduced): color.ct.argb.green = g * 0x101;
-
1864 color.ct.argb.blue = b * 0x101;
executed (the execution status of this line is deduced): color.ct.argb.blue = b * 0x101;
-
1865 color.ct.argb.pad = 0;
executed (the execution status of this line is deduced): color.ct.argb.pad = 0;
-
1866 return color;
executed: return color;
Execution Count:5
5
1867} -
1868 -
1869/*! -
1870 Static convenience function that returns a QColor constructed from the RGB -
1871 color values, \a r (red), \a g (green), \a b (blue), and \a a -
1872 (alpha-channel, i.e. transparency). -
1873 -
1874 All the values must be in the range 0.0-1.0. -
1875 -
1876 \sa fromRgb(), toRgb(), isValid() -
1877*/ -
1878QColor QColor::fromRgbF(qreal r, qreal g, qreal b, qreal a) -
1879{ -
1880 if (r < qreal(0.0) || r > qreal(1.0)
partially evaluated: r < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
partially evaluated: r > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
1881 || g < qreal(0.0) || g > qreal(1.0)
partially evaluated: g < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
partially evaluated: g > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
1882 || b < qreal(0.0) || b > qreal(1.0)
partially evaluated: b < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
partially evaluated: b > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
1883 || a < qreal(0.0) || a > qreal(1.0)) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
1884 qWarning("QColor::fromRgbF: RGB parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 1884, __PRETTY_FUNCTION__).warning("QColor::fromRgbF: RGB parameters out of range");
-
1885 return QColor();
never executed: return QColor();
0
1886 } -
1887 -
1888 QColor color;
executed (the execution status of this line is deduced): QColor color;
-
1889 color.cspec = Rgb;
executed (the execution status of this line is deduced): color.cspec = Rgb;
-
1890 color.ct.argb.alpha = qRound(a * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.alpha = qRound(a * (32767 * 2 + 1));
-
1891 color.ct.argb.red = qRound(r * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.red = qRound(r * (32767 * 2 + 1));
-
1892 color.ct.argb.green = qRound(g * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.green = qRound(g * (32767 * 2 + 1));
-
1893 color.ct.argb.blue = qRound(b * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.argb.blue = qRound(b * (32767 * 2 + 1));
-
1894 color.ct.argb.pad = 0;
executed (the execution status of this line is deduced): color.ct.argb.pad = 0;
-
1895 return color;
executed: return color;
Execution Count:26
26
1896} -
1897 -
1898/*! -
1899 Static convenience function that returns a QColor constructed from the HSV -
1900 color values, \a h (hue), \a s (saturation), \a v (value), and \a a -
1901 (alpha-channel, i.e. transparency). -
1902 -
1903 The value of \a s, \a v, and \a a must all be in the range 0-255; the value -
1904 of \a h must be in the range 0-359. -
1905 -
1906 \sa toHsv(), fromHsvF(), isValid(), {QColor#The HSV Color Model}{The HSV Color Model} -
1907*/ -
1908QColor QColor::fromHsv(int h, int s, int v, int a) -
1909{ -
1910 if (((h < 0 || h >= 360) && h != -1)
partially evaluated: h < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: h >= 360
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
never evaluated: h != -1
0-4
1911 || s < 0 || s > 255
partially evaluated: s < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: s > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1912 || v < 0 || v > 255
partially evaluated: v < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: v > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1913 || a < 0 || a > 255) {
partially evaluated: a < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1914 qWarning("QColor::fromHsv: HSV parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 1914, __PRETTY_FUNCTION__).warning("QColor::fromHsv: HSV parameters out of range");
-
1915 return QColor();
never executed: return QColor();
0
1916 } -
1917 -
1918 QColor color;
executed (the execution status of this line is deduced): QColor color;
-
1919 color.cspec = Hsv;
executed (the execution status of this line is deduced): color.cspec = Hsv;
-
1920 color.ct.ahsv.alpha = a * 0x101;
executed (the execution status of this line is deduced): color.ct.ahsv.alpha = a * 0x101;
-
1921 color.ct.ahsv.hue = h == -1 ? USHRT_MAX : (h % 360) * 100;
partially evaluated: h == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1922 color.ct.ahsv.saturation = s * 0x101;
executed (the execution status of this line is deduced): color.ct.ahsv.saturation = s * 0x101;
-
1923 color.ct.ahsv.value = v * 0x101;
executed (the execution status of this line is deduced): color.ct.ahsv.value = v * 0x101;
-
1924 color.ct.ahsv.pad = 0;
executed (the execution status of this line is deduced): color.ct.ahsv.pad = 0;
-
1925 return color;
executed: return color;
Execution Count:4
4
1926} -
1927 -
1928/*! -
1929 \overload -
1930 -
1931 Static convenience function that returns a QColor constructed from the HSV -
1932 color values, \a h (hue), \a s (saturation), \a v (value), and \a a -
1933 (alpha-channel, i.e. transparency). -
1934 -
1935 All the values must be in the range 0.0-1.0. -
1936 -
1937 \sa toHsv(), fromHsv(), isValid(), {QColor#The HSV Color Model}{The HSV Color Model} -
1938*/ -
1939QColor QColor::fromHsvF(qreal h, qreal s, qreal v, qreal a) -
1940{ -
1941 if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))
evaluated: h < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:10
partially evaluated: h > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
partially evaluated: h != qreal(-1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-10
1942 || (s < qreal(0.0) || s > qreal(1.0))
partially evaluated: s < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: s > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1943 || (v < qreal(0.0) || v > qreal(1.0))
partially evaluated: v < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: v > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1944 || (a < qreal(0.0) || a > qreal(1.0))) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1945 qWarning("QColor::fromHsvF: HSV parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 1945, __PRETTY_FUNCTION__).warning("QColor::fromHsvF: HSV parameters out of range");
-
1946 return QColor();
never executed: return QColor();
0
1947 } -
1948 -
1949 QColor color;
executed (the execution status of this line is deduced): QColor color;
-
1950 color.cspec = Hsv;
executed (the execution status of this line is deduced): color.cspec = Hsv;
-
1951 color.ct.ahsv.alpha = qRound(a * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.ahsv.alpha = qRound(a * (32767 * 2 + 1));
-
1952 color.ct.ahsv.hue = h == qreal(-1.0) ? USHRT_MAX : qRound(h * 36000);
evaluated: h == qreal(-1.0)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:10
3-10
1953 color.ct.ahsv.saturation = qRound(s * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.ahsv.saturation = qRound(s * (32767 * 2 + 1));
-
1954 color.ct.ahsv.value = qRound(v * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.ahsv.value = qRound(v * (32767 * 2 + 1));
-
1955 color.ct.ahsv.pad = 0;
executed (the execution status of this line is deduced): color.ct.ahsv.pad = 0;
-
1956 return color;
executed: return color;
Execution Count:13
13
1957} -
1958 -
1959/*! -
1960 \since 4.6 -
1961 -
1962 Static convenience function that returns a QColor constructed from the HSV -
1963 color values, \a h (hue), \a s (saturation), \a l (lightness), and \a a -
1964 (alpha-channel, i.e. transparency). -
1965 -
1966 The value of \a s, \a l, and \a a must all be in the range 0-255; the value -
1967 of \a h must be in the range 0-359. -
1968 -
1969 \sa toHsl(), fromHslF(), isValid() -
1970*/ -
1971QColor QColor::fromHsl(int h, int s, int l, int a) -
1972{ -
1973 if (((h < 0 || h >= 360) && h != -1)
partially evaluated: h < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: h >= 360
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: h != -1
0-1
1974 || s < 0 || s > 255
partially evaluated: s < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: s > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1975 || l < 0 || l > 255
partially evaluated: l < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: l > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1976 || a < 0 || a > 255) {
partially evaluated: a < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1977 qWarning("QColor::fromHsv: HSV parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 1977, __PRETTY_FUNCTION__).warning("QColor::fromHsv: HSV parameters out of range");
-
1978 return QColor();
never executed: return QColor();
0
1979 } -
1980 -
1981 QColor color;
executed (the execution status of this line is deduced): QColor color;
-
1982 color.cspec = Hsl;
executed (the execution status of this line is deduced): color.cspec = Hsl;
-
1983 color.ct.ahsl.alpha = a * 0x101;
executed (the execution status of this line is deduced): color.ct.ahsl.alpha = a * 0x101;
-
1984 color.ct.ahsl.hue = h == -1 ? USHRT_MAX : (h % 360) * 100;
partially evaluated: h == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1985 color.ct.ahsl.saturation = s * 0x101;
executed (the execution status of this line is deduced): color.ct.ahsl.saturation = s * 0x101;
-
1986 color.ct.ahsl.lightness = l * 0x101;
executed (the execution status of this line is deduced): color.ct.ahsl.lightness = l * 0x101;
-
1987 color.ct.ahsl.pad = 0;
executed (the execution status of this line is deduced): color.ct.ahsl.pad = 0;
-
1988 return color;
executed: return color;
Execution Count:1
1
1989} -
1990 -
1991/*! -
1992 \overload -
1993 \since 4.6 -
1994 -
1995 Static convenience function that returns a QColor constructed from the HSV -
1996 color values, \a h (hue), \a s (saturation), \a l (lightness), and \a a -
1997 (alpha-channel, i.e. transparency). -
1998 -
1999 All the values must be in the range 0.0-1.0. -
2000 -
2001 \sa toHsl(), fromHsl(), isValid() -
2002*/ -
2003QColor QColor::fromHslF(qreal h, qreal s, qreal l, qreal a) -
2004{ -
2005 if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))
evaluated: h < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:11
partially evaluated: h > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
partially evaluated: h != qreal(-1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-11
2006 || (s < qreal(0.0) || s > qreal(1.0))
partially evaluated: s < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
partially evaluated: s > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
2007 || (l < qreal(0.0) || l > qreal(1.0))
partially evaluated: l < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
partially evaluated: l > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
2008 || (a < qreal(0.0) || a > qreal(1.0))) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
2009 qWarning("QColor::fromHsvF: HSV parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 2009, __PRETTY_FUNCTION__).warning("QColor::fromHsvF: HSV parameters out of range");
-
2010 return QColor();
never executed: return QColor();
0
2011 } -
2012 -
2013 QColor color;
executed (the execution status of this line is deduced): QColor color;
-
2014 color.cspec = Hsl;
executed (the execution status of this line is deduced): color.cspec = Hsl;
-
2015 color.ct.ahsl.alpha = qRound(a * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.ahsl.alpha = qRound(a * (32767 * 2 + 1));
-
2016 color.ct.ahsl.hue = (h == qreal(-1.0)) ? USHRT_MAX : qRound(h * 36000);
evaluated: (h == qreal(-1.0))
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:11
3-11
2017 if (color.ct.ahsl.hue == 36000)
evaluated: color.ct.ahsl.hue == 36000
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13
1-13
2018 color.ct.ahsl.hue = 0;
executed: color.ct.ahsl.hue = 0;
Execution Count:1
1
2019 color.ct.ahsl.saturation = qRound(s * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.ahsl.saturation = qRound(s * (32767 * 2 + 1));
-
2020 color.ct.ahsl.lightness = qRound(l * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.ahsl.lightness = qRound(l * (32767 * 2 + 1));
-
2021 color.ct.ahsl.pad = 0;
executed (the execution status of this line is deduced): color.ct.ahsl.pad = 0;
-
2022 return color;
executed: return color;
Execution Count:14
14
2023} -
2024 -
2025 -
2026/*! -
2027 Sets the contents pointed to by \a c, \a m, \a y, \a k, and \a a, to the -
2028 cyan, magenta, yellow, black, and alpha-channel (transparency) components -
2029 of the color's CMYK value. -
2030 -
2031 These components can be retrieved individually using the cyan(), magenta(), -
2032 yellow(), black() and alpha() functions. -
2033 -
2034 \sa setCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
2035*/ -
2036void QColor::getCmyk(int *c, int *m, int *y, int *k, int *a) -
2037{ -
2038 if (!c || !m || !y || !k)
partially evaluated: !c
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: !m
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: !y
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: !k
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
2039 return;
never executed: return;
0
2040 -
2041 if (cspec != Invalid && cspec != Cmyk) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:327680
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
2042 toCmyk().getCmyk(c, m, y, k, a);
never executed (the execution status of this line is deduced): toCmyk().getCmyk(c, m, y, k, a);
-
2043 return;
never executed: return;
0
2044 } -
2045 -
2046 *c = ct.acmyk.cyan >> 8;
executed (the execution status of this line is deduced): *c = ct.acmyk.cyan >> 8;
-
2047 *m = ct.acmyk.magenta >> 8;
executed (the execution status of this line is deduced): *m = ct.acmyk.magenta >> 8;
-
2048 *y = ct.acmyk.yellow >> 8;
executed (the execution status of this line is deduced): *y = ct.acmyk.yellow >> 8;
-
2049 *k = ct.acmyk.black >> 8;
executed (the execution status of this line is deduced): *k = ct.acmyk.black >> 8;
-
2050 -
2051 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:327680
no
Evaluation Count:0
0-327680
2052 *a = ct.acmyk.alpha >> 8;
executed: *a = ct.acmyk.alpha >> 8;
Execution Count:327680
327680
2053}
executed: }
Execution Count:327680
327680
2054 -
2055/*! -
2056 Sets the contents pointed to by \a c, \a m, \a y, \a k, and \a a, to the -
2057 cyan, magenta, yellow, black, and alpha-channel (transparency) components -
2058 of the color's CMYK value. -
2059 -
2060 These components can be retrieved individually using the cyanF(), -
2061 magentaF(), yellowF(), blackF() and alphaF() functions. -
2062 -
2063 \sa setCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
2064*/ -
2065void QColor::getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a) -
2066{ -
2067 if (!c || !m || !y || !k)
partially evaluated: !c
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: !m
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: !y
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: !k
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
2068 return;
never executed: return;
0
2069 -
2070 if (cspec != Invalid && cspec != Cmyk) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:327680
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
2071 toCmyk().getCmykF(c, m, y, k, a);
never executed (the execution status of this line is deduced): toCmyk().getCmykF(c, m, y, k, a);
-
2072 return;
never executed: return;
0
2073 } -
2074 -
2075 *c = ct.acmyk.cyan / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): *c = ct.acmyk.cyan / qreal((32767 * 2 + 1));
-
2076 *m = ct.acmyk.magenta / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): *m = ct.acmyk.magenta / qreal((32767 * 2 + 1));
-
2077 *y = ct.acmyk.yellow / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): *y = ct.acmyk.yellow / qreal((32767 * 2 + 1));
-
2078 *k = ct.acmyk.black / qreal(USHRT_MAX);
executed (the execution status of this line is deduced): *k = ct.acmyk.black / qreal((32767 * 2 + 1));
-
2079 -
2080 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:327680
no
Evaluation Count:0
0-327680
2081 *a = ct.acmyk.alpha / qreal(USHRT_MAX);
executed: *a = ct.acmyk.alpha / qreal((32767 * 2 + 1));
Execution Count:327680
327680
2082}
executed: }
Execution Count:327680
327680
2083 -
2084/*! -
2085 Sets the color to CMYK values, \a c (cyan), \a m (magenta), \a y (yellow), -
2086 \a k (black), and \a a (alpha-channel, i.e. transparency). -
2087 -
2088 All the values must be in the range 0-255. -
2089 -
2090 \sa getCmyk(), setCmykF(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
2091*/ -
2092void QColor::setCmyk(int c, int m, int y, int k, int a) -
2093{ -
2094 if (c < 0 || c > 255
partially evaluated: c < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
partially evaluated: c > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
0-327681
2095 || m < 0 || m > 255
partially evaluated: m < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
partially evaluated: m > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
0-327681
2096 || y < 0 || y > 255
partially evaluated: y < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
partially evaluated: y > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
0-327681
2097 || k < 0 || k > 255
partially evaluated: k < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
partially evaluated: k > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
0-327681
2098 || a < 0 || a > 255) {
partially evaluated: a < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
partially evaluated: a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
0-327681
2099 qWarning("QColor::setCmyk: CMYK parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 2099, __PRETTY_FUNCTION__).warning("QColor::setCmyk: CMYK parameters out of range");
-
2100 return;
never executed: return;
0
2101 } -
2102 -
2103 cspec = Cmyk;
executed (the execution status of this line is deduced): cspec = Cmyk;
-
2104 ct.acmyk.alpha = a * 0x101;
executed (the execution status of this line is deduced): ct.acmyk.alpha = a * 0x101;
-
2105 ct.acmyk.cyan = c * 0x101;
executed (the execution status of this line is deduced): ct.acmyk.cyan = c * 0x101;
-
2106 ct.acmyk.magenta = m * 0x101;
executed (the execution status of this line is deduced): ct.acmyk.magenta = m * 0x101;
-
2107 ct.acmyk.yellow = y * 0x101;
executed (the execution status of this line is deduced): ct.acmyk.yellow = y * 0x101;
-
2108 ct.acmyk.black = k * 0x101;
executed (the execution status of this line is deduced): ct.acmyk.black = k * 0x101;
-
2109}
executed: }
Execution Count:327681
327681
2110 -
2111/*! -
2112 \overload -
2113 -
2114 Sets the color to CMYK values, \a c (cyan), \a m (magenta), \a y (yellow), -
2115 \a k (black), and \a a (alpha-channel, i.e. transparency). -
2116 -
2117 All the values must be in the range 0.0-1.0. -
2118 -
2119 \sa getCmykF(), setCmyk(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
2120*/ -
2121void QColor::setCmykF(qreal c, qreal m, qreal y, qreal k, qreal a) -
2122{ -
2123 if (c < qreal(0.0) || c > qreal(1.0)
partially evaluated: c < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: c > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
2124 || m < qreal(0.0) || m > qreal(1.0)
partially evaluated: m < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: m > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
2125 || y < qreal(0.0) || y > qreal(1.0)
partially evaluated: y < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: y > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
2126 || k < qreal(0.0) || k > qreal(1.0)
partially evaluated: k < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: k > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
2127 || a < qreal(0.0) || a > qreal(1.0)) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
2128 qWarning("QColor::setCmykF: CMYK parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 2128, __PRETTY_FUNCTION__).warning("QColor::setCmykF: CMYK parameters out of range");
-
2129 return;
never executed: return;
0
2130 } -
2131 -
2132 cspec = Cmyk;
executed (the execution status of this line is deduced): cspec = Cmyk;
-
2133 ct.acmyk.alpha = qRound(a * USHRT_MAX);
executed (the execution status of this line is deduced): ct.acmyk.alpha = qRound(a * (32767 * 2 + 1));
-
2134 ct.acmyk.cyan = qRound(c * USHRT_MAX);
executed (the execution status of this line is deduced): ct.acmyk.cyan = qRound(c * (32767 * 2 + 1));
-
2135 ct.acmyk.magenta = qRound(m * USHRT_MAX);
executed (the execution status of this line is deduced): ct.acmyk.magenta = qRound(m * (32767 * 2 + 1));
-
2136 ct.acmyk.yellow = qRound(y * USHRT_MAX);
executed (the execution status of this line is deduced): ct.acmyk.yellow = qRound(y * (32767 * 2 + 1));
-
2137 ct.acmyk.black = qRound(k * USHRT_MAX);
executed (the execution status of this line is deduced): ct.acmyk.black = qRound(k * (32767 * 2 + 1));
-
2138}
executed: }
Execution Count:327680
327680
2139 -
2140/*! -
2141 Static convenience function that returns a QColor constructed from the -
2142 given CMYK color values: \a c (cyan), \a m (magenta), \a y (yellow), \a k -
2143 (black), and \a a (alpha-channel, i.e. transparency). -
2144 -
2145 All the values must be in the range 0-255. -
2146 -
2147 \sa toCmyk(), fromCmykF(), isValid(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
2148*/ -
2149QColor QColor::fromCmyk(int c, int m, int y, int k, int a) -
2150{ -
2151 if (c < 0 || c > 255
partially evaluated: c < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: c > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2152 || m < 0 || m > 255
partially evaluated: m < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: m > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2153 || y < 0 || y > 255
partially evaluated: y < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: y > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2154 || k < 0 || k > 255
partially evaluated: k < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: k > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2155 || a < 0 || a > 255) {
partially evaluated: a < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2156 qWarning("QColor::fromCmyk: CMYK parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 2156, __PRETTY_FUNCTION__).warning("QColor::fromCmyk: CMYK parameters out of range");
-
2157 return QColor();
never executed: return QColor();
0
2158 } -
2159 -
2160 QColor color;
executed (the execution status of this line is deduced): QColor color;
-
2161 color.cspec = Cmyk;
executed (the execution status of this line is deduced): color.cspec = Cmyk;
-
2162 color.ct.acmyk.alpha = a * 0x101;
executed (the execution status of this line is deduced): color.ct.acmyk.alpha = a * 0x101;
-
2163 color.ct.acmyk.cyan = c * 0x101;
executed (the execution status of this line is deduced): color.ct.acmyk.cyan = c * 0x101;
-
2164 color.ct.acmyk.magenta = m * 0x101;
executed (the execution status of this line is deduced): color.ct.acmyk.magenta = m * 0x101;
-
2165 color.ct.acmyk.yellow = y * 0x101;
executed (the execution status of this line is deduced): color.ct.acmyk.yellow = y * 0x101;
-
2166 color.ct.acmyk.black = k * 0x101;
executed (the execution status of this line is deduced): color.ct.acmyk.black = k * 0x101;
-
2167 return color;
executed: return color;
Execution Count:4
4
2168} -
2169 -
2170/*! -
2171 \overload -
2172 -
2173 Static convenience function that returns a QColor constructed from the -
2174 given CMYK color values: \a c (cyan), \a m (magenta), \a y (yellow), \a k -
2175 (black), and \a a (alpha-channel, i.e. transparency). -
2176 -
2177 All the values must be in the range 0.0-1.0. -
2178 -
2179 \sa toCmyk(), fromCmyk(), isValid(), {QColor#The CMYK Color Model}{The CMYK Color Model} -
2180*/ -
2181QColor QColor::fromCmykF(qreal c, qreal m, qreal y, qreal k, qreal a) -
2182{ -
2183 if (c < qreal(0.0) || c > qreal(1.0)
partially evaluated: c < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: c > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
2184 || m < qreal(0.0) || m > qreal(1.0)
partially evaluated: m < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: m > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
2185 || y < qreal(0.0) || y > qreal(1.0)
partially evaluated: y < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: y > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
2186 || k < qreal(0.0) || k > qreal(1.0)
partially evaluated: k < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: k > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
2187 || a < qreal(0.0) || a > qreal(1.0)) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
2188 qWarning("QColor::fromCmykF: CMYK parameters out of range");
never executed (the execution status of this line is deduced): QMessageLogger("painting/qcolor.cpp", 2188, __PRETTY_FUNCTION__).warning("QColor::fromCmykF: CMYK parameters out of range");
-
2189 return QColor();
never executed: return QColor();
0
2190 } -
2191 -
2192 QColor color;
executed (the execution status of this line is deduced): QColor color;
-
2193 color.cspec = Cmyk;
executed (the execution status of this line is deduced): color.cspec = Cmyk;
-
2194 color.ct.acmyk.alpha = qRound(a * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.acmyk.alpha = qRound(a * (32767 * 2 + 1));
-
2195 color.ct.acmyk.cyan = qRound(c * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.acmyk.cyan = qRound(c * (32767 * 2 + 1));
-
2196 color.ct.acmyk.magenta = qRound(m * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.acmyk.magenta = qRound(m * (32767 * 2 + 1));
-
2197 color.ct.acmyk.yellow = qRound(y * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.acmyk.yellow = qRound(y * (32767 * 2 + 1));
-
2198 color.ct.acmyk.black = qRound(k * USHRT_MAX);
executed (the execution status of this line is deduced): color.ct.acmyk.black = qRound(k * (32767 * 2 + 1));
-
2199 return color;
executed: return color;
Execution Count:13
13
2200} -
2201 -
2202/*! -
2203 \fn QColor QColor::lighter(int factor) const -
2204 \since 4.3 -
2205 -
2206 Returns a lighter (or darker) color, but does not change this object. -
2207 -
2208 If the \a factor is greater than 100, this functions returns a lighter -
2209 color. Setting \a factor to 150 returns a color that is 50% brighter. If -
2210 the \a factor is less than 100, the return color is darker, but we -
2211 recommend using the darker() function for this purpose. If the \a factor -
2212 is 0 or negative, the return value is unspecified. -
2213 -
2214 The function converts the current RGB color to HSV, multiplies the value -
2215 (V) component by \a factor and converts the color back to RGB. -
2216 -
2217 \sa darker(), isValid() -
2218*/ -
2219 -
2220/*! -
2221 \obsolete -
2222 -
2223 Use lighter(\a factor) instead. -
2224*/ -
2225QColor QColor::light(int factor) const -
2226{ -
2227 if (factor <= 0) // invalid lightness factor
partially evaluated: factor <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3579
0-3579
2228 return *this;
never executed: return *this;
0
2229 else if (factor < 100) // makes color darker
partially evaluated: factor < 100
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3579
0-3579
2230 return darker(10000 / factor);
never executed: return darker(10000 / factor);
0
2231 -
2232 QColor hsv = toHsv();
executed (the execution status of this line is deduced): QColor hsv = toHsv();
-
2233 int s = hsv.ct.ahsv.saturation;
executed (the execution status of this line is deduced): int s = hsv.ct.ahsv.saturation;
-
2234 uint v = hsv.ct.ahsv.value;
executed (the execution status of this line is deduced): uint v = hsv.ct.ahsv.value;
-
2235 -
2236 v = (factor*v)/100;
executed (the execution status of this line is deduced): v = (factor*v)/100;
-
2237 if (v > USHRT_MAX) {
evaluated: v > (32767 * 2 + 1)
TRUEFALSE
yes
Evaluation Count:274
yes
Evaluation Count:3305
274-3305
2238 // overflow... adjust saturation -
2239 s -= v - USHRT_MAX;
executed (the execution status of this line is deduced): s -= v - (32767 * 2 + 1);
-
2240 if (s < 0)
evaluated: s < 0
TRUEFALSE
yes
Evaluation Count:232
yes
Evaluation Count:42
42-232
2241 s = 0;
executed: s = 0;
Execution Count:232
232
2242 v = USHRT_MAX;
executed (the execution status of this line is deduced): v = (32767 * 2 + 1);
-
2243 }
executed: }
Execution Count:274
274
2244 -
2245 hsv.ct.ahsv.saturation = s;
executed (the execution status of this line is deduced): hsv.ct.ahsv.saturation = s;
-
2246 hsv.ct.ahsv.value = v;
executed (the execution status of this line is deduced): hsv.ct.ahsv.value = v;
-
2247 -
2248 // convert back to same color spec as original color -
2249 return hsv.convertTo(cspec);
executed: return hsv.convertTo(cspec);
Execution Count:3579
3579
2250} -
2251 -
2252/*! -
2253 \fn QColor QColor::darker(int factor) const -
2254 \since 4.3 -
2255 -
2256 Returns a darker (or lighter) color, but does not change this object. -
2257 -
2258 If the \a factor is greater than 100, this functions returns a darker -
2259 color. Setting \a factor to 300 returns a color that has one-third the -
2260 brightness. If the \a factor is less than 100, the return color is lighter, -
2261 but we recommend using the lighter() function for this purpose. If the -
2262 \a factor is 0 or negative, the return value is unspecified. -
2263 -
2264 The function converts the current RGB color to HSV, divides the value (V) -
2265 component by \a factor and converts the color back to RGB. -
2266 -
2267 \sa lighter(), isValid() -
2268*/ -
2269 -
2270/*! -
2271 \obsolete -
2272 -
2273 Use darker(\a factor) instead. -
2274*/ -
2275QColor QColor::dark(int factor) const -
2276{ -
2277 if (factor <= 0) // invalid darkness factor
partially evaluated: factor <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5268
0-5268
2278 return *this;
never executed: return *this;
0
2279 else if (factor < 100) // makes color lighter
partially evaluated: factor < 100
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5268
0-5268
2280 return lighter(10000 / factor);
never executed: return lighter(10000 / factor);
0
2281 -
2282 QColor hsv = toHsv();
executed (the execution status of this line is deduced): QColor hsv = toHsv();
-
2283 hsv.ct.ahsv.value = (hsv.ct.ahsv.value * 100) / factor;
executed (the execution status of this line is deduced): hsv.ct.ahsv.value = (hsv.ct.ahsv.value * 100) / factor;
-
2284 -
2285 // convert back to same color spec as original color -
2286 return hsv.convertTo(cspec);
executed: return hsv.convertTo(cspec);
Execution Count:5268
5268
2287} -
2288 -
2289/*! -
2290 Assigns a copy of \a color to this color, and returns a reference to it. -
2291*/ -
2292QColor &QColor::operator=(const QColor &color) -
2293{ -
2294 cspec = color.cspec;
executed (the execution status of this line is deduced): cspec = color.cspec;
-
2295 ct.argb = color.ct.argb;
executed (the execution status of this line is deduced): ct.argb = color.ct.argb;
-
2296 return *this;
executed: return *this;
Execution Count:428910
428910
2297} -
2298 -
2299/*! \overload -
2300 Assigns a copy of \a color and returns a reference to this color. -
2301 */ -
2302QColor &QColor::operator=(Qt::GlobalColor color) -
2303{ -
2304 return operator=(QColor(color));
executed: return operator=(QColor(color));
Execution Count:154
154
2305} -
2306 -
2307/*! -
2308 Returns true if this color has the same RGB and alpha values as \a color; -
2309 otherwise returns false. -
2310*/ -
2311bool QColor::operator==(const QColor &color) const -
2312{ -
2313 if (cspec == Hsl && cspec == color.cspec) {
evaluated: cspec == Hsl
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:119012
partially evaluated: cspec == color.cspec
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-119012
2314 return (ct.argb.alpha == color.ct.argb.alpha
executed: return (ct.argb.alpha == color.ct.argb.alpha && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000))) || (ct.ahsl.hue == color.ct.ahsl.hue)) && (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);
Execution Count:7
7
2315 && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000)))
executed: return (ct.argb.alpha == color.ct.argb.alpha && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000))) || (ct.ahsl.hue == color.ct.ahsl.hue)) && (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);
Execution Count:7
7
2316 || (ct.ahsl.hue == color.ct.ahsl.hue))
executed: return (ct.argb.alpha == color.ct.argb.alpha && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000))) || (ct.ahsl.hue == color.ct.ahsl.hue)) && (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);
Execution Count:7
7
2317 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50
executed: return (ct.argb.alpha == color.ct.argb.alpha && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000))) || (ct.ahsl.hue == color.ct.ahsl.hue)) && (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);
Execution Count:7
7
2318 || ct.ahsl.lightness == 0
executed: return (ct.argb.alpha == color.ct.argb.alpha && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000))) || (ct.ahsl.hue == color.ct.ahsl.hue)) && (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);
Execution Count:7
7
2319 || color.ct.ahsl.lightness == 0
executed: return (ct.argb.alpha == color.ct.argb.alpha && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000))) || (ct.ahsl.hue == color.ct.ahsl.hue)) && (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);
Execution Count:7
7
2320 || ct.ahsl.lightness == USHRT_MAX
executed: return (ct.argb.alpha == color.ct.argb.alpha && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000))) || (ct.ahsl.hue == color.ct.ahsl.hue)) && (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);
Execution Count:7
7
2321 || color.ct.ahsl.lightness == USHRT_MAX)
executed: return (ct.argb.alpha == color.ct.argb.alpha && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000))) || (ct.ahsl.hue == color.ct.ahsl.hue)) && (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);
Execution Count:7
7
2322 && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50);
executed: return (ct.argb.alpha == color.ct.argb.alpha && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000))) || (ct.ahsl.hue == color.ct.ahsl.hue)) && (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);
Execution Count:7
7
2323 } else { -
2324 return (cspec == color.cspec
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);
Execution Count:119012
119012
2325 && ct.argb.alpha == color.ct.argb.alpha
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);
Execution Count:119012
119012
2326 && (((cspec == QColor::Hsv)
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);
Execution Count:119012
119012
2327 && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000)))
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);
Execution Count:119012
119012
2328 || (ct.ahsv.hue == color.ct.ahsv.hue))
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);
Execution Count:119012
119012
2329 && ct.argb.green == color.ct.argb.green
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);
Execution Count:119012
119012
2330 && ct.argb.blue == color.ct.argb.blue
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);
Execution Count:119012
119012
2331 && ct.argb.pad == color.ct.argb.pad);
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);
Execution Count:119012
119012
2332 } -
2333} -
2334 -
2335/*! -
2336 Returns true if this color has a different RGB and alpha values from -
2337 \a color; otherwise returns false. -
2338*/ -
2339bool QColor::operator!=(const QColor &color) const -
2340{ return !operator==(color); }
executed: return !operator==(color);
Execution Count:107589
107589
2341 -
2342 -
2343/*! -
2344 Returns the color as a QVariant -
2345*/ -
2346QColor::operator QVariant() const -
2347{ -
2348 return QVariant(QVariant::Color, this);
executed: return QVariant(QVariant::Color, this);
Execution Count:3412924
3412924
2349} -
2350 -
2351/*! \internal -
2352 -
2353 Marks the color as invalid and sets all components to zero (alpha is set -
2354 to fully opaque for compatibility with Qt 3). -
2355*/ -
2356void QColor::invalidate() -
2357{ -
2358 cspec = Invalid;
executed (the execution status of this line is deduced): cspec = Invalid;
-
2359 ct.argb.alpha = USHRT_MAX;
executed (the execution status of this line is deduced): ct.argb.alpha = (32767 * 2 + 1);
-
2360 ct.argb.red = 0;
executed (the execution status of this line is deduced): ct.argb.red = 0;
-
2361 ct.argb.green = 0;
executed (the execution status of this line is deduced): ct.argb.green = 0;
-
2362 ct.argb.blue = 0;
executed (the execution status of this line is deduced): ct.argb.blue = 0;
-
2363 ct.argb.pad = 0;
executed (the execution status of this line is deduced): ct.argb.pad = 0;
-
2364}
executed: }
Execution Count:791672
791672
2365 -
2366/***************************************************************************** -
2367 QColor stream functions -
2368 *****************************************************************************/ -
2369 -
2370#ifndef QT_NO_DEBUG_STREAM -
2371QDebug operator<<(QDebug dbg, const QColor &c) -
2372{ -
2373 if (!c.isValid())
evaluated: !c.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
2374 dbg.nospace() << "QColor(Invalid)";
executed: dbg.nospace() << "QColor(Invalid)";
Execution Count:1
1
2375 else if (c.spec() == QColor::Rgb)
partially evaluated: c.spec() == QColor::Rgb
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2376 dbg.nospace() << "QColor(ARGB " << c.alphaF() << ", " << c.redF() << ", " << c.greenF() << ", " << c.blueF() << ')';
executed: dbg.nospace() << "QColor(ARGB " << c.alphaF() << ", " << c.redF() << ", " << c.greenF() << ", " << c.blueF() << ')';
Execution Count:3
3
2377 else if (c.spec() == QColor::Hsv)
never evaluated: c.spec() == QColor::Hsv
0
2378 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
2379 else if (c.spec() == QColor::Cmyk)
never evaluated: c.spec() == QColor::Cmyk
0
2380 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
2381 << c.blackF()<< ')';
never executed: dbg.nospace() << "QColor(ACMYK " << c.alphaF() << ", " << c.cyanF() << ", " << c.magentaF() << ", " << c.yellowF() << ", " << c.blackF()<< ')';
0
2382 else if (c.spec() == QColor::Hsl)
never evaluated: c.spec() == QColor::Hsl
0
2383 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
2384 -
2385 return dbg.space();
executed: return dbg.space();
Execution Count:4
4
2386} -
2387#endif -
2388 -
2389#ifndef QT_NO_DATASTREAM -
2390/*! -
2391 \fn QDataStream &operator<<(QDataStream &stream, const QColor &color) -
2392 \relates QColor -
2393 -
2394 Writes the \a color to the \a stream. -
2395 -
2396 \sa {Serializing Qt Data Types} -
2397*/ -
2398QDataStream &operator<<(QDataStream &stream, const QColor &color) -
2399{ -
2400 if (stream.version() < 7) {
evaluated: stream.version() < 7
TRUEFALSE
yes
Evaluation Count:614
yes
Evaluation Count:1065
614-1065
2401 if (!color.isValid())
evaluated: !color.isValid()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:605
9-605
2402 return stream << quint32(0x49000000);
executed: return stream << quint32(0x49000000);
Execution Count:9
9
2403 quint32 p = (quint32)color.rgb();
executed (the execution status of this line is deduced): quint32 p = (quint32)color.rgb();
-
2404 if (stream.version() == 1) // Swap red and blue
evaluated: stream.version() == 1
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:563
42-563
2405 p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
executed: p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
Execution Count:42
42
2406 return stream << p;
executed: return stream << p;
Execution Count:605
605
2407 } -
2408 -
2409 qint8 s = color.cspec;
executed (the execution status of this line is deduced): qint8 s = color.cspec;
-
2410 quint16 a = color.ct.argb.alpha;
executed (the execution status of this line is deduced): quint16 a = color.ct.argb.alpha;
-
2411 quint16 r = color.ct.argb.red;
executed (the execution status of this line is deduced): quint16 r = color.ct.argb.red;
-
2412 quint16 g = color.ct.argb.green;
executed (the execution status of this line is deduced): quint16 g = color.ct.argb.green;
-
2413 quint16 b = color.ct.argb.blue;
executed (the execution status of this line is deduced): quint16 b = color.ct.argb.blue;
-
2414 quint16 p = color.ct.argb.pad;
executed (the execution status of this line is deduced): quint16 p = color.ct.argb.pad;
-
2415 -
2416 stream << s;
executed (the execution status of this line is deduced): stream << s;
-
2417 stream << a;
executed (the execution status of this line is deduced): stream << a;
-
2418 stream << r;
executed (the execution status of this line is deduced): stream << r;
-
2419 stream << g;
executed (the execution status of this line is deduced): stream << g;
-
2420 stream << b;
executed (the execution status of this line is deduced): stream << b;
-
2421 stream << p;
executed (the execution status of this line is deduced): stream << p;
-
2422 -
2423 return stream;
executed: return stream;
Execution Count:1065
1065
2424} -
2425 -
2426/*! -
2427 \fn QDataStream &operator>>(QDataStream &stream, QColor &color) -
2428 \relates QColor -
2429 -
2430 Reads the \a color from the \a stream. -
2431 -
2432 \sa {Serializing Qt Data Types} -
2433*/ -
2434QDataStream &operator>>(QDataStream &stream, QColor &color) -
2435{ -
2436 if (stream.version() < 7) {
evaluated: stream.version() < 7
TRUEFALSE
yes
Evaluation Count:613
yes
Evaluation Count:1041
613-1041
2437 quint32 p;
executed (the execution status of this line is deduced): quint32 p;
-
2438 stream >> p;
executed (the execution status of this line is deduced): stream >> p;
-
2439 if (p == 0x49000000) {
evaluated: p == 0x49000000
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:604
9-604
2440 color.invalidate();
executed (the execution status of this line is deduced): color.invalidate();
-
2441 return stream;
executed: return stream;
Execution Count:9
9
2442 } -
2443 if (stream.version() == 1) // Swap red and blue
evaluated: stream.version() == 1
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:562
42-562
2444 p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
executed: p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
Execution Count:42
42
2445 color.setRgb(p);
executed (the execution status of this line is deduced): color.setRgb(p);
-
2446 return stream;
executed: return stream;
Execution Count:604
604
2447 } -
2448 -
2449 qint8 s;
executed (the execution status of this line is deduced): qint8 s;
-
2450 quint16 a, r, g, b, p;
executed (the execution status of this line is deduced): quint16 a, r, g, b, p;
-
2451 stream >> s;
executed (the execution status of this line is deduced): stream >> s;
-
2452 stream >> a;
executed (the execution status of this line is deduced): stream >> a;
-
2453 stream >> r;
executed (the execution status of this line is deduced): stream >> r;
-
2454 stream >> g;
executed (the execution status of this line is deduced): stream >> g;
-
2455 stream >> b;
executed (the execution status of this line is deduced): stream >> b;
-
2456 stream >> p;
executed (the execution status of this line is deduced): stream >> p;
-
2457 -
2458 color.cspec = QColor::Spec(s);
executed (the execution status of this line is deduced): color.cspec = QColor::Spec(s);
-
2459 color.ct.argb.alpha = a;
executed (the execution status of this line is deduced): color.ct.argb.alpha = a;
-
2460 color.ct.argb.red = r;
executed (the execution status of this line is deduced): color.ct.argb.red = r;
-
2461 color.ct.argb.green = g;
executed (the execution status of this line is deduced): color.ct.argb.green = g;
-
2462 color.ct.argb.blue = b;
executed (the execution status of this line is deduced): color.ct.argb.blue = b;
-
2463 color.ct.argb.pad = p;
executed (the execution status of this line is deduced): color.ct.argb.pad = p;
-
2464 -
2465 return stream;
executed: return stream;
Execution Count:1041
1041
2466} -
2467#endif // QT_NO_DATASTREAM -
2468 -
2469 -
2470/***************************************************************************** -
2471 QColor global functions (documentation only) -
2472 *****************************************************************************/ -
2473 -
2474/*! -
2475 \fn int qRed(QRgb rgb) -
2476 \relates QColor -
2477 -
2478 Returns the red component of the ARGB quadruplet \a rgb. -
2479 -
2480 \sa qRgb(), QColor::red() -
2481*/ -
2482 -
2483/*! -
2484 \fn int qGreen(QRgb rgb) -
2485 \relates QColor -
2486 -
2487 Returns the green component of the ARGB quadruplet \a rgb. -
2488 -
2489 \sa qRgb(), QColor::green() -
2490*/ -
2491 -
2492/*! -
2493 \fn int qBlue(QRgb rgb) -
2494 \relates QColor -
2495 -
2496 Returns the blue component of the ARGB quadruplet \a rgb. -
2497 -
2498 \sa qRgb(), QColor::blue() -
2499*/ -
2500 -
2501/*! -
2502 \fn int qAlpha(QRgb rgba) -
2503 \relates QColor -
2504 -
2505 Returns the alpha component of the ARGB quadruplet \a rgba. -
2506 -
2507 \sa qRgb(), QColor::alpha() -
2508*/ -
2509 -
2510/*! -
2511 \fn QRgb qRgb(int r, int g, int b) -
2512 \relates QColor -
2513 -
2514 Returns the ARGB quadruplet (255, \a{r}, \a{g}, \a{b}). -
2515 -
2516 \sa qRgba(), qRed(), qGreen(), qBlue() -
2517*/ -
2518 -
2519/*! -
2520 \fn QRgb qRgba(int r, int g, int b, int a) -
2521 \relates QColor -
2522 -
2523 Returns the ARGB quadruplet (\a{a}, \a{r}, \a{g}, \a{b}). -
2524 -
2525 \sa qRgb(), qRed(), qGreen(), qBlue() -
2526*/ -
2527 -
2528/*! -
2529 \fn int qGray(int r, int g, int b) -
2530 \relates QColor -
2531 -
2532 Returns a gray value (0 to 255) from the (\a r, \a g, \a b) -
2533 triplet. -
2534 -
2535 The gray value is calculated using the formula (\a r * 11 + \a g * 16 + -
2536 \a b * 5)/32. -
2537*/ -
2538 -
2539/*! -
2540 \fn int qGray(QRgb rgb) -
2541 \overload -
2542 \relates QColor -
2543 -
2544 Returns a gray value (0 to 255) from the given ARGB quadruplet \a rgb. -
2545 -
2546 The gray value is calculated using the formula (R * 11 + G * 16 + B * 5)/32; -
2547 the alpha-channel is ignored. -
2548*/ -
2549 -
2550/*! -
2551 \fn QColor QColor::convertTo(Spec colorSpec) const -
2552 -
2553 Creates a copy of \e this color in the format specified by \a colorSpec. -
2554 -
2555 \sa spec(), toCmyk(), toHsv(), toRgb(), isValid() -
2556*/ -
2557 -
2558/*! -
2559 \typedef QRgb -
2560 \relates QColor -
2561 -
2562 An ARGB quadruplet on the format #AARRGGBB, equivalent to an unsigned int. -
2563 -
2564 The type also holds a value for the alpha-channel. The default alpha -
2565 channel is \c ff, i.e opaque. For more information, see the -
2566 \l{QColor#Alpha-Blended Drawing}{Alpha-Blended Drawing} section. -
2567 -
2568 \sa QColor::rgb(), QColor::rgba() -
2569*/ -
2570 -
2571QT_END_NAMESPACE -
2572 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial