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
Graphics contexts can only paint over existing content, but Image::clear will certainly be able to clear a chunk of an image in the way you’re asking for.
Oh… yes, I see it now, it’s that nasty “/ 2” that makes it 1 / 2 = 0.
Hmm one more thought about this, though: if integers are valid arguments for the * and / operators, what about changing their template typename to a generic Type rather than FloatType?
Yeah, what I meant is: since the scale factor can also be an integer after these changes, what’s the point of calling its template type “FloatType”? It’s kinda misleading now since I now can divide a Rectangle by an integer constant and have its coordinates all divived as expected (according to integer division rules)