There have been a couple of times recently where I've wanted to invert the colour of text or a line based on what it's drawing over the top of. I can't figure out how to do it though ... any bright ideas?
There have been a couple of times recently where I've wanted to invert the colour of text or a line based on what it's drawing over the top of. I can't figure out how to do it though ... any bright ideas?
If you're talking about an old 1990s-style XOR mode, then nope, that's not supported and it's generally considered to be a bad way to do things nowadays, for various reasons.
The best way to draw the bar you've got above would be to use the clip region: i.e. fill the whole thing in back, drawing the text in white. Then clip the graphics context to the area of your green block, then fill the entire area in green, and draw the text again in black.
Nothing elegant, but a couple of suggestions for hacks:
The clip solution sounds good.
And yes, I was thinking of the cheap, energy efficent 1990s solution (.... dreaming of the days when it was just a case of copying things into the graphics RAM pages....)