There is a pen/brush mode to do that ?
TPenMode has
pmXor, which will invert any underlying colors when setting the pen to white (since
(B xor $FF) = (not B) = (255 - B) when
B is a byte, e.g. an RGB channel). I'm not aware of any similiar functionality for
TFont, though.
You could also draw the text white-on-black into some reserved area and call
TCanvas.CopyRect with
TCanvas.CopyMode set to
cmSrcInvert, which has the same XOR effect.
Personally, when I have to draw text over an arbitrarily colored background such as a photo, I prefer using black/white text with a white/black border (respectively), but that's not easy to accomplish when using
TCanvas.