My program generate 3 different images and I'd like to combine them using some opacity settings.
First I have the raw image, which I already converted into a QPixmap to display it in a QGraphicsView.
.
Then with this image I make some calculation and generate a QImage because I need basic pixel access, I also add a legend.
.
What I'd like to do is to be able to blend the two images while being able to modify the opacity. I don't have the tools to show an example, it should look like this:
But with the first image and the data image blended with opacity. Also I'd like the legend to stay 100% visible. I can create a different QImage for the legend if it's needed.
Also I know exactly which pixel should be considered transparent instead of white if it comes to that.
In the future I would like to adjust the opacity just with a slider so I think it would be better if there was a solution that didn't involve calculating a whole new image every-time...
Any lead would be appreciated...
You could use QGraphicsPixmapItem::setOpacity to set the alpha blend value in the range 0.0...1.0 for the overlay image and have separate graphics items for the background an the foreground.
If you actually need to generate a pixmap with the blended image, you can use setOpacity on QPainter before drawing the pixmap on it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With