Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | #include "qcolor.h" | - |
41 | #include "qcolor_p.h" | - |
42 | #include "qnamespace.h" | - |
43 | #include "qdatastream.h" | - |
44 | #include "qvariant.h" | - |
45 | #include "qdebug.h" | - |
46 | | - |
47 | #include <stdio.h> | - |
48 | #include <limits.h> | - |
49 | | - |
50 | QT_BEGIN_NAMESPACE | - |
51 | | - |
52 | | - |
53 | | - |
54 | | - |
55 | | - |
56 | | - |
57 | | - |
58 | | - |
59 | | - |
60 | | - |
61 | | - |
62 | | - |
63 | | - |
64 | | - |
65 | | - |
66 | | - |
67 | | - |
68 | | - |
69 | | - |
70 | | - |
71 | | - |
72 | | - |
73 | | - |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
78 | | - |
79 | | - |
80 | | - |
81 | | - |
82 | | - |
83 | | - |
84 | | - |
85 | | - |
86 | | - |
87 | | - |
88 | | - |
89 | | - |
90 | | - |
91 | | - |
92 | | - |
93 | | - |
94 | | - |
95 | | - |
96 | | - |
97 | | - |
98 | | - |
99 | | - |
100 | | - |
101 | | - |
102 | | - |
103 | | - |
104 | | - |
105 | | - |
106 | | - |
107 | | - |
108 | | - |
109 | | - |
110 | | - |
111 | | - |
112 | | - |
113 | | - |
114 | | - |
115 | | - |
116 | | - |
117 | | - |
118 | | - |
119 | | - |
120 | | - |
121 | | - |
122 | | - |
123 | | - |
124 | | - |
125 | | - |
126 | | - |
127 | | - |
128 | | - |
129 | | - |
130 | | - |
131 | | - |
132 | | - |
133 | | - |
134 | | - |
135 | | - |
136 | | - |
137 | | - |
138 | | - |
139 | | - |
140 | | - |
141 | | - |
142 | | - |
143 | | - |
144 | | - |
145 | | - |
146 | | - |
147 | | - |
148 | | - |
149 | | - |
150 | | - |
151 | | - |
152 | | - |
153 | | - |
154 | | - |
155 | | - |
156 | | - |
157 | | - |
158 | | - |
159 | | - |
160 | | - |
161 | | - |
162 | | - |
163 | | - |
164 | | - |
165 | | - |
166 | | - |
167 | | - |
168 | | - |
169 | | - |
170 | | - |
171 | | - |
172 | | - |
173 | | - |
174 | | - |
175 | | - |
176 | | - |
177 | | - |
178 | | - |
179 | | - |
180 | | - |
181 | | - |
182 | | - |
183 | | - |
184 | | - |
185 | | - |
186 | | - |
187 | | - |
188 | | - |
189 | | - |
190 | | - |
191 | | - |
192 | | - |
193 | | - |
194 | | - |
195 | | - |
196 | | - |
197 | | - |
198 | | - |
199 | | - |
200 | | - |
201 | | - |
202 | | - |
203 | | - |
204 | | - |
205 | | - |
206 | | - |
207 | | - |
208 | | - |
209 | | - |
210 | | - |
211 | | - |
212 | | - |
213 | | - |
214 | | - |
215 | | - |
216 | | - |
217 | | - |
218 | | - |
219 | | - |
220 | | - |
221 | | - |
222 | | - |
223 | | - |
224 | | - |
225 | | - |
226 | | - |
227 | | - |
228 | | - |
229 | | - |
230 | | - |
231 | | - |
232 | | - |
233 | | - |
234 | | - |
235 | | - |
236 | | - |
237 | | - |
238 | | - |
239 | | - |
240 | | - |
241 | | - |
242 | | - |
243 | | - |
244 | | - |
245 | | - |
246 | | - |
247 | | - |
248 | | - |
249 | | - |
250 | | - |
251 | | - |
252 | | - |
253 | | - |
254 | | - |
255 | | - |
256 | | - |
257 | | - |
258 | | - |
259 | | - |
260 | | - |
261 | | - |
262 | | - |
263 | | - |
264 | | - |
265 | | - |
266 | | - |
267 | #define QCOLOR_INT_RANGE_CHECK(fn, var) \ | - |
268 | do { \ | - |
269 | if (var < 0 || var > 255) { \ | - |
270 | qWarning(#fn": invalid value %d", var); \ | - |
271 | var = qMax(0, qMin(var, 255)); \ | - |
272 | } \ | - |
273 | } while (0) | - |
274 | | - |
275 | #define QCOLOR_REAL_RANGE_CHECK(fn, var) \ | - |
276 | do { \ | - |
277 | if (var < qreal(0.0) || var > qreal(1.0)) { \ | - |
278 | qWarning(#fn": invalid value %g", var); \ | - |
279 | var = qMax(qreal(0.0), qMin(var, qreal(1.0))); \ | - |
280 | } \ | - |
281 | } while (0) | - |
282 | | - |
283 | | - |
284 | | - |
285 | | - |
286 | | - |
287 | | - |
288 | | - |
289 | | - |
290 | | - |
291 | | - |
292 | | - |
293 | | - |
294 | | - |
295 | | - |
296 | | - |
297 | | - |
298 | | - |
299 | | - |
300 | | - |
301 | | - |
302 | | - |
303 | | - |
304 | | - |
305 | | - |
306 | | - |
307 | | - |
308 | | - |
309 | | - |
310 | | - |
311 | | - |
312 | | - |
313 | | - |
314 | | - |
315 | | - |
316 | | - |
317 | | - |
318 | | - |
319 | | - |
320 | | - |
321 | | - |
322 | | - |
323 | | - |
324 | | - |
325 | | - |
326 | | - |
327 | | - |
328 | | - |
329 | | - |
330 | | - |
331 | | - |
332 | | - |
333 | | - |
334 | | - |
335 | | - |
336 | | - |
337 | | - |
338 | | - |
339 | | - |
340 | QColor::QColor(Qt::GlobalColor color) Q_DECL_NOTHROW | - |
341 | { | - |
342 | #define QRGB(r, g, b) \ | - |
343 | QRgb(((0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff))) | - |
344 | #define QRGBA(r, g, b, a) \ | - |
345 | QRgb(((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff)) | - |
346 | | - |
347 | static const QRgb global_colors[] = { | - |
348 | QRGB(255, 255, 255), | - |
349 | QRGB( 0, 0, 0), | - |
350 | QRGB( 0, 0, 0), | - |
351 | QRGB(255, 255, 255), | - |
352 | | - |
353 | | - |
354 | | - |
355 | | - |
356 | | - |
357 | | - |
358 | | - |
359 | | - |
360 | | - |
361 | | - |
362 | | - |
363 | | - |
364 | | - |
365 | | - |
366 | | - |
367 | | - |
368 | | - |
369 | | - |
370 | | - |
371 | QRGB(128, 128, 128), | - |
372 | QRGB(160, 160, 164), | - |
373 | QRGB(192, 192, 192), | - |
374 | QRGB(255, 0, 0), | - |
375 | QRGB( 0, 255, 0), | - |
376 | QRGB( 0, 0, 255), | - |
377 | QRGB( 0, 255, 255), | - |
378 | QRGB(255, 0, 255), | - |
379 | QRGB(255, 255, 0), | - |
380 | QRGB(128, 0, 0), | - |
381 | QRGB( 0, 128, 0), | - |
382 | QRGB( 0, 0, 128), | - |
383 | QRGB( 0, 128, 128), | - |
384 | QRGB(128, 0, 128), | - |
385 | QRGB(128, 128, 0), | - |
386 | QRGBA(0, 0, 0, 0) | - |
387 | }; | - |
388 | #undef QRGB | - |
389 | #undef QRGBA | - |
390 | | - |
391 | setRgb(qRed(global_colors[color]), | - |
392 | qGreen(global_colors[color]), | - |
393 | qBlue(global_colors[color]), | - |
394 | qAlpha(global_colors[color])); | - |
395 | } never executed: end of block | 0 |
396 | | - |
397 | | - |
398 | | - |
399 | | - |
400 | | - |
401 | | - |
402 | | - |
403 | | - |
404 | | - |
405 | | - |
406 | | - |
407 | | - |
408 | | - |
409 | | - |
410 | | - |
411 | | - |
412 | | - |
413 | | - |
414 | | - |
415 | QColor::QColor(QRgb color) Q_DECL_NOTHROW | - |
416 | { | - |
417 | cspec = Rgb; | - |
418 | ct.argb.alpha = 0xffff; | - |
419 | ct.argb.red = qRed(color) * 0x101; | - |
420 | ct.argb.green = qGreen(color) * 0x101; | - |
421 | ct.argb.blue = qBlue(color) * 0x101; | - |
422 | ct.argb.pad = 0; | - |
423 | } never executed: end of block | 0 |
424 | | - |
425 | | - |
426 | | - |
427 | | - |
428 | | - |
429 | | - |
430 | | - |
431 | | - |
432 | | - |
433 | QColor::QColor(QRgba64 rgba64) Q_DECL_NOTHROW | - |
434 | { | - |
435 | setRgba64(rgba64); | - |
436 | } never executed: end of block | 0 |
437 | | - |
438 | | - |
439 | | - |
440 | | - |
441 | | - |
442 | | - |
443 | | - |
444 | | - |
445 | | - |
446 | | - |
447 | QColor::QColor(Spec spec) Q_DECL_NOTHROW | - |
448 | { | - |
449 | switch (spec) { | - |
450 | case Invalid: never executed: case Invalid: | 0 |
451 | invalidate(); | - |
452 | break; never executed: break; | 0 |
453 | case Rgb: never executed: case Rgb: | 0 |
454 | setRgb(0, 0, 0); | - |
455 | break; never executed: break; | 0 |
456 | case Hsv: never executed: case Hsv: | 0 |
457 | setHsv(0, 0, 0); | - |
458 | break; never executed: break; | 0 |
459 | case Cmyk: never executed: case Cmyk: | 0 |
460 | setCmyk(0, 0, 0, 0); | - |
461 | break; never executed: break; | 0 |
462 | case Hsl: never executed: case Hsl: | 0 |
463 | setHsl(0, 0, 0, 0); | - |
464 | break; never executed: break; | 0 |
465 | } | - |
466 | } never executed: end of block | 0 |
467 | | - |
468 | | - |
469 | | - |
470 | | - |
471 | | - |
472 | | - |
473 | | - |
474 | | - |
475 | | - |
476 | | - |
477 | | - |
478 | | - |
479 | | - |
480 | | - |
481 | | - |
482 | | - |
483 | | - |
484 | | - |
485 | | - |
486 | | - |
487 | | - |
488 | | - |
489 | | - |
490 | #if QT_VERSION < QT_VERSION_CHECK(6,0,0) | - |
491 | | - |
492 | | - |
493 | | - |
494 | | - |
495 | | - |
496 | | - |
497 | | - |
498 | #endif | - |
499 | | - |
500 | | - |
501 | | - |
502 | | - |
503 | | - |
504 | | - |
505 | | - |
506 | | - |
507 | | - |
508 | | - |
509 | | - |
510 | | - |
511 | | - |
512 | | - |
513 | QString QColor::name() const | - |
514 | { | - |
515 | return name(HexRgb); never executed: return name(HexRgb); | 0 |
516 | } | - |
517 | | - |
518 | | - |
519 | | - |
520 | | - |
521 | | - |
522 | | - |
523 | | - |
524 | | - |
525 | | - |
526 | QString QColor::name(NameFormat format) const | - |
527 | { | - |
528 | switch (format) { | - |
529 | case HexRgb: never executed: case HexRgb: | 0 |
530 | return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6); never executed: return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6); | 0 |
531 | case HexArgb: never executed: case HexArgb: | 0 |
532 | | - |
533 | return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8); never executed: return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8); | 0 |
534 | } | - |
535 | return QString(); never executed: return QString(); | 0 |
536 | } | - |
537 | | - |
538 | | - |
539 | | - |
540 | | - |
541 | | - |
542 | | - |
543 | | - |
544 | | - |
545 | | - |
546 | | - |
547 | | - |
548 | | - |
549 | | - |
550 | | - |
551 | | - |
552 | | - |
553 | | - |
554 | | - |
555 | | - |
556 | | - |
557 | | - |
558 | | - |
559 | | - |
560 | | - |
561 | void QColor::setNamedColor(const QString &name) | - |
562 | { | - |
563 | setColorFromString(name); | - |
564 | } never executed: end of block | 0 |
565 | | - |
566 | | - |
567 | | - |
568 | | - |
569 | | - |
570 | | - |
571 | | - |
572 | | - |
573 | | - |
574 | | - |
575 | | - |
576 | | - |
577 | bool QColor::isValidColor(const QString &name) | - |
578 | { | - |
579 | return !name.isEmpty() && QColor().setColorFromString(name); never executed: return !name.isEmpty() && QColor().setColorFromString(name); | 0 |
580 | } | - |
581 | | - |
582 | bool QColor::setColorFromString(const QString &name) | - |
583 | { | - |
584 | if (name.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
585 | invalidate(); | - |
586 | return true; never executed: return true; | 0 |
587 | } | - |
588 | | - |
589 | if (name.startsWith(QLatin1Char('#'))) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
590 | QRgb rgba; | - |
591 | if (qt_get_hex_rgb(name.constData(), name.length(), &rgba)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
592 | setRgba(rgba); | - |
593 | return true; never executed: return true; | 0 |
594 | } else { | - |
595 | invalidate(); | - |
596 | return false; never executed: return false; | 0 |
597 | } | - |
598 | } | - |
599 | | - |
600 | #ifndef QT_NO_COLORNAMES | - |
601 | QRgb rgb; | - |
602 | if (qt_get_named_rgb(name.constData(), name.length(), &rgb)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
603 | setRgba(rgb); | - |
604 | return true; never executed: return true; | 0 |
605 | } else | - |
606 | #endif | - |
607 | { | - |
608 | invalidate(); | - |
609 | return false; never executed: return false; | 0 |
610 | } | - |
611 | } | - |
612 | | - |
613 | | - |
614 | | - |
615 | | - |
616 | | - |
617 | | - |
618 | QStringList QColor::colorNames() | - |
619 | { | - |
620 | #ifndef QT_NO_COLORNAMES | - |
621 | return qt_get_colornames(); never executed: return qt_get_colornames(); | 0 |
622 | #else | - |
623 | return QStringList(); | - |
624 | #endif | - |
625 | } | - |
626 | | - |
627 | | - |
628 | | - |
629 | | - |
630 | | - |
631 | | - |
632 | | - |
633 | | - |
634 | | - |
635 | | - |
636 | | - |
637 | void QColor::getHsvF(qreal *h, qreal *s, qreal *v, qreal *a) const | - |
638 | { | - |
639 | if (!h || !s || !v)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
640 | return; never executed: return; | 0 |
641 | | - |
642 | if (cspec != Invalid && cspec != Hsv) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
643 | toHsv().getHsvF(h, s, v, a); | - |
644 | return; never executed: return; | 0 |
645 | } | - |
646 | | - |
647 | *h = ct.ahsv.hue == USHRT_MAX ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0);TRUE | never evaluated | FALSE | never evaluated |
| 0 |
648 | *s = ct.ahsv.saturation / qreal(USHRT_MAX); | - |
649 | *v = ct.ahsv.value / qreal(USHRT_MAX); | - |
650 | | - |
651 | if (a)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
652 | *a = ct.ahsv.alpha / qreal(USHRT_MAX); never executed: *a = ct.ahsv.alpha / qreal((32767 * 2 + 1)); | 0 |
653 | } never executed: end of block | 0 |
654 | | - |
655 | | - |
656 | | - |
657 | | - |
658 | | - |
659 | | - |
660 | | - |
661 | | - |
662 | | - |
663 | | - |
664 | | - |
665 | void QColor::getHsv(int *h, int *s, int *v, int *a) const | - |
666 | { | - |
667 | if (!h || !s || !v)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
668 | return; never executed: return; | 0 |
669 | | - |
670 | if (cspec != Invalid && cspec != Hsv) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
671 | toHsv().getHsv(h, s, v, a); | - |
672 | return; never executed: return; | 0 |
673 | } | - |
674 | | - |
675 | *h = ct.ahsv.hue == USHRT_MAX ? -1 : ct.ahsv.hue / 100;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
676 | *s = ct.ahsv.saturation >> 8; | - |
677 | *v = ct.ahsv.value >> 8; | - |
678 | | - |
679 | if (a)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
680 | *a = ct.ahsv.alpha >> 8; never executed: *a = ct.ahsv.alpha >> 8; | 0 |
681 | } never executed: end of block | 0 |
682 | | - |
683 | | - |
684 | | - |
685 | | - |
686 | | - |
687 | | - |
688 | | - |
689 | | - |
690 | | - |
691 | void QColor::setHsvF(qreal h, qreal s, qreal v, qreal a) | - |
692 | { | - |
693 | if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
694 | || (s < qreal(0.0) || s > qreal(1.0))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
695 | || (v < qreal(0.0) || v > qreal(1.0))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
696 | || (a < qreal(0.0) || a > qreal(1.0))) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
697 | qWarning("QColor::setHsvF: HSV parameters out of range"); | - |
698 | return; never executed: return; | 0 |
699 | } | - |
700 | | - |
701 | cspec = Hsv; | - |
702 | ct.ahsv.alpha = qRound(a * USHRT_MAX); | - |
703 | ct.ahsv.hue = h == qreal(-1.0) ? USHRT_MAX : qRound(h * 36000);TRUE | never evaluated | FALSE | never evaluated |
| 0 |
704 | ct.ahsv.saturation = qRound(s * USHRT_MAX); | - |
705 | ct.ahsv.value = qRound(v * USHRT_MAX); | - |
706 | ct.ahsv.pad = 0; | - |
707 | } never executed: end of block | 0 |
708 | | - |
709 | | - |
710 | | - |
711 | | - |
712 | | - |
713 | | - |
714 | | - |
715 | | - |
716 | | - |
717 | | - |
718 | void QColor::setHsv(int h, int s, int v, int a) | - |
719 | { | - |
720 | if (h < -1 || (uint)s > 255 || (uint)v > 255 || (uint)a > 255) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
721 | qWarning("QColor::setHsv: HSV parameters out of range"); | - |
722 | invalidate(); | - |
723 | return; never executed: return; | 0 |
724 | } | - |
725 | | - |
726 | cspec = Hsv; | - |
727 | ct.ahsv.alpha = a * 0x101; | - |
728 | ct.ahsv.hue = h == -1 ? USHRT_MAX : (h % 360) * 100;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
729 | ct.ahsv.saturation = s * 0x101; | - |
730 | ct.ahsv.value = v * 0x101; | - |
731 | ct.ahsv.pad = 0; | - |
732 | } never executed: end of block | 0 |
733 | | - |
734 | | - |
735 | | - |
736 | | - |
737 | | - |
738 | | - |
739 | | - |
740 | | - |
741 | | - |
742 | | - |
743 | | - |
744 | | - |
745 | | - |
746 | void QColor::getHslF(qreal *h, qreal *s, qreal *l, qreal *a) const | - |
747 | { | - |
748 | if (!h || !s || !l)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
749 | return; never executed: return; | 0 |
750 | | - |
751 | if (cspec != Invalid && cspec != Hsl) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
752 | toHsl().getHslF(h, s, l, a); | - |
753 | return; never executed: return; | 0 |
754 | } | - |
755 | | - |
756 | *h = ct.ahsl.hue == USHRT_MAX ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0);TRUE | never evaluated | FALSE | never evaluated |
| 0 |
757 | *s = ct.ahsl.saturation / qreal(USHRT_MAX); | - |
758 | *l = ct.ahsl.lightness / qreal(USHRT_MAX); | - |
759 | | - |
760 | if (a)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
761 | *a = ct.ahsl.alpha / qreal(USHRT_MAX); never executed: *a = ct.ahsl.alpha / qreal((32767 * 2 + 1)); | 0 |
762 | } never executed: end of block | 0 |
763 | | - |
764 | | - |
765 | | - |
766 | | - |
767 | | - |
768 | | - |
769 | | - |
770 | | - |
771 | | - |
772 | | - |
773 | | - |
774 | | - |
775 | | - |
776 | void QColor::getHsl(int *h, int *s, int *l, int *a) const | - |
777 | { | - |
778 | if (!h || !s || !l)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
779 | return; never executed: return; | 0 |
780 | | - |
781 | if (cspec != Invalid && cspec != Hsl) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
782 | toHsl().getHsl(h, s, l, a); | - |
783 | return; never executed: return; | 0 |
784 | } | - |
785 | | - |
786 | *h = ct.ahsl.hue == USHRT_MAX ? -1 : ct.ahsl.hue / 100;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
787 | *s = ct.ahsl.saturation >> 8; | - |
788 | *l = ct.ahsl.lightness >> 8; | - |
789 | | - |
790 | if (a)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
791 | *a = ct.ahsl.alpha >> 8; never executed: *a = ct.ahsl.alpha >> 8; | 0 |
792 | } never executed: end of block | 0 |
793 | | - |
794 | | - |
795 | | - |
796 | | - |
797 | | - |
798 | | - |
799 | | - |
800 | | - |
801 | | - |
802 | | - |
803 | | - |
804 | void QColor::setHslF(qreal h, qreal s, qreal l, qreal a) | - |
805 | { | - |
806 | if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
807 | || (s < qreal(0.0) || s > qreal(1.0))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
808 | || (l < qreal(0.0) || l > qreal(1.0))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
809 | || (a < qreal(0.0) || a > qreal(1.0))) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
810 | qWarning("QColor::setHsvF: HSV parameters out of range"); | - |
811 | return; never executed: return; | 0 |
812 | } | - |
813 | | - |
814 | cspec = Hsl; | - |
815 | ct.ahsl.alpha = qRound(a * USHRT_MAX); | - |
816 | ct.ahsl.hue = h == qreal(-1.0) ? USHRT_MAX : qRound(h * 36000);TRUE | never evaluated | FALSE | never evaluated |
| 0 |
817 | ct.ahsl.saturation = qRound(s * USHRT_MAX); | - |
818 | ct.ahsl.lightness = qRound(l * USHRT_MAX); | - |
819 | ct.ahsl.pad = 0; | - |
820 | } never executed: end of block | 0 |
821 | | - |
822 | | - |
823 | | - |
824 | | - |
825 | | - |
826 | | - |
827 | | - |
828 | | - |
829 | | - |
830 | | - |
831 | | - |
832 | | - |
833 | void QColor::setHsl(int h, int s, int l, int a) | - |
834 | { | - |
835 | if (h < -1 || (uint)s > 255 || (uint)l > 255 || (uint)a > 255) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
836 | qWarning("QColor::setHsv: HSV parameters out of range"); | - |
837 | invalidate(); | - |
838 | return; never executed: return; | 0 |
839 | } | - |
840 | | - |
841 | cspec = Hsl; | - |
842 | ct.ahsl.alpha = a * 0x101; | - |
843 | ct.ahsl.hue = h == -1 ? USHRT_MAX : (h % 360) * 100;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
844 | ct.ahsl.saturation = s * 0x101; | - |
845 | ct.ahsl.lightness = l * 0x101; | - |
846 | ct.ahsl.pad = 0; | - |
847 | } never executed: end of block | 0 |
848 | | - |
849 | | - |
850 | | - |
851 | | - |
852 | | - |
853 | | - |
854 | | - |
855 | | - |
856 | | - |
857 | | - |
858 | | - |
859 | void QColor::getRgbF(qreal *r, qreal *g, qreal *b, qreal *a) const | - |
860 | { | - |
861 | if (!r || !g || !b)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
862 | return; never executed: return; | 0 |
863 | | - |
864 | if (cspec != Invalid && cspec != Rgb) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
865 | toRgb().getRgbF(r, g, b, a); | - |
866 | return; never executed: return; | 0 |
867 | } | - |
868 | | - |
869 | *r = ct.argb.red / qreal(USHRT_MAX); | - |
870 | *g = ct.argb.green / qreal(USHRT_MAX); | - |
871 | *b = ct.argb.blue / qreal(USHRT_MAX); | - |
872 | | - |
873 | if (a)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
874 | *a = ct.argb.alpha / qreal(USHRT_MAX); never executed: *a = ct.argb.alpha / qreal((32767 * 2 + 1)); | 0 |
875 | | - |
876 | } never executed: end of block | 0 |
877 | | - |
878 | | - |
879 | | - |
880 | | - |
881 | | - |
882 | | - |
883 | | - |
884 | | - |
885 | | - |
886 | | - |
887 | | - |
888 | void QColor::getRgb(int *r, int *g, int *b, int *a) const | - |
889 | { | - |
890 | if (!r || !g || !b)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
891 | return; never executed: return; | 0 |
892 | | - |
893 | if (cspec != Invalid && cspec != Rgb) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
894 | toRgb().getRgb(r, g, b, a); | - |
895 | return; never executed: return; | 0 |
896 | } | - |
897 | | - |
898 | *r = ct.argb.red >> 8; | - |
899 | *g = ct.argb.green >> 8; | - |
900 | *b = ct.argb.blue >> 8; | - |
901 | | - |
902 | if (a)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
903 | *a = ct.argb.alpha >> 8; never executed: *a = ct.argb.alpha >> 8; | 0 |
904 | } never executed: end of block | 0 |
905 | | - |
906 | | - |
907 | | - |
908 | | - |
909 | | - |
910 | | - |
911 | | - |
912 | | - |
913 | | - |
914 | | - |
915 | | - |
916 | void QColor::setRgbF(qreal r, qreal g, qreal b, qreal a) | - |
917 | { | - |
918 | if (r < qreal(0.0) || r > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
919 | || g < qreal(0.0) || g > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
920 | || b < qreal(0.0) || b > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
921 | || a < qreal(0.0) || a > qreal(1.0)) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
922 | qWarning("QColor::setRgbF: RGB parameters out of range"); | - |
923 | invalidate(); | - |
924 | return; never executed: return; | 0 |
925 | } | - |
926 | | - |
927 | cspec = Rgb; | - |
928 | ct.argb.alpha = qRound(a * USHRT_MAX); | - |
929 | ct.argb.red = qRound(r * USHRT_MAX); | - |
930 | ct.argb.green = qRound(g * USHRT_MAX); | - |
931 | ct.argb.blue = qRound(b * USHRT_MAX); | - |
932 | ct.argb.pad = 0; | - |
933 | } never executed: end of block | 0 |
934 | | - |
935 | | - |
936 | | - |
937 | | - |
938 | | - |
939 | | - |
940 | | - |
941 | | - |
942 | void QColor::setRgb(int r, int g, int b, int a) | - |
943 | { | - |
944 | if ((uint)r > 255 || (uint)g > 255 || (uint)b > 255 || (uint)a > 255) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
945 | qWarning("QColor::setRgb: RGB parameters out of range"); | - |
946 | invalidate(); | - |
947 | return; never executed: return; | 0 |
948 | } | - |
949 | | - |
950 | cspec = Rgb; | - |
951 | ct.argb.alpha = a * 0x101; | - |
952 | ct.argb.red = r * 0x101; | - |
953 | ct.argb.green = g * 0x101; | - |
954 | ct.argb.blue = b * 0x101; | - |
955 | ct.argb.pad = 0; | - |
956 | } never executed: end of block | 0 |
957 | | - |
958 | | - |
959 | | - |
960 | | - |
961 | | - |
962 | | - |
963 | | - |
964 | | - |
965 | | - |
966 | | - |
967 | | - |
968 | QRgb QColor::rgba() const Q_DECL_NOTHROW | - |
969 | { | - |
970 | if (cspec != Invalid && cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
971 | return toRgb().rgba(); never executed: return toRgb().rgba(); | 0 |
972 | return qRgba(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8, ct.argb.alpha >> 8); never executed: return qRgba(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8, ct.argb.alpha >> 8); | 0 |
973 | } | - |
974 | | - |
975 | | - |
976 | | - |
977 | | - |
978 | | - |
979 | | - |
980 | void QColor::setRgba(QRgb rgba) Q_DECL_NOTHROW | - |
981 | { | - |
982 | cspec = Rgb; | - |
983 | ct.argb.alpha = qAlpha(rgba) * 0x101; | - |
984 | ct.argb.red = qRed(rgba) * 0x101; | - |
985 | ct.argb.green = qGreen(rgba) * 0x101; | - |
986 | ct.argb.blue = qBlue(rgba) * 0x101; | - |
987 | ct.argb.pad = 0; | - |
988 | } never executed: end of block | 0 |
989 | | - |
990 | | - |
991 | | - |
992 | | - |
993 | | - |
994 | | - |
995 | | - |
996 | | - |
997 | | - |
998 | | - |
999 | | - |
1000 | QRgba64 QColor::rgba64() const Q_DECL_NOTHROW | - |
1001 | { | - |
1002 | if (cspec != Invalid && cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1003 | return toRgb().rgba64(); never executed: return toRgb().rgba64(); | 0 |
1004 | return qRgba64(ct.argb.red, ct.argb.green, ct.argb.blue, ct.argb.alpha); never executed: return qRgba64(ct.argb.red, ct.argb.green, ct.argb.blue, ct.argb.alpha); | 0 |
1005 | } | - |
1006 | | - |
1007 | | - |
1008 | | - |
1009 | | - |
1010 | | - |
1011 | | - |
1012 | | - |
1013 | | - |
1014 | void QColor::setRgba64(QRgba64 rgba) Q_DECL_NOTHROW | - |
1015 | { | - |
1016 | cspec = Rgb; | - |
1017 | ct.argb.alpha = rgba.alpha(); | - |
1018 | ct.argb.red = rgba.red(); | - |
1019 | ct.argb.green = rgba.green(); | - |
1020 | ct.argb.blue = rgba.blue(); | - |
1021 | ct.argb.pad = 0; | - |
1022 | } never executed: end of block | 0 |
1023 | | - |
1024 | | - |
1025 | | - |
1026 | | - |
1027 | | - |
1028 | | - |
1029 | | - |
1030 | | - |
1031 | QRgb QColor::rgb() const Q_DECL_NOTHROW | - |
1032 | { | - |
1033 | if (cspec != Invalid && cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1034 | return toRgb().rgb(); never executed: return toRgb().rgb(); | 0 |
1035 | return qRgb(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8); never executed: return qRgb(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8); | 0 |
1036 | } | - |
1037 | | - |
1038 | | - |
1039 | | - |
1040 | | - |
1041 | | - |
1042 | | - |
1043 | void QColor::setRgb(QRgb rgb) Q_DECL_NOTHROW | - |
1044 | { | - |
1045 | cspec = Rgb; | - |
1046 | ct.argb.alpha = 0xffff; | - |
1047 | ct.argb.red = qRed(rgb) * 0x101; | - |
1048 | ct.argb.green = qGreen(rgb) * 0x101; | - |
1049 | ct.argb.blue = qBlue(rgb) * 0x101; | - |
1050 | ct.argb.pad = 0; | - |
1051 | } never executed: end of block | 0 |
1052 | | - |
1053 | | - |
1054 | | - |
1055 | | - |
1056 | | - |
1057 | | - |
1058 | int QColor::alpha() const Q_DECL_NOTHROW | - |
1059 | { never executed: return ct.argb.alpha >> 8; return ct.argb.alpha >> 8; }never executed: return ct.argb.alpha >> 8; | 0 |
1060 | | - |
1061 | | - |
1062 | | - |
1063 | | - |
1064 | | - |
1065 | | - |
1066 | | - |
1067 | | - |
1068 | | - |
1069 | void QColor::setAlpha(int alpha) | - |
1070 | { | - |
1071 | QCOLOR_INT_RANGE_CHECK("QColor::setAlpha", alpha); never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1072 | ct.argb.alpha = alpha * 0x101; | - |
1073 | } never executed: end of block | 0 |
1074 | | - |
1075 | | - |
1076 | | - |
1077 | | - |
1078 | | - |
1079 | | - |
1080 | qreal QColor::alphaF() const Q_DECL_NOTHROW | - |
1081 | { never executed: return ct.argb.alpha / qreal((32767 * 2 + 1)); return ct.argb.alpha / qreal(USHRT_MAX); }never executed: return ct.argb.alpha / qreal((32767 * 2 + 1)); | 0 |
1082 | | - |
1083 | | - |
1084 | | - |
1085 | | - |
1086 | | - |
1087 | | - |
1088 | | - |
1089 | | - |
1090 | void QColor::setAlphaF(qreal alpha) | - |
1091 | { | - |
1092 | QCOLOR_REAL_RANGE_CHECK("QColor::setAlphaF", alpha); never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1093 | qreal tmp = alpha * USHRT_MAX; | - |
1094 | ct.argb.alpha = qRound(tmp); | - |
1095 | } never executed: end of block | 0 |
1096 | | - |
1097 | | - |
1098 | | - |
1099 | | - |
1100 | | - |
1101 | | - |
1102 | | - |
1103 | int QColor::red() const Q_DECL_NOTHROW | - |
1104 | { | - |
1105 | if (cspec != Invalid && cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1106 | return toRgb().red(); never executed: return toRgb().red(); | 0 |
1107 | return ct.argb.red >> 8; never executed: return ct.argb.red >> 8; | 0 |
1108 | } | - |
1109 | | - |
1110 | | - |
1111 | | - |
1112 | | - |
1113 | | - |
1114 | | - |
1115 | | - |
1116 | void QColor::setRed(int red) | - |
1117 | { | - |
1118 | QCOLOR_INT_RANGE_CHECK("QColor::setRed", red); never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1119 | if (cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1120 | setRgb(red, green(), blue(), alpha()); never executed: setRgb(red, green(), blue(), alpha()); | 0 |
1121 | else | - |
1122 | ct.argb.red = red * 0x101; never executed: ct.argb.red = red * 0x101; | 0 |
1123 | } | - |
1124 | | - |
1125 | | - |
1126 | | - |
1127 | | - |
1128 | | - |
1129 | | - |
1130 | int QColor::green() const Q_DECL_NOTHROW | - |
1131 | { | - |
1132 | if (cspec != Invalid && cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1133 | return toRgb().green(); never executed: return toRgb().green(); | 0 |
1134 | return ct.argb.green >> 8; never executed: return ct.argb.green >> 8; | 0 |
1135 | } | - |
1136 | | - |
1137 | | - |
1138 | | - |
1139 | | - |
1140 | | - |
1141 | | - |
1142 | | - |
1143 | void QColor::setGreen(int green) | - |
1144 | { | - |
1145 | QCOLOR_INT_RANGE_CHECK("QColor::setGreen", green); never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1146 | if (cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1147 | setRgb(red(), green, blue(), alpha()); never executed: setRgb(red(), green, blue(), alpha()); | 0 |
1148 | else | - |
1149 | ct.argb.green = green * 0x101; never executed: ct.argb.green = green * 0x101; | 0 |
1150 | } | - |
1151 | | - |
1152 | | - |
1153 | | - |
1154 | | - |
1155 | | - |
1156 | | - |
1157 | | - |
1158 | int QColor::blue() const Q_DECL_NOTHROW | - |
1159 | { | - |
1160 | if (cspec != Invalid && cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1161 | return toRgb().blue(); never executed: return toRgb().blue(); | 0 |
1162 | return ct.argb.blue >> 8; never executed: return ct.argb.blue >> 8; | 0 |
1163 | } | - |
1164 | | - |
1165 | | - |
1166 | | - |
1167 | | - |
1168 | | - |
1169 | | - |
1170 | | - |
1171 | | - |
1172 | void QColor::setBlue(int blue) | - |
1173 | { | - |
1174 | QCOLOR_INT_RANGE_CHECK("QColor::setBlue", blue); never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1175 | if (cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1176 | setRgb(red(), green(), blue, alpha()); never executed: setRgb(red(), green(), blue, alpha()); | 0 |
1177 | else | - |
1178 | ct.argb.blue = blue * 0x101; never executed: ct.argb.blue = blue * 0x101; | 0 |
1179 | } | - |
1180 | | - |
1181 | | - |
1182 | | - |
1183 | | - |
1184 | | - |
1185 | | - |
1186 | qreal QColor::redF() const Q_DECL_NOTHROW | - |
1187 | { | - |
1188 | if (cspec != Invalid && cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1189 | return toRgb().redF(); never executed: return toRgb().redF(); | 0 |
1190 | return ct.argb.red / qreal(USHRT_MAX); never executed: return ct.argb.red / qreal((32767 * 2 + 1)); | 0 |
1191 | } | - |
1192 | | - |
1193 | | - |
1194 | | - |
1195 | | - |
1196 | | - |
1197 | | - |
1198 | | - |
1199 | | - |
1200 | void QColor::setRedF(qreal red) | - |
1201 | { | - |
1202 | QCOLOR_REAL_RANGE_CHECK("QColor::setRedF", red); never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1203 | if (cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1204 | setRgbF(red, greenF(), blueF(), alphaF()); never executed: setRgbF(red, greenF(), blueF(), alphaF()); | 0 |
1205 | else | - |
1206 | ct.argb.red = qRound(red * USHRT_MAX); never executed: ct.argb.red = qRound(red * (32767 * 2 + 1)); | 0 |
1207 | } | - |
1208 | | - |
1209 | | - |
1210 | | - |
1211 | | - |
1212 | | - |
1213 | | - |
1214 | qreal QColor::greenF() const Q_DECL_NOTHROW | - |
1215 | { | - |
1216 | if (cspec != Invalid && cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1217 | return toRgb().greenF(); never executed: return toRgb().greenF(); | 0 |
1218 | return ct.argb.green / qreal(USHRT_MAX); never executed: return ct.argb.green / qreal((32767 * 2 + 1)); | 0 |
1219 | } | - |
1220 | | - |
1221 | | - |
1222 | | - |
1223 | | - |
1224 | | - |
1225 | | - |
1226 | | - |
1227 | | - |
1228 | void QColor::setGreenF(qreal green) | - |
1229 | { | - |
1230 | QCOLOR_REAL_RANGE_CHECK("QColor::setGreenF", green); never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1231 | if (cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1232 | setRgbF(redF(), green, blueF(), alphaF()); never executed: setRgbF(redF(), green, blueF(), alphaF()); | 0 |
1233 | else | - |
1234 | ct.argb.green = qRound(green * USHRT_MAX); never executed: ct.argb.green = qRound(green * (32767 * 2 + 1)); | 0 |
1235 | } | - |
1236 | | - |
1237 | | - |
1238 | | - |
1239 | | - |
1240 | | - |
1241 | | - |
1242 | qreal QColor::blueF() const Q_DECL_NOTHROW | - |
1243 | { | - |
1244 | if (cspec != Invalid && cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1245 | return toRgb().blueF(); never executed: return toRgb().blueF(); | 0 |
1246 | return ct.argb.blue / qreal(USHRT_MAX); never executed: return ct.argb.blue / qreal((32767 * 2 + 1)); | 0 |
1247 | } | - |
1248 | | - |
1249 | | - |
1250 | | - |
1251 | | - |
1252 | | - |
1253 | | - |
1254 | | - |
1255 | void QColor::setBlueF(qreal blue) | - |
1256 | { | - |
1257 | QCOLOR_REAL_RANGE_CHECK("QColor::setBlueF", blue); never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1258 | if (cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1259 | setRgbF(redF(), greenF(), blue, alphaF()); never executed: setRgbF(redF(), greenF(), blue, alphaF()); | 0 |
1260 | else | - |
1261 | ct.argb.blue = qRound(blue * USHRT_MAX); never executed: ct.argb.blue = qRound(blue * (32767 * 2 + 1)); | 0 |
1262 | } | - |
1263 | | - |
1264 | | - |
1265 | | - |
1266 | | - |
1267 | | - |
1268 | | - |
1269 | | - |
1270 | | - |
1271 | | - |
1272 | int QColor::hue() const Q_DECL_NOTHROW | - |
1273 | { | - |
1274 | return hsvHue(); never executed: return hsvHue(); | 0 |
1275 | } | - |
1276 | | - |
1277 | | - |
1278 | | - |
1279 | | - |
1280 | | - |
1281 | | - |
1282 | int QColor::hsvHue() const Q_DECL_NOTHROW | - |
1283 | { | - |
1284 | if (cspec != Invalid && cspec != Hsv)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1285 | return toHsv().hue(); never executed: return toHsv().hue(); | 0 |
1286 | return ct.ahsv.hue == USHRT_MAX ? -1 : ct.ahsv.hue / 100; never executed: return ct.ahsv.hue == (32767 * 2 + 1) ? -1 : ct.ahsv.hue / 100; | 0 |
1287 | } | - |
1288 | | - |
1289 | | - |
1290 | | - |
1291 | | - |
1292 | | - |
1293 | | - |
1294 | | - |
1295 | | - |
1296 | | - |
1297 | | - |
1298 | int QColor::saturation() const Q_DECL_NOTHROW | - |
1299 | { | - |
1300 | return hsvSaturation(); never executed: return hsvSaturation(); | 0 |
1301 | } | - |
1302 | | - |
1303 | | - |
1304 | | - |
1305 | | - |
1306 | | - |
1307 | | - |
1308 | int QColor::hsvSaturation() const Q_DECL_NOTHROW | - |
1309 | { | - |
1310 | if (cspec != Invalid && cspec != Hsv)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1311 | return toHsv().saturation(); never executed: return toHsv().saturation(); | 0 |
1312 | return ct.ahsv.saturation >> 8; never executed: return ct.ahsv.saturation >> 8; | 0 |
1313 | } | - |
1314 | | - |
1315 | | - |
1316 | | - |
1317 | | - |
1318 | | - |
1319 | | - |
1320 | int QColor::value() const Q_DECL_NOTHROW | - |
1321 | { | - |
1322 | if (cspec != Invalid && cspec != Hsv)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1323 | return toHsv().value(); never executed: return toHsv().value(); | 0 |
1324 | return ct.ahsv.value >> 8; never executed: return ct.ahsv.value >> 8; | 0 |
1325 | } | - |
1326 | | - |
1327 | | - |
1328 | | - |
1329 | | - |
1330 | | - |
1331 | | - |
1332 | | - |
1333 | | - |
1334 | qreal QColor::hueF() const Q_DECL_NOTHROW | - |
1335 | { | - |
1336 | return hsvHueF(); never executed: return hsvHueF(); | 0 |
1337 | } | - |
1338 | | - |
1339 | | - |
1340 | | - |
1341 | | - |
1342 | | - |
1343 | | - |
1344 | | - |
1345 | qreal QColor::hsvHueF() const Q_DECL_NOTHROW | - |
1346 | { | - |
1347 | if (cspec != Invalid && cspec != Hsv)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1348 | return toHsv().hueF(); never executed: return toHsv().hueF(); | 0 |
1349 | return ct.ahsv.hue == USHRT_MAX ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0); never executed: return ct.ahsv.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0); | 0 |
1350 | } | - |
1351 | | - |
1352 | | - |
1353 | | - |
1354 | | - |
1355 | | - |
1356 | | - |
1357 | | - |
1358 | | - |
1359 | | - |
1360 | qreal QColor::saturationF() const Q_DECL_NOTHROW | - |
1361 | { | - |
1362 | return hsvSaturationF(); never executed: return hsvSaturationF(); | 0 |
1363 | } | - |
1364 | | - |
1365 | | - |
1366 | | - |
1367 | | - |
1368 | | - |
1369 | | - |
1370 | qreal QColor::hsvSaturationF() const Q_DECL_NOTHROW | - |
1371 | { | - |
1372 | if (cspec != Invalid && cspec != Hsv)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1373 | return toHsv().saturationF(); never executed: return toHsv().saturationF(); | 0 |
1374 | return ct.ahsv.saturation / qreal(USHRT_MAX); never executed: return ct.ahsv.saturation / qreal((32767 * 2 + 1)); | 0 |
1375 | } | - |
1376 | | - |
1377 | | - |
1378 | | - |
1379 | | - |
1380 | | - |
1381 | | - |
1382 | qreal QColor::valueF() const Q_DECL_NOTHROW | - |
1383 | { | - |
1384 | if (cspec != Invalid && cspec != Hsv)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1385 | return toHsv().valueF(); never executed: return toHsv().valueF(); | 0 |
1386 | return ct.ahsv.value / qreal(USHRT_MAX); never executed: return ct.ahsv.value / qreal((32767 * 2 + 1)); | 0 |
1387 | } | - |
1388 | | - |
1389 | | - |
1390 | | - |
1391 | | - |
1392 | | - |
1393 | | - |
1394 | | - |
1395 | | - |
1396 | int QColor::hslHue() const Q_DECL_NOTHROW | - |
1397 | { | - |
1398 | if (cspec != Invalid && cspec != Hsl)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1399 | return toHsl().hslHue(); never executed: return toHsl().hslHue(); | 0 |
1400 | return ct.ahsl.hue == USHRT_MAX ? -1 : ct.ahsl.hue / 100; never executed: return ct.ahsl.hue == (32767 * 2 + 1) ? -1 : ct.ahsl.hue / 100; | 0 |
1401 | } | - |
1402 | | - |
1403 | | - |
1404 | | - |
1405 | | - |
1406 | | - |
1407 | | - |
1408 | | - |
1409 | | - |
1410 | int QColor::hslSaturation() const Q_DECL_NOTHROW | - |
1411 | { | - |
1412 | if (cspec != Invalid && cspec != Hsl)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1413 | return toHsl().hslSaturation(); never executed: return toHsl().hslSaturation(); | 0 |
1414 | return ct.ahsl.saturation >> 8; never executed: return ct.ahsl.saturation >> 8; | 0 |
1415 | } | - |
1416 | | - |
1417 | | - |
1418 | | - |
1419 | | - |
1420 | | - |
1421 | | - |
1422 | | - |
1423 | | - |
1424 | int QColor::lightness() const Q_DECL_NOTHROW | - |
1425 | { | - |
1426 | if (cspec != Invalid && cspec != Hsl)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1427 | return toHsl().lightness(); never executed: return toHsl().lightness(); | 0 |
1428 | return ct.ahsl.lightness >> 8; never executed: return ct.ahsl.lightness >> 8; | 0 |
1429 | } | - |
1430 | | - |
1431 | | - |
1432 | | - |
1433 | | - |
1434 | | - |
1435 | | - |
1436 | | - |
1437 | | - |
1438 | qreal QColor::hslHueF() const Q_DECL_NOTHROW | - |
1439 | { | - |
1440 | if (cspec != Invalid && cspec != Hsl)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1441 | return toHsl().hslHueF(); never executed: return toHsl().hslHueF(); | 0 |
1442 | return ct.ahsl.hue == USHRT_MAX ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0); never executed: return ct.ahsl.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0); | 0 |
1443 | } | - |
1444 | | - |
1445 | | - |
1446 | | - |
1447 | | - |
1448 | | - |
1449 | | - |
1450 | | - |
1451 | | - |
1452 | qreal QColor::hslSaturationF() const Q_DECL_NOTHROW | - |
1453 | { | - |
1454 | if (cspec != Invalid && cspec != Hsl)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1455 | return toHsl().hslSaturationF(); never executed: return toHsl().hslSaturationF(); | 0 |
1456 | return ct.ahsl.saturation / qreal(USHRT_MAX); never executed: return ct.ahsl.saturation / qreal((32767 * 2 + 1)); | 0 |
1457 | } | - |
1458 | | - |
1459 | | - |
1460 | | - |
1461 | | - |
1462 | | - |
1463 | | - |
1464 | | - |
1465 | | - |
1466 | qreal QColor::lightnessF() const Q_DECL_NOTHROW | - |
1467 | { | - |
1468 | if (cspec != Invalid && cspec != Hsl)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1469 | return toHsl().lightnessF(); never executed: return toHsl().lightnessF(); | 0 |
1470 | return ct.ahsl.lightness / qreal(USHRT_MAX); never executed: return ct.ahsl.lightness / qreal((32767 * 2 + 1)); | 0 |
1471 | } | - |
1472 | | - |
1473 | | - |
1474 | | - |
1475 | | - |
1476 | | - |
1477 | | - |
1478 | int QColor::cyan() const Q_DECL_NOTHROW | - |
1479 | { | - |
1480 | if (cspec != Invalid && cspec != Cmyk)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1481 | return toCmyk().cyan(); never executed: return toCmyk().cyan(); | 0 |
1482 | return ct.acmyk.cyan >> 8; never executed: return ct.acmyk.cyan >> 8; | 0 |
1483 | } | - |
1484 | | - |
1485 | | - |
1486 | | - |
1487 | | - |
1488 | | - |
1489 | | - |
1490 | int QColor::magenta() const Q_DECL_NOTHROW | - |
1491 | { | - |
1492 | if (cspec != Invalid && cspec != Cmyk)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1493 | return toCmyk().magenta(); never executed: return toCmyk().magenta(); | 0 |
1494 | return ct.acmyk.magenta >> 8; never executed: return ct.acmyk.magenta >> 8; | 0 |
1495 | } | - |
1496 | | - |
1497 | | - |
1498 | | - |
1499 | | - |
1500 | | - |
1501 | | - |
1502 | int QColor::yellow() const Q_DECL_NOTHROW | - |
1503 | { | - |
1504 | if (cspec != Invalid && cspec != Cmyk)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1505 | return toCmyk().yellow(); never executed: return toCmyk().yellow(); | 0 |
1506 | return ct.acmyk.yellow >> 8; never executed: return ct.acmyk.yellow >> 8; | 0 |
1507 | } | - |
1508 | | - |
1509 | | - |
1510 | | - |
1511 | | - |
1512 | | - |
1513 | | - |
1514 | | - |
1515 | int QColor::black() const Q_DECL_NOTHROW | - |
1516 | { | - |
1517 | if (cspec != Invalid && cspec != Cmyk)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1518 | return toCmyk().black(); never executed: return toCmyk().black(); | 0 |
1519 | return ct.acmyk.black >> 8; never executed: return ct.acmyk.black >> 8; | 0 |
1520 | } | - |
1521 | | - |
1522 | | - |
1523 | | - |
1524 | | - |
1525 | | - |
1526 | | - |
1527 | qreal QColor::cyanF() const Q_DECL_NOTHROW | - |
1528 | { | - |
1529 | if (cspec != Invalid && cspec != Cmyk)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1530 | return toCmyk().cyanF(); never executed: return toCmyk().cyanF(); | 0 |
1531 | return ct.acmyk.cyan / qreal(USHRT_MAX); never executed: return ct.acmyk.cyan / qreal((32767 * 2 + 1)); | 0 |
1532 | } | - |
1533 | | - |
1534 | | - |
1535 | | - |
1536 | | - |
1537 | | - |
1538 | | - |
1539 | qreal QColor::magentaF() const Q_DECL_NOTHROW | - |
1540 | { | - |
1541 | if (cspec != Invalid && cspec != Cmyk)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1542 | return toCmyk().magentaF(); never executed: return toCmyk().magentaF(); | 0 |
1543 | return ct.acmyk.magenta / qreal(USHRT_MAX); never executed: return ct.acmyk.magenta / qreal((32767 * 2 + 1)); | 0 |
1544 | } | - |
1545 | | - |
1546 | | - |
1547 | | - |
1548 | | - |
1549 | | - |
1550 | | - |
1551 | qreal QColor::yellowF() const Q_DECL_NOTHROW | - |
1552 | { | - |
1553 | if (cspec != Invalid && cspec != Cmyk)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1554 | return toCmyk().yellowF(); never executed: return toCmyk().yellowF(); | 0 |
1555 | return ct.acmyk.yellow / qreal(USHRT_MAX); never executed: return ct.acmyk.yellow / qreal((32767 * 2 + 1)); | 0 |
1556 | } | - |
1557 | | - |
1558 | | - |
1559 | | - |
1560 | | - |
1561 | | - |
1562 | | - |
1563 | qreal QColor::blackF() const Q_DECL_NOTHROW | - |
1564 | { | - |
1565 | if (cspec != Invalid && cspec != Cmyk)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1566 | return toCmyk().blackF(); never executed: return toCmyk().blackF(); | 0 |
1567 | return ct.acmyk.black / qreal(USHRT_MAX); never executed: return ct.acmyk.black / qreal((32767 * 2 + 1)); | 0 |
1568 | } | - |
1569 | | - |
1570 | | - |
1571 | | - |
1572 | | - |
1573 | | - |
1574 | | - |
1575 | QColor QColor::toRgb() const Q_DECL_NOTHROW | - |
1576 | { | - |
1577 | if (!isValid() || cspec == Rgb)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1578 | return *this; never executed: return *this; | 0 |
1579 | | - |
1580 | QColor color; | - |
1581 | color.cspec = Rgb; | - |
1582 | color.ct.argb.alpha = ct.argb.alpha; | - |
1583 | color.ct.argb.pad = 0; | - |
1584 | | - |
1585 | switch (cspec) { | - |
1586 | case Hsv: never executed: case Hsv: | 0 |
1587 | { | - |
1588 | if (ct.ahsv.saturation == 0 || ct.ahsv.hue == USHRT_MAX) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1589 | | - |
1590 | color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsv.value; | - |
1591 | break; never executed: break; | 0 |
1592 | } | - |
1593 | | - |
1594 | | - |
1595 | const qreal h = ct.ahsv.hue == 36000 ? 0 : ct.ahsv.hue / 6000.;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1596 | const qreal s = ct.ahsv.saturation / qreal(USHRT_MAX); | - |
1597 | const qreal v = ct.ahsv.value / qreal(USHRT_MAX); | - |
1598 | const int i = int(h); | - |
1599 | const qreal f = h - i; | - |
1600 | const qreal p = v * (qreal(1.0) - s); | - |
1601 | | - |
1602 | if (i & 1) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1603 | const qreal q = v * (qreal(1.0) - (s * f)); | - |
1604 | | - |
1605 | switch (i) { | - |
1606 | case 1: never executed: case 1: | 0 |
1607 | color.ct.argb.red = qRound(q * USHRT_MAX); | - |
1608 | color.ct.argb.green = qRound(v * USHRT_MAX); | - |
1609 | color.ct.argb.blue = qRound(p * USHRT_MAX); | - |
1610 | break; never executed: break; | 0 |
1611 | case 3: never executed: case 3: | 0 |
1612 | color.ct.argb.red = qRound(p * USHRT_MAX); | - |
1613 | color.ct.argb.green = qRound(q * USHRT_MAX); | - |
1614 | color.ct.argb.blue = qRound(v * USHRT_MAX); | - |
1615 | break; never executed: break; | 0 |
1616 | case 5: never executed: case 5: | 0 |
1617 | color.ct.argb.red = qRound(v * USHRT_MAX); | - |
1618 | color.ct.argb.green = qRound(p * USHRT_MAX); | - |
1619 | color.ct.argb.blue = qRound(q * USHRT_MAX); | - |
1620 | break; never executed: break; | 0 |
1621 | } | - |
1622 | } else { never executed: end of block | 0 |
1623 | const qreal t = v * (qreal(1.0) - (s * (qreal(1.0) - f))); | - |
1624 | | - |
1625 | switch (i) { | - |
1626 | case 0: never executed: case 0: | 0 |
1627 | color.ct.argb.red = qRound(v * USHRT_MAX); | - |
1628 | color.ct.argb.green = qRound(t * USHRT_MAX); | - |
1629 | color.ct.argb.blue = qRound(p * USHRT_MAX); | - |
1630 | break; never executed: break; | 0 |
1631 | case 2: never executed: case 2: | 0 |
1632 | color.ct.argb.red = qRound(p * USHRT_MAX); | - |
1633 | color.ct.argb.green = qRound(v * USHRT_MAX); | - |
1634 | color.ct.argb.blue = qRound(t * USHRT_MAX); | - |
1635 | break; never executed: break; | 0 |
1636 | case 4: never executed: case 4: | 0 |
1637 | color.ct.argb.red = qRound(t * USHRT_MAX); | - |
1638 | color.ct.argb.green = qRound(p * USHRT_MAX); | - |
1639 | color.ct.argb.blue = qRound(v * USHRT_MAX); | - |
1640 | break; never executed: break; | 0 |
1641 | } | - |
1642 | } never executed: end of block | 0 |
1643 | break; never executed: break; | 0 |
1644 | } | - |
1645 | case Hsl: never executed: case Hsl: | 0 |
1646 | { | - |
1647 | if (ct.ahsl.saturation == 0 || ct.ahsl.hue == USHRT_MAX) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1648 | | - |
1649 | color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsl.lightness; | - |
1650 | } else if (ct.ahsl.lightness == 0) { never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1651 | | - |
1652 | color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = 0; | - |
1653 | } else { never executed: end of block | 0 |
1654 | | - |
1655 | const qreal h = ct.ahsl.hue == 36000 ? 0 : ct.ahsl.hue / 36000.;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1656 | const qreal s = ct.ahsl.saturation / qreal(USHRT_MAX); | - |
1657 | const qreal l = ct.ahsl.lightness / qreal(USHRT_MAX); | - |
1658 | | - |
1659 | qreal temp2; | - |
1660 | if (l < qreal(0.5))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1661 | temp2 = l * (qreal(1.0) + s); never executed: temp2 = l * (qreal(1.0) + s); | 0 |
1662 | else | - |
1663 | temp2 = l + s - (l * s); never executed: temp2 = l + s - (l * s); | 0 |
1664 | | - |
1665 | const qreal temp1 = (qreal(2.0) * l) - temp2; | - |
1666 | qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)), | - |
1667 | h, | - |
1668 | h - (qreal(1.0) / qreal(3.0)) }; | - |
1669 | | - |
1670 | for (int i = 0; i != 3; ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1671 | if (temp3[i] < qreal(0.0))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1672 | temp3[i] += qreal(1.0); never executed: temp3[i] += qreal(1.0); | 0 |
1673 | else if (temp3[i] > qreal(1.0))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1674 | temp3[i] -= qreal(1.0); never executed: temp3[i] -= qreal(1.0); | 0 |
1675 | | - |
1676 | const qreal sixtemp3 = temp3[i] * qreal(6.0); | - |
1677 | if (sixtemp3 < qreal(1.0))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1678 | color.ct.array[i+1] = qRound((temp1 + (temp2 - temp1) * sixtemp3) * USHRT_MAX); never executed: color.ct.array[i+1] = qRound((temp1 + (temp2 - temp1) * sixtemp3) * (32767 * 2 + 1)); | 0 |
1679 | else if ((temp3[i] * qreal(2.0)) < qreal(1.0))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1680 | color.ct.array[i+1] = qRound(temp2 * USHRT_MAX); never executed: color.ct.array[i+1] = qRound(temp2 * (32767 * 2 + 1)); | 0 |
1681 | else if ((temp3[i] * qreal(3.0)) < qreal(2.0))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1682 | color.ct.array[i+1] = qRound((temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0)) * USHRT_MAX); never executed: color.ct.array[i+1] = qRound((temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0)) * (32767 * 2 + 1)); | 0 |
1683 | else | - |
1684 | color.ct.array[i+1] = qRound(temp1 * USHRT_MAX); never executed: color.ct.array[i+1] = qRound(temp1 * (32767 * 2 + 1)); | 0 |
1685 | } | - |
1686 | color.ct.argb.red = color.ct.argb.red == 1 ? 0 : color.ct.argb.red;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1687 | color.ct.argb.green = color.ct.argb.green == 1 ? 0 : color.ct.argb.green;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1688 | color.ct.argb.blue = color.ct.argb.blue == 1 ? 0 : color.ct.argb.blue;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1689 | } never executed: end of block | 0 |
1690 | break; never executed: break; | 0 |
1691 | } | - |
1692 | case Cmyk: never executed: case Cmyk: | 0 |
1693 | { | - |
1694 | const qreal c = ct.acmyk.cyan / qreal(USHRT_MAX); | - |
1695 | const qreal m = ct.acmyk.magenta / qreal(USHRT_MAX); | - |
1696 | const qreal y = ct.acmyk.yellow / qreal(USHRT_MAX); | - |
1697 | const qreal k = ct.acmyk.black / qreal(USHRT_MAX); | - |
1698 | | - |
1699 | color.ct.argb.red = qRound((qreal(1.0) - (c * (qreal(1.0) - k) + k)) * USHRT_MAX); | - |
1700 | color.ct.argb.green = qRound((qreal(1.0) - (m * (qreal(1.0) - k) + k)) * USHRT_MAX); | - |
1701 | color.ct.argb.blue = qRound((qreal(1.0) - (y * (qreal(1.0) - k) + k)) * USHRT_MAX); | - |
1702 | break; never executed: break; | 0 |
1703 | } | - |
1704 | default: never executed: default: | 0 |
1705 | break; never executed: break; | 0 |
1706 | } | - |
1707 | | - |
1708 | return color; never executed: return color; | 0 |
1709 | } | - |
1710 | | - |
1711 | | - |
1712 | #define Q_MAX_3(a, b, c) ( ( a > b && a > c) ? a : (b > c ? b : c) ) | - |
1713 | #define Q_MIN_3(a, b, c) ( ( a < b && a < c) ? a : (b < c ? b : c) ) | - |
1714 | | - |
1715 | | - |
1716 | | - |
1717 | | - |
1718 | | - |
1719 | | - |
1720 | | - |
1721 | QColor QColor::toHsv() const Q_DECL_NOTHROW | - |
1722 | { | - |
1723 | if (!isValid() || cspec == Hsv)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1724 | return *this; never executed: return *this; | 0 |
1725 | | - |
1726 | if (cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1727 | return toRgb().toHsv(); never executed: return toRgb().toHsv(); | 0 |
1728 | | - |
1729 | QColor color; | - |
1730 | color.cspec = Hsv; | - |
1731 | color.ct.ahsv.alpha = ct.argb.alpha; | - |
1732 | color.ct.ahsv.pad = 0; | - |
1733 | | - |
1734 | const qreal r = ct.argb.red / qreal(USHRT_MAX); | - |
1735 | const qreal g = ct.argb.green / qreal(USHRT_MAX); | - |
1736 | const qreal b = ct.argb.blue / qreal(USHRT_MAX); | - |
1737 | const qreal max = Q_MAX_3(r, g, b);TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1738 | const qreal min = Q_MIN_3(r, g, b);TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1739 | const qreal delta = max - min; | - |
1740 | color.ct.ahsv.value = qRound(max * USHRT_MAX); | - |
1741 | if (qFuzzyIsNull(delta)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1742 | | - |
1743 | color.ct.ahsv.hue = USHRT_MAX; | - |
1744 | color.ct.ahsv.saturation = 0; | - |
1745 | } else { never executed: end of block | 0 |
1746 | | - |
1747 | qreal hue = 0; | - |
1748 | color.ct.ahsv.saturation = qRound((delta / max) * USHRT_MAX); | - |
1749 | if (qFuzzyCompare(r, max)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1750 | hue = ((g - b) /delta); | - |
1751 | } else if (qFuzzyCompare(g, max)) { never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1752 | hue = (qreal(2.0) + (b - r) / delta); | - |
1753 | } else if (qFuzzyCompare(b, max)) { never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1754 | hue = (qreal(4.0) + (r - g) / delta); | - |
1755 | } else { never executed: end of block | 0 |
1756 | Q_ASSERT_X(false, "QColor::toHsv", "internal error"); | - |
1757 | } never executed: end of block | 0 |
1758 | hue *= qreal(60.0); | - |
1759 | if (hue < qreal(0.0))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1760 | hue += qreal(360.0); never executed: hue += qreal(360.0); | 0 |
1761 | color.ct.ahsv.hue = qRound(hue * 100); | - |
1762 | } never executed: end of block | 0 |
1763 | | - |
1764 | return color; never executed: return color; | 0 |
1765 | } | - |
1766 | | - |
1767 | | - |
1768 | | - |
1769 | | - |
1770 | | - |
1771 | | - |
1772 | QColor QColor::toHsl() const Q_DECL_NOTHROW | - |
1773 | { | - |
1774 | if (!isValid() || cspec == Hsl)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1775 | return *this; never executed: return *this; | 0 |
1776 | | - |
1777 | if (cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1778 | return toRgb().toHsl(); never executed: return toRgb().toHsl(); | 0 |
1779 | | - |
1780 | QColor color; | - |
1781 | color.cspec = Hsl; | - |
1782 | color.ct.ahsl.alpha = ct.argb.alpha; | - |
1783 | color.ct.ahsl.pad = 0; | - |
1784 | | - |
1785 | const qreal r = ct.argb.red / qreal(USHRT_MAX); | - |
1786 | const qreal g = ct.argb.green / qreal(USHRT_MAX); | - |
1787 | const qreal b = ct.argb.blue / qreal(USHRT_MAX); | - |
1788 | const qreal max = Q_MAX_3(r, g, b);TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1789 | const qreal min = Q_MIN_3(r, g, b);TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1790 | const qreal delta = max - min; | - |
1791 | const qreal delta2 = max + min; | - |
1792 | const qreal lightness = qreal(0.5) * delta2; | - |
1793 | color.ct.ahsl.lightness = qRound(lightness * USHRT_MAX); | - |
1794 | if (qFuzzyIsNull(delta)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1795 | | - |
1796 | color.ct.ahsl.hue = USHRT_MAX; | - |
1797 | color.ct.ahsl.saturation = 0; | - |
1798 | } else { never executed: end of block | 0 |
1799 | | - |
1800 | qreal hue = 0; | - |
1801 | if (lightness < qreal(0.5))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1802 | color.ct.ahsl.saturation = qRound((delta / delta2) * USHRT_MAX); never executed: color.ct.ahsl.saturation = qRound((delta / delta2) * (32767 * 2 + 1)); | 0 |
1803 | else | - |
1804 | color.ct.ahsl.saturation = qRound((delta / (qreal(2.0) - delta2)) * USHRT_MAX); never executed: color.ct.ahsl.saturation = qRound((delta / (qreal(2.0) - delta2)) * (32767 * 2 + 1)); | 0 |
1805 | if (qFuzzyCompare(r, max)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1806 | hue = ((g - b) /delta); | - |
1807 | } else if (qFuzzyCompare(g, max)) { never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1808 | hue = (qreal(2.0) + (b - r) / delta); | - |
1809 | } else if (qFuzzyCompare(b, max)) { never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1810 | hue = (qreal(4.0) + (r - g) / delta); | - |
1811 | } else { never executed: end of block | 0 |
1812 | Q_ASSERT_X(false, "QColor::toHsv", "internal error"); | - |
1813 | } never executed: end of block | 0 |
1814 | hue *= qreal(60.0); | - |
1815 | if (hue < qreal(0.0))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1816 | hue += qreal(360.0); never executed: hue += qreal(360.0); | 0 |
1817 | color.ct.ahsl.hue = qRound(hue * 100); | - |
1818 | } never executed: end of block | 0 |
1819 | | - |
1820 | return color; never executed: return color; | 0 |
1821 | } | - |
1822 | | - |
1823 | | - |
1824 | | - |
1825 | | - |
1826 | | - |
1827 | | - |
1828 | QColor QColor::toCmyk() const Q_DECL_NOTHROW | - |
1829 | { | - |
1830 | if (!isValid() || cspec == Cmyk)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1831 | return *this; never executed: return *this; | 0 |
1832 | if (cspec != Rgb)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1833 | return toRgb().toCmyk(); never executed: return toRgb().toCmyk(); | 0 |
1834 | | - |
1835 | QColor color; | - |
1836 | color.cspec = Cmyk; | - |
1837 | color.ct.acmyk.alpha = ct.argb.alpha; | - |
1838 | | - |
1839 | | - |
1840 | const qreal r = ct.argb.red / qreal(USHRT_MAX); | - |
1841 | const qreal g = ct.argb.green / qreal(USHRT_MAX); | - |
1842 | const qreal b = ct.argb.blue / qreal(USHRT_MAX); | - |
1843 | qreal c = qreal(1.0) - r; | - |
1844 | qreal m = qreal(1.0) - g; | - |
1845 | qreal y = qreal(1.0) - b; | - |
1846 | | - |
1847 | | - |
1848 | const qreal k = qMin(c, qMin(m, y)); | - |
1849 | | - |
1850 | if (!qFuzzyIsNull(k - 1)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1851 | c = (c - k) / (qreal(1.0) - k); | - |
1852 | m = (m - k) / (qreal(1.0) - k); | - |
1853 | y = (y - k) / (qreal(1.0) - k); | - |
1854 | } never executed: end of block | 0 |
1855 | | - |
1856 | color.ct.acmyk.cyan = qRound(c * USHRT_MAX); | - |
1857 | color.ct.acmyk.magenta = qRound(m * USHRT_MAX); | - |
1858 | color.ct.acmyk.yellow = qRound(y * USHRT_MAX); | - |
1859 | color.ct.acmyk.black = qRound(k * USHRT_MAX); | - |
1860 | | - |
1861 | return color; never executed: return color; | 0 |
1862 | } | - |
1863 | | - |
1864 | QColor QColor::convertTo(QColor::Spec colorSpec) const Q_DECL_NOTHROW | - |
1865 | { | - |
1866 | if (colorSpec == cspec)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1867 | return *this; never executed: return *this; | 0 |
1868 | switch (colorSpec) { | - |
1869 | case Rgb: never executed: case Rgb: | 0 |
1870 | return toRgb(); never executed: return toRgb(); | 0 |
1871 | case Hsv: never executed: case Hsv: | 0 |
1872 | return toHsv(); never executed: return toHsv(); | 0 |
1873 | case Cmyk: never executed: case Cmyk: | 0 |
1874 | return toCmyk(); never executed: return toCmyk(); | 0 |
1875 | case Hsl: never executed: case Hsl: | 0 |
1876 | return toHsl(); never executed: return toHsl(); | 0 |
1877 | case Invalid: never executed: case Invalid: | 0 |
1878 | break; never executed: break; | 0 |
1879 | } | - |
1880 | return QColor(); never executed: return QColor(); | 0 |
1881 | } | - |
1882 | | - |
1883 | | - |
1884 | | - |
1885 | | - |
1886 | | - |
1887 | | - |
1888 | | - |
1889 | | - |
1890 | | - |
1891 | | - |
1892 | | - |
1893 | | - |
1894 | | - |
1895 | QColor QColor::fromRgb(QRgb rgb) Q_DECL_NOTHROW | - |
1896 | { | - |
1897 | return fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb)); never executed: return fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb)); | 0 |
1898 | } | - |
1899 | | - |
1900 | | - |
1901 | | - |
1902 | | - |
1903 | | - |
1904 | | - |
1905 | | - |
1906 | | - |
1907 | | - |
1908 | | - |
1909 | | - |
1910 | | - |
1911 | QColor QColor::fromRgba(QRgb rgba) Q_DECL_NOTHROW | - |
1912 | { | - |
1913 | return fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba)); never executed: return fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba)); | 0 |
1914 | } | - |
1915 | | - |
1916 | | - |
1917 | | - |
1918 | | - |
1919 | | - |
1920 | | - |
1921 | | - |
1922 | | - |
1923 | | - |
1924 | | - |
1925 | QColor QColor::fromRgb(int r, int g, int b, int a) | - |
1926 | { | - |
1927 | if (r < 0 || r > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1928 | || g < 0 || g > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1929 | || b < 0 || b > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1930 | || a < 0 || a > 255) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1931 | qWarning("QColor::fromRgb: RGB parameters out of range"); | - |
1932 | return QColor(); never executed: return QColor(); | 0 |
1933 | } | - |
1934 | | - |
1935 | QColor color; | - |
1936 | color.cspec = Rgb; | - |
1937 | color.ct.argb.alpha = a * 0x101; | - |
1938 | color.ct.argb.red = r * 0x101; | - |
1939 | color.ct.argb.green = g * 0x101; | - |
1940 | color.ct.argb.blue = b * 0x101; | - |
1941 | color.ct.argb.pad = 0; | - |
1942 | return color; never executed: return color; | 0 |
1943 | } | - |
1944 | | - |
1945 | | - |
1946 | | - |
1947 | | - |
1948 | | - |
1949 | | - |
1950 | | - |
1951 | | - |
1952 | | - |
1953 | | - |
1954 | QColor QColor::fromRgbF(qreal r, qreal g, qreal b, qreal a) | - |
1955 | { | - |
1956 | if (r < qreal(0.0) || r > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1957 | || g < qreal(0.0) || g > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1958 | || b < qreal(0.0) || b > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1959 | || a < qreal(0.0) || a > qreal(1.0)) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1960 | qWarning("QColor::fromRgbF: RGB parameters out of range"); | - |
1961 | return QColor(); never executed: return QColor(); | 0 |
1962 | } | - |
1963 | | - |
1964 | QColor color; | - |
1965 | color.cspec = Rgb; | - |
1966 | color.ct.argb.alpha = qRound(a * USHRT_MAX); | - |
1967 | color.ct.argb.red = qRound(r * USHRT_MAX); | - |
1968 | color.ct.argb.green = qRound(g * USHRT_MAX); | - |
1969 | color.ct.argb.blue = qRound(b * USHRT_MAX); | - |
1970 | color.ct.argb.pad = 0; | - |
1971 | return color; never executed: return color; | 0 |
1972 | } | - |
1973 | | - |
1974 | | - |
1975 | | - |
1976 | | - |
1977 | | - |
1978 | | - |
1979 | | - |
1980 | | - |
1981 | | - |
1982 | | - |
1983 | | - |
1984 | QColor QColor::fromRgba64(ushort r, ushort g, ushort b, ushort a) Q_DECL_NOTHROW | - |
1985 | { | - |
1986 | QColor color; | - |
1987 | color.setRgba64(qRgba64(r, g, b, a)); | - |
1988 | return color; never executed: return color; | 0 |
1989 | } | - |
1990 | | - |
1991 | | - |
1992 | | - |
1993 | | - |
1994 | | - |
1995 | | - |
1996 | | - |
1997 | | - |
1998 | | - |
1999 | QColor QColor::fromRgba64(QRgba64 rgba64) Q_DECL_NOTHROW | - |
2000 | { | - |
2001 | QColor color; | - |
2002 | color.setRgba64(rgba64); | - |
2003 | return color; never executed: return color; | 0 |
2004 | } | - |
2005 | | - |
2006 | | - |
2007 | | - |
2008 | | - |
2009 | | - |
2010 | | - |
2011 | | - |
2012 | | - |
2013 | | - |
2014 | | - |
2015 | | - |
2016 | QColor QColor::fromHsv(int h, int s, int v, int a) | - |
2017 | { | - |
2018 | if (((h < 0 || h >= 360) && h != -1)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2019 | || s < 0 || s > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2020 | || v < 0 || v > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2021 | || a < 0 || a > 255) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2022 | qWarning("QColor::fromHsv: HSV parameters out of range"); | - |
2023 | return QColor(); never executed: return QColor(); | 0 |
2024 | } | - |
2025 | | - |
2026 | QColor color; | - |
2027 | color.cspec = Hsv; | - |
2028 | color.ct.ahsv.alpha = a * 0x101; | - |
2029 | color.ct.ahsv.hue = h == -1 ? USHRT_MAX : (h % 360) * 100;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2030 | color.ct.ahsv.saturation = s * 0x101; | - |
2031 | color.ct.ahsv.value = v * 0x101; | - |
2032 | color.ct.ahsv.pad = 0; | - |
2033 | return color; never executed: return color; | 0 |
2034 | } | - |
2035 | | - |
2036 | | - |
2037 | | - |
2038 | | - |
2039 | | - |
2040 | | - |
2041 | | - |
2042 | | - |
2043 | | - |
2044 | | - |
2045 | | - |
2046 | | - |
2047 | QColor QColor::fromHsvF(qreal h, qreal s, qreal v, qreal a) | - |
2048 | { | - |
2049 | if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2050 | || (s < qreal(0.0) || s > qreal(1.0))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2051 | || (v < qreal(0.0) || v > qreal(1.0))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2052 | || (a < qreal(0.0) || a > qreal(1.0))) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2053 | qWarning("QColor::fromHsvF: HSV parameters out of range"); | - |
2054 | return QColor(); never executed: return QColor(); | 0 |
2055 | } | - |
2056 | | - |
2057 | QColor color; | - |
2058 | color.cspec = Hsv; | - |
2059 | color.ct.ahsv.alpha = qRound(a * USHRT_MAX); | - |
2060 | color.ct.ahsv.hue = h == qreal(-1.0) ? USHRT_MAX : qRound(h * 36000);TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2061 | color.ct.ahsv.saturation = qRound(s * USHRT_MAX); | - |
2062 | color.ct.ahsv.value = qRound(v * USHRT_MAX); | - |
2063 | color.ct.ahsv.pad = 0; | - |
2064 | return color; never executed: return color; | 0 |
2065 | } | - |
2066 | | - |
2067 | | - |
2068 | | - |
2069 | | - |
2070 | | - |
2071 | | - |
2072 | | - |
2073 | | - |
2074 | | - |
2075 | | - |
2076 | | - |
2077 | | - |
2078 | | - |
2079 | QColor QColor::fromHsl(int h, int s, int l, int a) | - |
2080 | { | - |
2081 | if (((h < 0 || h >= 360) && h != -1)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2082 | || s < 0 || s > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2083 | || l < 0 || l > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2084 | || a < 0 || a > 255) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2085 | qWarning("QColor::fromHsl: HSL parameters out of range"); | - |
2086 | return QColor(); never executed: return QColor(); | 0 |
2087 | } | - |
2088 | | - |
2089 | QColor color; | - |
2090 | color.cspec = Hsl; | - |
2091 | color.ct.ahsl.alpha = a * 0x101; | - |
2092 | color.ct.ahsl.hue = h == -1 ? USHRT_MAX : (h % 360) * 100;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2093 | color.ct.ahsl.saturation = s * 0x101; | - |
2094 | color.ct.ahsl.lightness = l * 0x101; | - |
2095 | color.ct.ahsl.pad = 0; | - |
2096 | return color; never executed: return color; | 0 |
2097 | } | - |
2098 | | - |
2099 | | - |
2100 | | - |
2101 | | - |
2102 | | - |
2103 | | - |
2104 | | - |
2105 | | - |
2106 | | - |
2107 | | - |
2108 | | - |
2109 | | - |
2110 | | - |
2111 | QColor QColor::fromHslF(qreal h, qreal s, qreal l, qreal a) | - |
2112 | { | - |
2113 | if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2114 | || (s < qreal(0.0) || s > qreal(1.0))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2115 | || (l < qreal(0.0) || l > qreal(1.0))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2116 | || (a < qreal(0.0) || a > qreal(1.0))) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2117 | qWarning("QColor::fromHslF: HSL parameters out of range"); | - |
2118 | return QColor(); never executed: return QColor(); | 0 |
2119 | } | - |
2120 | | - |
2121 | QColor color; | - |
2122 | color.cspec = Hsl; | - |
2123 | color.ct.ahsl.alpha = qRound(a * USHRT_MAX); | - |
2124 | color.ct.ahsl.hue = (h == qreal(-1.0)) ? USHRT_MAX : qRound(h * 36000);TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2125 | if (color.ct.ahsl.hue == 36000)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2126 | color.ct.ahsl.hue = 0; never executed: color.ct.ahsl.hue = 0; | 0 |
2127 | color.ct.ahsl.saturation = qRound(s * USHRT_MAX); | - |
2128 | color.ct.ahsl.lightness = qRound(l * USHRT_MAX); | - |
2129 | color.ct.ahsl.pad = 0; | - |
2130 | return color; never executed: return color; | 0 |
2131 | } | - |
2132 | | - |
2133 | | - |
2134 | | - |
2135 | | - |
2136 | | - |
2137 | | - |
2138 | | - |
2139 | | - |
2140 | | - |
2141 | | - |
2142 | | - |
2143 | | - |
2144 | void QColor::getCmyk(int *c, int *m, int *y, int *k, int *a) | - |
2145 | { | - |
2146 | if (!c || !m || !y || !k)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2147 | return; never executed: return; | 0 |
2148 | | - |
2149 | if (cspec != Invalid && cspec != Cmyk) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2150 | toCmyk().getCmyk(c, m, y, k, a); | - |
2151 | return; never executed: return; | 0 |
2152 | } | - |
2153 | | - |
2154 | *c = ct.acmyk.cyan >> 8; | - |
2155 | *m = ct.acmyk.magenta >> 8; | - |
2156 | *y = ct.acmyk.yellow >> 8; | - |
2157 | *k = ct.acmyk.black >> 8; | - |
2158 | | - |
2159 | if (a)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2160 | *a = ct.acmyk.alpha >> 8; never executed: *a = ct.acmyk.alpha >> 8; | 0 |
2161 | } never executed: end of block | 0 |
2162 | | - |
2163 | | - |
2164 | | - |
2165 | | - |
2166 | | - |
2167 | | - |
2168 | | - |
2169 | | - |
2170 | | - |
2171 | | - |
2172 | | - |
2173 | void QColor::getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a) | - |
2174 | { | - |
2175 | if (!c || !m || !y || !k)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2176 | return; never executed: return; | 0 |
2177 | | - |
2178 | if (cspec != Invalid && cspec != Cmyk) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2179 | toCmyk().getCmykF(c, m, y, k, a); | - |
2180 | return; never executed: return; | 0 |
2181 | } | - |
2182 | | - |
2183 | *c = ct.acmyk.cyan / qreal(USHRT_MAX); | - |
2184 | *m = ct.acmyk.magenta / qreal(USHRT_MAX); | - |
2185 | *y = ct.acmyk.yellow / qreal(USHRT_MAX); | - |
2186 | *k = ct.acmyk.black / qreal(USHRT_MAX); | - |
2187 | | - |
2188 | if (a)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2189 | *a = ct.acmyk.alpha / qreal(USHRT_MAX); never executed: *a = ct.acmyk.alpha / qreal((32767 * 2 + 1)); | 0 |
2190 | } never executed: end of block | 0 |
2191 | | - |
2192 | | - |
2193 | | - |
2194 | | - |
2195 | | - |
2196 | | - |
2197 | | - |
2198 | | - |
2199 | | - |
2200 | void QColor::setCmyk(int c, int m, int y, int k, int a) | - |
2201 | { | - |
2202 | if (c < 0 || c > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2203 | || m < 0 || m > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2204 | || y < 0 || y > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2205 | || k < 0 || k > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2206 | || a < 0 || a > 255) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2207 | qWarning("QColor::setCmyk: CMYK parameters out of range"); | - |
2208 | return; never executed: return; | 0 |
2209 | } | - |
2210 | | - |
2211 | cspec = Cmyk; | - |
2212 | ct.acmyk.alpha = a * 0x101; | - |
2213 | ct.acmyk.cyan = c * 0x101; | - |
2214 | ct.acmyk.magenta = m * 0x101; | - |
2215 | ct.acmyk.yellow = y * 0x101; | - |
2216 | ct.acmyk.black = k * 0x101; | - |
2217 | } never executed: end of block | 0 |
2218 | | - |
2219 | | - |
2220 | | - |
2221 | | - |
2222 | | - |
2223 | | - |
2224 | | - |
2225 | | - |
2226 | | - |
2227 | | - |
2228 | | - |
2229 | void QColor::setCmykF(qreal c, qreal m, qreal y, qreal k, qreal a) | - |
2230 | { | - |
2231 | if (c < qreal(0.0) || c > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2232 | || m < qreal(0.0) || m > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2233 | || y < qreal(0.0) || y > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2234 | || k < qreal(0.0) || k > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2235 | || a < qreal(0.0) || a > qreal(1.0)) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2236 | qWarning("QColor::setCmykF: CMYK parameters out of range"); | - |
2237 | return; never executed: return; | 0 |
2238 | } | - |
2239 | | - |
2240 | cspec = Cmyk; | - |
2241 | ct.acmyk.alpha = qRound(a * USHRT_MAX); | - |
2242 | ct.acmyk.cyan = qRound(c * USHRT_MAX); | - |
2243 | ct.acmyk.magenta = qRound(m * USHRT_MAX); | - |
2244 | ct.acmyk.yellow = qRound(y * USHRT_MAX); | - |
2245 | ct.acmyk.black = qRound(k * USHRT_MAX); | - |
2246 | } never executed: end of block | 0 |
2247 | | - |
2248 | | - |
2249 | | - |
2250 | | - |
2251 | | - |
2252 | | - |
2253 | | - |
2254 | | - |
2255 | | - |
2256 | | - |
2257 | QColor QColor::fromCmyk(int c, int m, int y, int k, int a) | - |
2258 | { | - |
2259 | if (c < 0 || c > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2260 | || m < 0 || m > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2261 | || y < 0 || y > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2262 | || k < 0 || k > 255TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2263 | || a < 0 || a > 255) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2264 | qWarning("QColor::fromCmyk: CMYK parameters out of range"); | - |
2265 | return QColor(); never executed: return QColor(); | 0 |
2266 | } | - |
2267 | | - |
2268 | QColor color; | - |
2269 | color.cspec = Cmyk; | - |
2270 | color.ct.acmyk.alpha = a * 0x101; | - |
2271 | color.ct.acmyk.cyan = c * 0x101; | - |
2272 | color.ct.acmyk.magenta = m * 0x101; | - |
2273 | color.ct.acmyk.yellow = y * 0x101; | - |
2274 | color.ct.acmyk.black = k * 0x101; | - |
2275 | return color; never executed: return color; | 0 |
2276 | } | - |
2277 | | - |
2278 | | - |
2279 | | - |
2280 | | - |
2281 | | - |
2282 | | - |
2283 | | - |
2284 | | - |
2285 | | - |
2286 | | - |
2287 | | - |
2288 | | - |
2289 | QColor QColor::fromCmykF(qreal c, qreal m, qreal y, qreal k, qreal a) | - |
2290 | { | - |
2291 | if (c < qreal(0.0) || c > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2292 | || m < qreal(0.0) || m > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2293 | || y < qreal(0.0) || y > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2294 | || k < qreal(0.0) || k > qreal(1.0)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2295 | || a < qreal(0.0) || a > qreal(1.0)) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2296 | qWarning("QColor::fromCmykF: CMYK parameters out of range"); | - |
2297 | return QColor(); never executed: return QColor(); | 0 |
2298 | } | - |
2299 | | - |
2300 | QColor color; | - |
2301 | color.cspec = Cmyk; | - |
2302 | color.ct.acmyk.alpha = qRound(a * USHRT_MAX); | - |
2303 | color.ct.acmyk.cyan = qRound(c * USHRT_MAX); | - |
2304 | color.ct.acmyk.magenta = qRound(m * USHRT_MAX); | - |
2305 | color.ct.acmyk.yellow = qRound(y * USHRT_MAX); | - |
2306 | color.ct.acmyk.black = qRound(k * USHRT_MAX); | - |
2307 | return color; never executed: return color; | 0 |
2308 | } | - |
2309 | | - |
2310 | | - |
2311 | | - |
2312 | | - |
2313 | | - |
2314 | | - |
2315 | | - |
2316 | | - |
2317 | | - |
2318 | | - |
2319 | | - |
2320 | | - |
2321 | | - |
2322 | | - |
2323 | | - |
2324 | | - |
2325 | | - |
2326 | | - |
2327 | | - |
2328 | | - |
2329 | | - |
2330 | | - |
2331 | | - |
2332 | | - |
2333 | QColor QColor::light(int factor) const Q_DECL_NOTHROW | - |
2334 | { | - |
2335 | if (factor <= 0) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2336 | return *this; never executed: return *this; | 0 |
2337 | else if (factor < 100) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2338 | return darker(10000 / factor); never executed: return darker(10000 / factor); | 0 |
2339 | | - |
2340 | QColor hsv = toHsv(); | - |
2341 | int s = hsv.ct.ahsv.saturation; | - |
2342 | uint v = hsv.ct.ahsv.value; | - |
2343 | | - |
2344 | v = (factor*v)/100; | - |
2345 | if (v > USHRT_MAX) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2346 | | - |
2347 | s -= v - USHRT_MAX; | - |
2348 | if (s < 0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2349 | s = 0; never executed: s = 0; | 0 |
2350 | v = USHRT_MAX; | - |
2351 | } never executed: end of block | 0 |
2352 | | - |
2353 | hsv.ct.ahsv.saturation = s; | - |
2354 | hsv.ct.ahsv.value = v; | - |
2355 | | - |
2356 | | - |
2357 | return hsv.convertTo(cspec); never executed: return hsv.convertTo(cspec); | 0 |
2358 | } | - |
2359 | | - |
2360 | | - |
2361 | | - |
2362 | | - |
2363 | | - |
2364 | | - |
2365 | | - |
2366 | | - |
2367 | | - |
2368 | | - |
2369 | | - |
2370 | | - |
2371 | | - |
2372 | | - |
2373 | | - |
2374 | | - |
2375 | | - |
2376 | | - |
2377 | | - |
2378 | | - |
2379 | | - |
2380 | | - |
2381 | | - |
2382 | | - |
2383 | QColor QColor::dark(int factor) const Q_DECL_NOTHROW | - |
2384 | { | - |
2385 | if (factor <= 0) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2386 | return *this; never executed: return *this; | 0 |
2387 | else if (factor < 100) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2388 | return lighter(10000 / factor); never executed: return lighter(10000 / factor); | 0 |
2389 | | - |
2390 | QColor hsv = toHsv(); | - |
2391 | hsv.ct.ahsv.value = (hsv.ct.ahsv.value * 100) / factor; | - |
2392 | | - |
2393 | | - |
2394 | return hsv.convertTo(cspec); never executed: return hsv.convertTo(cspec); | 0 |
2395 | } | - |
2396 | | - |
2397 | #if QT_VERSION < QT_VERSION_CHECK(6,0,0) | - |
2398 | | - |
2399 | | - |
2400 | | - |
2401 | QColor &QColor::operator=(const QColor &color) Q_DECL_NOTHROW | - |
2402 | { | - |
2403 | cspec = color.cspec; | - |
2404 | ct.argb = color.ct.argb; | - |
2405 | return *this; never executed: return *this; | 0 |
2406 | } | - |
2407 | #endif | - |
2408 | | - |
2409 | | - |
2410 | | - |
2411 | | - |
2412 | QColor &QColor::operator=(Qt::GlobalColor color) Q_DECL_NOTHROW | - |
2413 | { | - |
2414 | return operator=(QColor(color)); never executed: return operator=(QColor(color)); | 0 |
2415 | } | - |
2416 | | - |
2417 | | - |
2418 | | - |
2419 | | - |
2420 | | - |
2421 | bool QColor::operator==(const QColor &color) const Q_DECL_NOTHROW | - |
2422 | { | - |
2423 | if (cspec == Hsl && cspec == color.cspec) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2424 | return (ct.argb.alpha == color.ct.argb.alpha never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 |
2425 | && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 |
2426 | && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 |
2427 | || ct.ahsl.lightness == 0 never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 |
2428 | || color.ct.ahsl.lightness == 0 never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 |
2429 | || ct.ahsl.lightness == USHRT_MAX never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 |
2430 | || color.ct.ahsl.lightness == USHRT_MAX) never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 |
2431 | && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); never executed: return (ct.argb.alpha == color.ct.argb.alpha && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50); | 0 |
2432 | } else { | - |
2433 | return (cspec == color.cspec never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 |
2434 | && ct.argb.alpha == color.ct.argb.alpha never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 |
2435 | && (((cspec == QColor::Hsv) never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 |
2436 | && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 |
2437 | || (ct.ahsv.hue == color.ct.ahsv.hue)) never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 |
2438 | && ct.argb.green == color.ct.argb.green never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 |
2439 | && ct.argb.blue == color.ct.argb.blue never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 |
2440 | && ct.argb.pad == color.ct.argb.pad); never executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad); | 0 |
2441 | } | - |
2442 | } | - |
2443 | | - |
2444 | | - |
2445 | | - |
2446 | | - |
2447 | | - |
2448 | bool QColor::operator!=(const QColor &color) const Q_DECL_NOTHROW | - |
2449 | { never executed: return !operator==(color); return !operator==(color); }never executed: return !operator==(color); | 0 |
2450 | | - |
2451 | | - |
2452 | | - |
2453 | | - |
2454 | | - |
2455 | QColor::operator QVariant() const | - |
2456 | { | - |
2457 | return QVariant(QVariant::Color, this); never executed: return QVariant(QVariant::Color, this); | 0 |
2458 | } | - |
2459 | | - |
2460 | | - |
2461 | | - |
2462 | | - |
2463 | | - |
2464 | | - |
2465 | void QColor::invalidate() Q_DECL_NOTHROW | - |
2466 | { | - |
2467 | cspec = Invalid; | - |
2468 | ct.argb.alpha = USHRT_MAX; | - |
2469 | ct.argb.red = 0; | - |
2470 | ct.argb.green = 0; | - |
2471 | ct.argb.blue = 0; | - |
2472 | ct.argb.pad = 0; | - |
2473 | } never executed: end of block | 0 |
2474 | | - |
2475 | | - |
2476 | | - |
2477 | | - |
2478 | | - |
2479 | #ifndef QT_NO_DEBUG_STREAM | - |
2480 | QDebug operator<<(QDebug dbg, const QColor &c) | - |
2481 | { | - |
2482 | QDebugStateSaver saver(dbg); | - |
2483 | if (!c.isValid())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2484 | dbg.nospace() << "QColor(Invalid)"; never executed: dbg.nospace() << "QColor(Invalid)"; | 0 |
2485 | else if (c.spec() == QColor::Rgb)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2486 | dbg.nospace() << "QColor(ARGB " << c.alphaF() << ", " << c.redF() << ", " << c.greenF() << ", " << c.blueF() << ')'; never executed: dbg.nospace() << "QColor(ARGB " << c.alphaF() << ", " << c.redF() << ", " << c.greenF() << ", " << c.blueF() << ')'; | 0 |
2487 | else if (c.spec() == QColor::Hsv)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2488 | 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 |
2489 | else if (c.spec() == QColor::Cmyk)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2490 | 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 |
2491 | << c.blackF()<< ')'; never executed: dbg.nospace() << "QColor(ACMYK " << c.alphaF() << ", " << c.cyanF() << ", " << c.magentaF() << ", " << c.yellowF() << ", " << c.blackF()<< ')'; | 0 |
2492 | else if (c.spec() == QColor::Hsl)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2493 | 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 |
2494 | | - |
2495 | return dbg; never executed: return dbg; | 0 |
2496 | } | - |
2497 | #endif | - |
2498 | | - |
2499 | #ifndef QT_NO_DATASTREAM | - |
2500 | | - |
2501 | | - |
2502 | | - |
2503 | | - |
2504 | | - |
2505 | | - |
2506 | | - |
2507 | | - |
2508 | QDataStream &operator<<(QDataStream &stream, const QColor &color) | - |
2509 | { | - |
2510 | if (stream.version() < 7) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2511 | if (!color.isValid())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2512 | return stream << quint32(0x49000000); never executed: return stream << quint32(0x49000000); | 0 |
2513 | quint32 p = (quint32)color.rgb(); | - |
2514 | if (stream.version() == 1) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2515 | p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00); never executed: p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00); | 0 |
2516 | return stream << p; never executed: return stream << p; | 0 |
2517 | } | - |
2518 | | - |
2519 | qint8 s = color.cspec; | - |
2520 | quint16 a = color.ct.argb.alpha; | - |
2521 | quint16 r = color.ct.argb.red; | - |
2522 | quint16 g = color.ct.argb.green; | - |
2523 | quint16 b = color.ct.argb.blue; | - |
2524 | quint16 p = color.ct.argb.pad; | - |
2525 | | - |
2526 | stream << s; | - |
2527 | stream << a; | - |
2528 | stream << r; | - |
2529 | stream << g; | - |
2530 | stream << b; | - |
2531 | stream << p; | - |
2532 | | - |
2533 | return stream; never executed: return stream; | 0 |
2534 | } | - |
2535 | | - |
2536 | | - |
2537 | | - |
2538 | | - |
2539 | | - |
2540 | | - |
2541 | | - |
2542 | | - |
2543 | | - |
2544 | QDataStream &operator>>(QDataStream &stream, QColor &color) | - |
2545 | { | - |
2546 | if (stream.version() < 7) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2547 | quint32 p; | - |
2548 | stream >> p; | - |
2549 | if (p == 0x49000000) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2550 | color.invalidate(); | - |
2551 | return stream; never executed: return stream; | 0 |
2552 | } | - |
2553 | if (stream.version() == 1) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
2554 | p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00); never executed: p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00); | 0 |
2555 | color.setRgb(p); | - |
2556 | return stream; never executed: return stream; | 0 |
2557 | } | - |
2558 | | - |
2559 | qint8 s; | - |
2560 | quint16 a, r, g, b, p; | - |
2561 | stream >> s; | - |
2562 | stream >> a; | - |
2563 | stream >> r; | - |
2564 | stream >> g; | - |
2565 | stream >> b; | - |
2566 | stream >> p; | - |
2567 | | - |
2568 | color.cspec = QColor::Spec(s); | - |
2569 | color.ct.argb.alpha = a; | - |
2570 | color.ct.argb.red = r; | - |
2571 | color.ct.argb.green = g; | - |
2572 | color.ct.argb.blue = b; | - |
2573 | color.ct.argb.pad = p; | - |
2574 | | - |
2575 | return stream; never executed: return stream; | 0 |
2576 | } | - |
2577 | #endif // QT_NO_DATASTREAM | - |
2578 | | - |
2579 | | - |
2580 | const uint qt_inv_premul_factor[256] = { | - |
2581 | 0, 16711935, 8355967, 5570645, 4177983, 3342387, 2785322, 2387419, | - |
2582 | 2088991, 1856881, 1671193, 1519266, 1392661, 1285533, 1193709, 1114129, | - |
2583 | 1044495, 983055, 928440, 879575, 835596, 795806, 759633, 726605, | - |
2584 | 696330, 668477, 642766, 618960, 596854, 576273, 557064, 539094, | - |
2585 | 522247, 506422, 491527, 477483, 464220, 451673, 439787, 428511, | - |
2586 | 417798, 407608, 397903, 388649, 379816, 371376, 363302, 355573, | - |
2587 | 348165, 341059, 334238, 327685, 321383, 315319, 309480, 303853, | - |
2588 | 298427, 293191, 288136, 283253, 278532, 273966, 269547, 265268, | - |
2589 | 261123, 257106, 253211, 249431, 245763, 242201, 238741, 235379, | - |
2590 | 232110, 228930, 225836, 222825, 219893, 217038, 214255, 211543, | - |
2591 | 208899, 206320, 203804, 201348, 198951, 196611, 194324, 192091, | - |
2592 | 189908, 187774, 185688, 183647, 181651, 179698, 177786, 175915, | - |
2593 | 174082, 172287, 170529, 168807, 167119, 165464, 163842, 162251, | - |
2594 | 160691, 159161, 157659, 156186, 154740, 153320, 151926, 150557, | - |
2595 | 149213, 147893, 146595, 145321, 144068, 142837, 141626, 140436, | - |
2596 | 139266, 138115, 136983, 135869, 134773, 133695, 132634, 131590, | - |
2597 | 130561, 129549, 128553, 127572, 126605, 125653, 124715, 123792, | - |
2598 | 122881, 121984, 121100, 120229, 119370, 118524, 117689, 116866, | - |
2599 | 116055, 115254, 114465, 113686, 112918, 112160, 111412, 110675, | - |
2600 | 109946, 109228, 108519, 107818, 107127, 106445, 105771, 105106, | - |
2601 | 104449, 103800, 103160, 102527, 101902, 101284, 100674, 100071, | - |
2602 | 99475, 98887, 98305, 97730, 97162, 96600, 96045, 95496, | - |
2603 | 94954, 94417, 93887, 93362, 92844, 92331, 91823, 91322, | - |
2604 | 90825, 90334, 89849, 89368, 88893, 88422, 87957, 87497, | - |
2605 | 87041, 86590, 86143, 85702, 85264, 84832, 84403, 83979, | - |
2606 | 83559, 83143, 82732, 82324, 81921, 81521, 81125, 80733, | - |
2607 | 80345, 79961, 79580, 79203, 78829, 78459, 78093, 77729, | - |
2608 | 77370, 77013, 76660, 76310, 75963, 75619, 75278, 74941, | - |
2609 | 74606, 74275, 73946, 73620, 73297, 72977, 72660, 72346, | - |
2610 | 72034, 71725, 71418, 71114, 70813, 70514, 70218, 69924, | - |
2611 | 69633, 69344, 69057, 68773, 68491, 68211, 67934, 67659, | - |
2612 | 67386, 67116, 66847, 66581, 66317, 66055, 65795, 65537 | - |
2613 | }; | - |
2614 | | - |
2615 | | - |
2616 | | - |
2617 | | - |
2618 | | - |
2619 | | - |
2620 | | - |
2621 | | - |
2622 | | - |
2623 | | - |
2624 | | - |
2625 | | - |
2626 | | - |
2627 | | - |
2628 | | - |
2629 | | - |
2630 | | - |
2631 | | - |
2632 | | - |
2633 | | - |
2634 | | - |
2635 | | - |
2636 | | - |
2637 | | - |
2638 | | - |
2639 | | - |
2640 | | - |
2641 | | - |
2642 | | - |
2643 | | - |
2644 | | - |
2645 | | - |
2646 | | - |
2647 | | - |
2648 | | - |
2649 | | - |
2650 | | - |
2651 | | - |
2652 | | - |
2653 | | - |
2654 | | - |
2655 | | - |
2656 | | - |
2657 | | - |
2658 | | - |
2659 | | - |
2660 | | - |
2661 | | - |
2662 | | - |
2663 | | - |
2664 | | - |
2665 | | - |
2666 | | - |
2667 | | - |
2668 | | - |
2669 | | - |
2670 | | - |
2671 | | - |
2672 | | - |
2673 | | - |
2674 | | - |
2675 | | - |
2676 | | - |
2677 | | - |
2678 | | - |
2679 | | - |
2680 | | - |
2681 | | - |
2682 | | - |
2683 | | - |
2684 | | - |
2685 | | - |
2686 | | - |
2687 | | - |
2688 | | - |
2689 | | - |
2690 | | - |
2691 | | - |
2692 | | - |
2693 | | - |
2694 | | - |
2695 | | - |
2696 | | - |
2697 | | - |
2698 | | - |
2699 | | - |
2700 | | - |
2701 | | - |
2702 | | - |
2703 | | - |
2704 | | - |
2705 | | - |
2706 | | - |
2707 | | - |
2708 | | - |
2709 | | - |
2710 | | - |
2711 | | - |
2712 | | - |
2713 | | - |
2714 | | - |
2715 | | - |
2716 | | - |
2717 | | - |
2718 | | - |
2719 | | - |
2720 | | - |
2721 | | - |
2722 | | - |
2723 | | - |
2724 | | - |
2725 | | - |
2726 | | - |
2727 | | - |
2728 | | - |
2729 | | - |
2730 | | - |
2731 | | - |
2732 | | - |
2733 | | - |
2734 | | - |
2735 | | - |
2736 | QT_END_NAMESPACE | - |
| | |