hi
i have a pixmap from a png picture
now i want to paint all pixels of this pixmap more red or blue for example, but ignore the background
i tried to createmaskfromcolor function but it doesnt work.
with setting the opacity i get the desired effect but the white background is also drawn in red.
QPixmap input
=*CurrObject
->getImage
(TypeValues
[ComboBoxType
->currentIndex
()]);
QImage image
(input.
size(),
QImage::Format_ARGB32_Premultiplied);
color=Qt::red;
image.fill(color);
p.setOpacity(0.5);
p.drawPixmap(0,0,input);
p.end();
ui->Label2D->setPixmap(output);
QColor color;
QPixmap input=*CurrObject->getImage(TypeValues[ComboBoxType->currentIndex()]);
QImage image(input.size(), QImage::Format_ARGB32_Premultiplied);
color=Qt::red;
image.fill(color);
QPainter p(&image);
p.setOpacity(0.5);
p.drawPixmap(0,0,input);
p.end();
QPixmap output = QPixmap::fromImage(image);
ui->Label2D->setPixmap(output);
To copy to clipboard, switch view to plain text mode
Bookmarks