I have a Graphics created on an Image, like this
Graphics g (image);
how do I clear a rectangle inside the Graphics, so that all the pixels in the area are replaced with Colours::transparentBlack, for example.
I have tried this:
but that does nothing (which has some kind of sense, as I am asking the Graphics to paint that rectangle with a dry brush, so to say, thus no pixels in that area change).
I have also tried this:
image.clear (myArea, Colours::transparentBlack);
which seemed more appropriate to actually replace the content of the area, but that’s not good either: turns out the implementation of that method does exactly the same steps above with fillRect.
I think that correcting the behaviour of Image::clear() now could break some existing code (despite it’s actually not-so-formally-correct), so what about adding a Graphics::clear() method that does what expected? Or maybe name it fillReplacing if you feel it’s more appropriate