
Originally Posted by
wysota
There is no QGuessWhatIWantAndDoIt class in Qt.
Sometimes I regret that there is no such class 
This code decrease saturation for each pixel:
img = pixmap.toImage();
int w = img.width();
int h = img.height();
for (int y = 0; y < h; ++y)
{
for(int x = 0; x < w; ++x)
{
QColor pixel
= img.
pixel(x, y
);
pixel.setHsl(pixel.hue(), 30, pixel.lightness(), pixel.alpha());
img.setPixel(x, y, pixel.rgba());
}
}
//return QPixmap::fromImage(img, Qt::AutoColor)
QImage img;
img = pixmap.toImage();
int w = img.width();
int h = img.height();
for (int y = 0; y < h; ++y)
{
for(int x = 0; x < w; ++x)
{
QColor pixel = img.pixel(x, y);
pixel.setHsl(pixel.hue(), 30, pixel.lightness(), pixel.alpha());
img.setPixel(x, y, pixel.rgba());
}
}
//return QPixmap::fromImage(img, Qt::AutoColor)
To copy to clipboard, switch view to plain text mode
What do you think, It is not too time-consuming process?
Bookmarks