KIconThemes

kiconeffect.cpp
1/*
2
3 This file is part of the KDE project, module kdecore.
4 SPDX-FileCopyrightText: 2000 Geert Jansen <jansen@kde.org>
5 SPDX-FileCopyrightText: 2007 Daniel M. Duley <daniel.duley@verizon.net>
6
7 with minor additions and based on ideas from
8 SPDX-FileContributor: Torsten Rahn <torsten@kde.org>
9
10 SPDX-License-Identifier: LGPL-2.0-only
11*/
12
13#include "kiconeffect.h"
14#include "debug.h"
15#include "kiconloader.h"
16
17#include <KColorScheme>
18
19#include <QDebug>
20#include <QPalette>
21#include <QSysInfo>
22
23#include <qplatformdefs.h>
24
25#include <math.h>
26
27class KIconEffectPrivate
28{
29public:
30 // http://en.cppreference.com/w/cpp/language/zero_initialization
31 KIconEffectPrivate()
32 : effect{{}}
33 , value{{}}
34 , trans{{}}
35 , key{{}}
36 {
37 }
38
39public:
44};
45
46#if KICONTHEMES_BUILD_DEPRECATED_SINCE(6, 5)
48 : d(new KIconEffectPrivate)
49{
50 init();
51}
52#endif
53
54KIconEffect::~KIconEffect() = default;
55
56#if KICONTHEMES_BUILD_DEPRECATED_SINCE(6, 5)
58{
59 int i;
60 // FIXME: this really should be using KIconLoader::metaObject() to guarantee synchronization
61 // performance wise it's also practically guaranteed to be faster
62 QStringList groups;
63 groups += QStringLiteral("Desktop");
64 groups += QStringLiteral("Toolbar");
65 groups += QStringLiteral("MainToolbar");
66 groups += QStringLiteral("Small");
67 groups += QStringLiteral("Panel");
68 groups += QStringLiteral("Dialog");
69
70 QStringList states;
71 states += QStringLiteral("Default");
72 states += QStringLiteral("Active");
73 states += QStringLiteral("Disabled");
74
76
77 for (it = groups.constBegin(), i = 0; it != groups.constEnd(); ++it, ++i) {
78 d->effect[i][KIconLoader::DefaultState] = NoEffect;
79 d->effect[i][KIconLoader::ActiveState] = ((i == KIconLoader::Desktop) || (KIconLoader::Panel == 4)) ? ToGamma : NoEffect;
80 d->effect[i][KIconLoader::DisabledState] = ToGray;
81
82 d->trans[i][KIconLoader::DefaultState] = false;
83 d->trans[i][KIconLoader::ActiveState] = false;
84 d->trans[i][KIconLoader::DisabledState] = true;
85 d->value[i][KIconLoader::DefaultState] = 1.0;
86 d->value[i][KIconLoader::ActiveState] = ((i == KIconLoader::Desktop) || (KIconLoader::Panel == 4)) ? 0.7 : 1.0;
87 d->value[i][KIconLoader::DisabledState] = 1.0;
88 }
89}
90#endif
91
92#if KICONTHEMES_BUILD_DEPRECATED_SINCE(6, 5)
93bool KIconEffect::hasEffect(int group, int state) const
94{
95 if (group < 0 || group >= KIconLoader::LastGroup //
96 || state < 0 || state >= KIconLoader::LastState) {
97 return false;
98 }
99
100 return d->effect[group][state] != NoEffect;
101}
102#endif
103
104#if KICONTHEMES_BUILD_DEPRECATED_SINCE(6, 5)
105QString KIconEffect::fingerprint(int group, int state) const
106{
107 if (group < 0 || group >= KIconLoader::LastGroup //
108 || state < 0 || state >= KIconLoader::LastState) {
109 return QString();
110 }
111
112 QString cached = d->key[group][state];
113 if (cached.isEmpty()) {
114 QString tmp;
115 cached = tmp.setNum(d->effect[group][state]);
116 cached += QLatin1Char(':');
117 cached += tmp.setNum(d->value[group][state]);
118 cached += QLatin1Char(':');
119 cached += d->trans[group][state] ? QLatin1String("trans") : QLatin1String("notrans");
120
121 d->key[group][state] = cached;
122 }
123
124 return cached;
125}
126#endif
127
128#if KICONTHEMES_BUILD_DEPRECATED_SINCE(6, 5)
129QImage KIconEffect::apply(const QImage &image, int group, int state) const
130{
131 if (state >= KIconLoader::LastState) {
132 qCWarning(KICONTHEMES) << "Invalid icon state:" << state << ", should be one of KIconLoader::States";
133 return image;
134 }
135 if (group >= KIconLoader::LastGroup) {
136 qCWarning(KICONTHEMES) << "Invalid icon group:" << group << ", should be one of KIconLoader::Group";
137 return image;
138 }
139 return apply(image, d->effect[group][state], d->value[group][state], QColor(), QColor(), d->trans[group][state]);
140}
141#endif
142
143#if KICONTHEMES_BUILD_DEPRECATED_SINCE(6, 5)
144QImage KIconEffect::apply(const QImage &image, int effect, float value, const QColor &col, bool trans) const
145{
146 return apply(image, effect, value, col, KColorScheme(QPalette::Active, KColorScheme::View).background().color(), trans);
147}
148#endif
149
150#if KICONTHEMES_BUILD_DEPRECATED_SINCE(6, 5)
151QImage KIconEffect::apply(const QImage &img, int effect, float value, const QColor &col, const QColor &col2, bool trans) const
152{
153 QImage image = img;
154 if (effect >= LastEffect) {
155 qCWarning(KICONTHEMES) << "Invalid icon effect:" << effect << ", should be one of KIconLoader::Effects";
156 return image;
157 }
158 if (value > 1.0) {
159 value = 1.0;
160 } else if (value < 0.0) {
161 value = 0.0;
162 }
163 switch (effect) {
164 case ToGray:
165 toGray(image, value);
166 break;
167 case DeSaturate:
168 deSaturate(image, value);
169 break;
170 case Colorize:
171 colorize(image, col, value);
172 break;
173 case ToGamma:
174 toGamma(image, value);
175 break;
176 case ToMonochrome:
177 toMonochrome(image, col, col2, value);
178 break;
179 }
180 if (trans == true) {
181 semiTransparent(image);
182 }
183 return image;
184}
185#endif
186
187#if KICONTHEMES_BUILD_DEPRECATED_SINCE(6, 5)
188QPixmap KIconEffect::apply(const QPixmap &pixmap, int group, int state) const
189{
190 if (state >= KIconLoader::LastState) {
191 qCWarning(KICONTHEMES) << "Invalid icon state:" << state << ", should be one of KIconLoader::States";
192 return pixmap;
193 }
194 if (group >= KIconLoader::LastGroup) {
195 qCWarning(KICONTHEMES) << "Invalid icon group:" << group << ", should be one of KIconLoader::Group";
196 return pixmap;
197 }
198 return apply(pixmap, d->effect[group][state], d->value[group][state], QColor(), QColor(), d->trans[group][state]);
199}
200#endif
201
202#if KICONTHEMES_BUILD_DEPRECATED_SINCE(6, 5)
203QPixmap KIconEffect::apply(const QPixmap &pixmap, int effect, float value, const QColor &col, bool trans) const
204{
205 return apply(pixmap, effect, value, col, KColorScheme(QPalette::Active, KColorScheme::View).background().color(), trans);
206}
207#endif
208
209#if KICONTHEMES_BUILD_DEPRECATED_SINCE(6, 5)
210QPixmap KIconEffect::apply(const QPixmap &pixmap, int effect, float value, const QColor &col, const QColor &col2, bool trans) const
211{
212 QPixmap result;
213
214 if (effect >= LastEffect) {
215 qCWarning(KICONTHEMES) << "Invalid icon effect:" << effect << ", should be one of KIconLoader::Effects";
216 return result;
217 }
218
219 if ((trans == true) && (effect == NoEffect)) {
220 result = pixmap;
221 semiTransparent(result);
222 } else if (effect != NoEffect) {
223 QImage tmpImg = pixmap.toImage();
224 tmpImg = apply(tmpImg, effect, value, col, col2, trans);
225 result = QPixmap::fromImage(std::move(tmpImg));
226 } else {
227 result = pixmap;
228 }
229
230 return result;
231}
232#endif
233
234struct KIEImgEdit {
235 QImage &img;
236 QList<QRgb> colors;
237 unsigned int *data;
238 unsigned int pixels;
239
240 KIEImgEdit(QImage &_img)
241 : img(_img)
242 {
243 if (img.depth() > 8) {
244 // Code using data and pixels assumes that the pixels are stored
245 // in 32bit values and that the image is not premultiplied
246 if ((img.format() != QImage::Format_ARGB32) //
247 && (img.format() != QImage::Format_RGB32)) {
248 img.convertTo(QImage::Format_ARGB32);
249 }
250 data = (unsigned int *)img.bits();
251 pixels = img.width() * img.height();
252 } else {
253 pixels = img.colorCount();
254 colors = img.colorTable();
255 data = (unsigned int *)colors.data();
256 }
257 }
258
259 ~KIEImgEdit()
260 {
261 if (img.depth() <= 8) {
262 img.setColorTable(colors);
263 }
264 }
265
266 KIEImgEdit(const KIEImgEdit &) = delete;
267 KIEImgEdit &operator=(const KIEImgEdit &) = delete;
268};
269
270// Taken from KImageEffect. We don't want to link kdecore to kdeui! As long
271// as this code is not too big, it doesn't seem much of a problem to me.
272
273void KIconEffect::toGray(QImage &img, float value)
274{
275 if (value == 0.0) {
276 return;
277 }
278
279 KIEImgEdit ii(img);
280 QRgb *data = ii.data;
281 QRgb *end = data + ii.pixels;
282
283 unsigned char gray;
284 if (value == 1.0) {
285 while (data != end) {
286 gray = qGray(*data);
287 *data = qRgba(gray, gray, gray, qAlpha(*data));
288 ++data;
289 }
290 } else {
291 unsigned char val = (unsigned char)(255.0 * value);
292 while (data != end) {
293 gray = qGray(*data);
294 *data = qRgba((val * gray + (0xFF - val) * qRed(*data)) >> 8,
295 (val * gray + (0xFF - val) * qGreen(*data)) >> 8,
296 (val * gray + (0xFF - val) * qBlue(*data)) >> 8,
297 qAlpha(*data));
298 ++data;
299 }
300 }
301}
302
303void KIconEffect::colorize(QImage &img, const QColor &col, float value)
304{
305 if (value == 0.0) {
306 return;
307 }
308
309 KIEImgEdit ii(img);
310 QRgb *data = ii.data;
311 QRgb *end = data + ii.pixels;
312
313 float rcol = col.red();
314 float gcol = col.green();
315 float bcol = col.blue();
316 unsigned char red;
317 unsigned char green;
318 unsigned char blue;
319 unsigned char gray;
320 unsigned char val = (unsigned char)(255.0 * value);
321 while (data != end) {
322 gray = qGray(*data);
323 if (gray < 128) {
324 red = static_cast<unsigned char>(rcol / 128 * gray);
325 green = static_cast<unsigned char>(gcol / 128 * gray);
326 blue = static_cast<unsigned char>(bcol / 128 * gray);
327 } else if (gray > 128) {
328 red = static_cast<unsigned char>((gray - 128) * (2 - rcol / 128) + rcol - 1);
329 green = static_cast<unsigned char>((gray - 128) * (2 - gcol / 128) + gcol - 1);
330 blue = static_cast<unsigned char>((gray - 128) * (2 - bcol / 128) + bcol - 1);
331 } else {
332 red = static_cast<unsigned char>(rcol);
333 green = static_cast<unsigned char>(gcol);
334 blue = static_cast<unsigned char>(bcol);
335 }
336
337 *data = qRgba((val * red + (0xFF - val) * qRed(*data)) >> 8,
338 (val * green + (0xFF - val) * qGreen(*data)) >> 8,
339 (val * blue + (0xFF - val) * qBlue(*data)) >> 8,
340 qAlpha(*data));
341 ++data;
342 }
343}
344
345void KIconEffect::toMonochrome(QImage &img, const QColor &black, const QColor &white, float value)
346{
347 if (value == 0.0) {
348 return;
349 }
350
351 KIEImgEdit ii(img);
352 QRgb *data = ii.data;
353 QRgb *end = data + ii.pixels;
354
355 // Step 1: determine the average brightness
356 double values = 0.0;
357 double sum = 0.0;
358 bool grayscale = true;
359 while (data != end) {
360 sum += qGray(*data) * qAlpha(*data) + 255 * (255 - qAlpha(*data));
361 values += 255;
362 if ((qRed(*data) != qGreen(*data)) || (qGreen(*data) != qBlue(*data))) {
363 grayscale = false;
364 }
365 ++data;
366 }
367 double medium = sum / values;
368
369 // Step 2: Modify the image
370 unsigned char val = (unsigned char)(255.0 * value);
371 int rw = white.red();
372 int gw = white.green();
373 int bw = white.blue();
374 int rb = black.red();
375 int gb = black.green();
376 int bb = black.blue();
377 data = ii.data;
378
379 if (grayscale) {
380 while (data != end) {
381 if (qRed(*data) <= medium) {
382 *data = qRgba((val * rb + (0xFF - val) * qRed(*data)) >> 8,
383 (val * gb + (0xFF - val) * qGreen(*data)) >> 8,
384 (val * bb + (0xFF - val) * qBlue(*data)) >> 8,
385 qAlpha(*data));
386 } else {
387 *data = qRgba((val * rw + (0xFF - val) * qRed(*data)) >> 8,
388 (val * gw + (0xFF - val) * qGreen(*data)) >> 8,
389 (val * bw + (0xFF - val) * qBlue(*data)) >> 8,
390 qAlpha(*data));
391 }
392 ++data;
393 }
394 } else {
395 while (data != end) {
396 if (qGray(*data) <= medium) {
397 *data = qRgba((val * rb + (0xFF - val) * qRed(*data)) >> 8,
398 (val * gb + (0xFF - val) * qGreen(*data)) >> 8,
399 (val * bb + (0xFF - val) * qBlue(*data)) >> 8,
400 qAlpha(*data));
401 } else {
402 *data = qRgba((val * rw + (0xFF - val) * qRed(*data)) >> 8,
403 (val * gw + (0xFF - val) * qGreen(*data)) >> 8,
404 (val * bw + (0xFF - val) * qBlue(*data)) >> 8,
405 qAlpha(*data));
406 }
407 ++data;
408 }
409 }
410}
411
412void KIconEffect::deSaturate(QImage &img, float value)
413{
414 if (value == 0.0) {
415 return;
416 }
417
418 KIEImgEdit ii(img);
419 QRgb *data = ii.data;
420 QRgb *end = data + ii.pixels;
421
422 QColor color;
423 int h;
424 int s;
425 int v;
426 while (data != end) {
427 color.setRgb(*data);
428 color.getHsv(&h, &s, &v);
429 color.setHsv(h, (int)(s * (1.0 - value) + 0.5), v);
430 *data = qRgba(color.red(), color.green(), color.blue(), qAlpha(*data));
431 ++data;
432 }
433}
434
435void KIconEffect::toGamma(QImage &img, float value)
436{
437 KIEImgEdit ii(img);
438 QRgb *data = ii.data;
439 QRgb *end = data + ii.pixels;
440
441 float gamma = 1 / (2 * value + 0.5);
442 while (data != end) {
443 *data = qRgba(static_cast<unsigned char>(pow(static_cast<float>(qRed(*data)) / 255, gamma) * 255),
444 static_cast<unsigned char>(pow(static_cast<float>(qGreen(*data)) / 255, gamma) * 255),
445 static_cast<unsigned char>(pow(static_cast<float>(qBlue(*data)) / 255, gamma) * 255),
446 qAlpha(*data));
447 ++data;
448 }
449}
450
452{
453 if (img.depth() == 32) {
456 }
457 int width = img.width();
458 int height = img.height();
459
460 unsigned char *line;
461 for (int y = 0; y < height; ++y) {
463 line = img.scanLine(y);
464 } else {
465 line = img.scanLine(y) + 3;
466 }
467 for (int x = 0; x < width; ++x) {
468 *line >>= 1;
469 line += 4;
470 }
471 }
472 } else if (img.depth() == 8) {
473 // not running on 8 bit, we can safely install a new colorTable
474 QList<QRgb> colorTable = img.colorTable();
475 for (int i = 0; i < colorTable.size(); ++i) {
476 colorTable[i] = (colorTable[i] & 0x00ffffff) | ((colorTable[i] & 0xfe000000) >> 1);
477 }
478 img.setColorTable(colorTable);
479 } else {
480 // Insert transparent pixel into the clut.
481 int transColor = -1;
482
483 // search for a color that is already transparent
484 for (int x = 0; x < img.colorCount(); ++x) {
485 // try to find already transparent pixel
486 if (qAlpha(img.color(x)) < 127) {
487 transColor = x;
488 break;
489 }
490 }
491
492 // FIXME: image must have transparency
493 if (transColor < 0 || transColor >= img.colorCount()) {
494 return;
495 }
496
497 img.setColor(transColor, 0);
498 unsigned char *line;
499 if (img.depth() == 8) {
500 for (int y = 0; y < img.height(); ++y) {
501 line = img.scanLine(y);
502 for (int x = (y % 2); x < img.width(); x += 2) {
503 line[x] = transColor;
504 }
505 }
506 } else {
507 const bool setOn = (transColor != 0);
508 if (img.format() == QImage::Format_MonoLSB) {
509 for (int y = 0; y < img.height(); ++y) {
510 line = img.scanLine(y);
511 for (int x = (y % 2); x < img.width(); x += 2) {
512 if (!setOn) {
513 *(line + (x >> 3)) &= ~(1 << (x & 7));
514 } else {
515 *(line + (x >> 3)) |= (1 << (x & 7));
516 }
517 }
518 }
519 } else {
520 for (int y = 0; y < img.height(); ++y) {
521 line = img.scanLine(y);
522 for (int x = (y % 2); x < img.width(); x += 2) {
523 if (!setOn) {
524 *(line + (x >> 3)) &= ~(1 << (7 - (x & 7)));
525 } else {
526 *(line + (x >> 3)) |= (1 << (7 - (x & 7)));
527 }
528 }
529 }
530 }
531 }
532 }
533}
534
536{
537 QImage img = pix.toImage();
538 semiTransparent(img);
539 pix = QPixmap::fromImage(img);
540}
541
543{
544 int w = src.width();
545 int h = src.height();
546
547 QImage dst(w * 2, h * 2, src.format());
548
549 if (src.depth() == 1) {
550 qWarning() << "image depth 1 not supported";
551 return QImage();
552 }
553
554 int x;
555 int y;
556 if (src.depth() == 32) {
557 QRgb *l1;
558 QRgb *l2;
559 for (y = 0; y < h; ++y) {
560 l1 = (QRgb *)src.scanLine(y);
561 l2 = (QRgb *)dst.scanLine(y * 2);
562 for (x = 0; x < w; ++x) {
563 l2[x * 2] = l2[x * 2 + 1] = l1[x];
564 }
565 memcpy(dst.scanLine(y * 2 + 1), l2, dst.bytesPerLine());
566 }
567 } else {
568 for (x = 0; x < src.colorCount(); ++x) {
569 dst.setColor(x, src.color(x));
570 }
571
572 const unsigned char *l1;
573 unsigned char *l2;
574 for (y = 0; y < h; ++y) {
575 l1 = src.scanLine(y);
576 l2 = dst.scanLine(y * 2);
577 for (x = 0; x < w; ++x) {
578 l2[x * 2] = l1[x];
579 l2[x * 2 + 1] = l1[x];
580 }
581 memcpy(dst.scanLine(y * 2 + 1), l2, dst.bytesPerLine());
582 }
583 }
584 return dst;
585}
586
588{
589 if (src.depth() != overlay.depth()) {
590 qWarning() << "Image depth src (" << src.depth() << ") != overlay "
591 << "(" << overlay.depth() << ")!";
592 return;
593 }
594 if (src.size() != overlay.size()) {
595 qWarning() << "Image size src != overlay";
596 return;
597 }
600 }
601
602 if (overlay.format() == QImage::Format_RGB32) {
603 qWarning() << "Overlay doesn't have alpha buffer!";
604 return;
605 } else if (overlay.format() == QImage::Format_ARGB32_Premultiplied) {
607 }
608
609 int i;
610 int j;
611
612 // We don't do 1 bpp
613
614 if (src.depth() == 1) {
615 qWarning() << "1bpp not supported!";
616 return;
617 }
618
619 // Overlay at 8 bpp doesn't use alpha blending
620
621 if (src.depth() == 8) {
622 if (src.colorCount() + overlay.colorCount() > 255) {
623 qWarning() << "Too many colors in src + overlay!";
624 return;
625 }
626
627 // Find transparent pixel in overlay
628 int trans;
629 for (trans = 0; trans < overlay.colorCount(); trans++) {
630 if (qAlpha(overlay.color(trans)) == 0) {
631 qWarning() << "transparent pixel found at " << trans;
632 break;
633 }
634 }
635 if (trans == overlay.colorCount()) {
636 qWarning() << "transparent pixel not found!";
637 return;
638 }
639
640 // Merge color tables
641 int nc = src.colorCount();
642 src.setColorCount(nc + overlay.colorCount());
643 for (i = 0; i < overlay.colorCount(); ++i) {
644 src.setColor(nc + i, overlay.color(i));
645 }
646
647 // Overwrite nontransparent pixels.
648 unsigned char *oline;
649 unsigned char *sline;
650 for (i = 0; i < src.height(); ++i) {
651 oline = overlay.scanLine(i);
652 sline = src.scanLine(i);
653 for (j = 0; j < src.width(); ++j) {
654 if (oline[j] != trans) {
655 sline[j] = oline[j] + nc;
656 }
657 }
658 }
659 }
660
661 // Overlay at 32 bpp does use alpha blending
662
663 if (src.depth() == 32) {
664 QRgb *oline;
665 QRgb *sline;
666 int r1;
667 int g1;
668 int b1;
669 int a1;
670 int r2;
671 int g2;
672 int b2;
673 int a2;
674
675 for (i = 0; i < src.height(); ++i) {
676 oline = (QRgb *)overlay.scanLine(i);
677 sline = (QRgb *)src.scanLine(i);
678
679 for (j = 0; j < src.width(); ++j) {
680 r1 = qRed(oline[j]);
681 g1 = qGreen(oline[j]);
682 b1 = qBlue(oline[j]);
683 a1 = qAlpha(oline[j]);
684
685 r2 = qRed(sline[j]);
686 g2 = qGreen(sline[j]);
687 b2 = qBlue(sline[j]);
688 a2 = qAlpha(sline[j]);
689
690 r2 = (a1 * r1 + (0xff - a1) * r2) >> 8;
691 g2 = (a1 * g1 + (0xff - a1) * g2) >> 8;
692 b2 = (a1 * b1 + (0xff - a1) * b2) >> 8;
693 a2 = qMax(a1, a2);
694
695 sline[j] = qRgba(r2, g2, b2, a2);
696 }
697 }
698 }
699}
700
702{
703 KIconEffect::toGray(image, 1);
705}
706
708{
709 QImage img = pixmap.toImage();
710 toDisabled(img);
711 pixmap = QPixmap::fromImage(img);
712}
713
715{
716 KIconEffect::toGamma(image, 0.7);
717}
718
720{
721 QImage img = pixmap.toImage();
722 KIconEffect::toGamma(img, 0.7);
723 pixmap = QPixmap::fromImage(img);
724}
QString fingerprint(int group, int state) const
Returns a fingerprint for the effect by encoding the given group and state into a QString.
static void toDisabled(QImage &image)
Applies a disabled effect.
static void overlay(QImage &src, QImage &overlay)
Overlays an image with an other image.
QImage doublePixels(const QImage &src) const
Returns an image twice as large, consisting of 2x2 pixels.
static void toGray(QImage &image, float value)
Tints an image gray.
static void colorize(QImage &image, const QColor &col, float value)
Colorizes an image with a specific color.
static void toActive(QImage &image)
Applies an effect for an icon that is in an 'active' state.
void init()
Rereads configuration.
static void semiTransparent(QImage &image)
Renders an image semi-transparent.
KIconEffect()
Create a new KIconEffect.
static void toGamma(QImage &image, float value)
Changes the gamma value of an image.
static void toMonochrome(QImage &image, const QColor &black, const QColor &white, float value)
Produces a monochrome icon with a given foreground and background color.
bool hasEffect(int group, int state) const
Tests whether an effect has been configured for the given icon group.
QImage apply(const QImage &src, int group, int state) const
Applies an effect to an image.
static void deSaturate(QImage &image, float value)
Desaturates an image.
@ Panel
Panel (Plasma Taskbar) icons.
@ LastGroup
Last group.
@ Desktop
Desktop icons.
@ ActiveState
Icon is active.
@ DisabledState
Icon is disabled.
@ LastState
Last state (last constant)
@ DefaultState
The default state.
int blue() const const
void getHsv(int *h, int *s, int *v, int *a) const const
int green() const const
int red() const const
void setHsv(int h, int s, int v, int a)
void setRgb(QRgb rgb)
Format_ARGB32_Premultiplied
uchar * bits()
qsizetype bytesPerLine() const const
QRgb color(int i) const const
int colorCount() const const
QList< QRgb > colorTable() const const
void convertTo(Format format, Qt::ImageConversionFlags flags)
int depth() const const
Format format() const const
int height() const const
uchar * scanLine(int i)
void setColor(int index, QRgb colorValue)
void setColorCount(int colorCount)
void setColorTable(const QList< QRgb > &colors)
QSize size() const const
int width() const const
const_iterator constBegin() const const
const_iterator constEnd() const const
pointer data()
qsizetype size() const const
QPixmap fromImage(QImage &&image, Qt::ImageConversionFlags flags)
QImage toImage() const const
bool isEmpty() const const
QString & setNum(double n, char format, int precision)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.