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?
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?
Franco Amato
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.
Last edited by d_stranz; 6th October 2022 at 17:50.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
Bookmarks