Reputation: 7603
I have a single-color transparent PNG loaded with a QPixmap, I want to draw this pixmap multiple times using different colors (e.g. once green, another yellow, etc). These QPixmaps are rendered through QPainter in the paintEvent function of a QWidget.
Upvotes: 2
Views: 762
Reputation: 1406
you can convert the pixmap into qimage and paint your own color .
1- Use QImage::fill(DesiredColor)
2- QPaintDevice supports QImage so use QPainter painter(&qImage); // 8 bit will not support in paint event .
then recreate QPixmap with image using QPixmap::fromImage(qImage);
Upvotes: 0