Good morning,
I have to color an image white without touching a specific internal area (an internal QRect contained in the image).
How can I do it?
Printable View
Good morning,
I have to color an image white without touching a specific internal area (an internal QRect contained in the image).
How can I do it?
Copy the QRect region to a separate QImage (QImage::copy()), fill the original image with white (QImage::fill()), then use QPainter::drawImage() to copy the saved image back into place.
You could also use clipping to define a clip path that excludes the rectangle (QPainter::setClipPath()) and then use QPainter::fillRect() to set the remainder to white. This will let you exclude non-rectangular regions, but it will probably be harder to get right.