MCPcopy Create free account
hub / github.com/IENT/YUView / convertPixmap

Method convertPixmap

YUViewLib/src/common/FunctionsGui.cpp:111–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111QPixmap 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
145QString functionsGui::pixelFormatToString(QImage::Format f)
146{

Callers

nothing calls this directly

Calls 3

getThemeColorsFunction · 0.85
toStringMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected