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.

Qt Code:
  1. QColor color;
  2. QPixmap input=*CurrObject->getImage(TypeValues[ComboBoxType->currentIndex()]);
  3. QImage image(input.size(), QImage::Format_ARGB32_Premultiplied);
  4. color=Qt::red;
  5. image.fill(color);
  6. QPainter p(&image);
  7. p.setOpacity(0.5);
  8. p.drawPixmap(0,0,input);
  9. p.end();
  10. QPixmap output = QPixmap::fromImage(image);
  11. ui->Label2D->setPixmap(output);
To copy to clipboard, switch view to plain text mode