What makes Graphics.setXORMode (Color) in simple terms?
Here's what I've read about it, but can't figure out exactly what it does:
One way to implement a rubber band is to paint in XOR mode. You set the XOR by calling the setXORMode () method on the graphics context and passing a color to it - usually the background color. In this mode, pixels are not written directly to the screen. The color you paint in combined with the pixel color is currently displayed along with a third color you specify by exclusive ORing them together and the resulting pixel color is written to the screen. The third color is usually set as the background color, so the color of the written pixel is the result of the following operation:
resultant_Color = foreground_color^background_color^current_color
I know how XORing works, but I don't know what the above paragraph means. Please figure it out for me.
source to share
It takes a color and applies an XOR mask just like a normal XOR would be a bitmask, except it is in RGB colors, so it produces the color you pass in if it overlays a color with the same values ββor inverts RGB colors and the color below its RGB if the values ββare different.
Just write some code and give it a try and you can see what's going on immediately.
source to share