| 109 | } |
| 110 | |
| 111 | QPixmap functionsGui::convertPixmap(QString pixmapPath) |
| 112 | { |
| 113 | QSettings settings; |
| 114 | QString themeName = settings.value("Theme", "Default").toString(); |
| 115 | |
| 116 | // Get the active and inactive colors |
| 117 | QStringList colors = functions::getThemeColors(themeName); |
| 118 | QRgb activeColor; |
| 119 | if (colors.size() == 4) |
| 120 | { |
| 121 | QColor active(colors[1]); |
| 122 | activeColor = active.rgb(); |
| 123 | } |
| 124 | else |
| 125 | activeColor = qRgb(0, 0, 0); |
| 126 | |
| 127 | QImage input(pixmapPath); |
| 128 | |
| 129 | QImage active(input.size(), input.format()); |
| 130 | for (int y = 0; y < input.height(); y++) |
| 131 | { |
| 132 | for (int x = 0; x < input.width(); x++) |
| 133 | { |
| 134 | QRgb in = input.pixel(x, y); |
| 135 | if (qAlpha(in) != 0) |
| 136 | active.setPixel(x, y, activeColor); |
| 137 | else |
| 138 | active.setPixel(x, y, in); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | return QPixmap::fromImage(active); |
| 143 | } |
| 144 | |
| 145 | QString functionsGui::pixelFormatToString(QImage::Format f) |
| 146 | { |
nothing calls this directly
no test coverage detected