19 #include <QApplication> 58 if (pmap.isNull())
return QIcon();
59 else return QIcon(pmap);
65 QColor bg = QApplication::palette().window().color();
66 if (bg.red() + bg.green() + bg.blue() > 384) {
67 QPixmap pmap(QString(
":icons/%1").arg(name));
69 pmap = QPixmap(QString(
":icons/%1.png").arg(name));
74 QPixmap pmap(QString(
":icons/%1").arg(name));
76 pmap = QPixmap(QString(
":icons/%1_inverse.png").arg(name));
78 pmap = QPixmap(QString(
":icons/%1.png").arg(name));
81 if (pmap.isNull())
return pmap;
93 QImage img = pmap.toImage().convertToFormat(QImage::Format_ARGB32);
95 for (
int y = 0; y < img.height(); ++y) {
96 for (
int x = 0; x < img.width(); ++x) {
98 QRgb rgba = img.pixel(x, y);
99 QColor colour = QColor
100 (qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba));
102 int alpha = colour.alpha();
103 if (colour.saturation() < 5 && colour.alpha() > 10) {
104 colour.setHsv(colour.hue(),
106 255 - colour.value());
107 colour.setAlpha(alpha);
108 img.setPixel(x, y, colour.rgba());
113 pmap = QPixmap::fromImage(img);
static const char * autoInvertExceptions[]
QPixmap loadPixmap(QString name)