Page 1 of 1
quick question
Posted: Thu Dec 04, 2003 3:51 am
by Dreglor
in drawing mode 2 it says current "all graphics are XOR'ed with current background"
right now i not sure what that means and how it will look when it draw
Posted: Thu Dec 04, 2003 4:33 am
by Codemonger
When you redraw an XOR image onto itself, the outcome is it returns the pixels to their original state. So you can draw an image XOR onto something and then redraw the image using XOR and effectively putting the pixels back to normal. This is what your mouse uses, I think ?
Posted: Sun Dec 07, 2003 9:02 pm
by Dreglor
so what your saying is that it draws in reverse?
i don't know i do some experamenting to see for my self
edit: i did my testing as far as i can tell the color is XOR'ed with the current backround so i firgured it out, but i not sure what it would be used for...
Posted: Sun Dec 07, 2003 9:23 pm
by freedimension
Now, all XOR does is set a bit where only one bit was set, either in the first or in the second input.
See this table
Now an example:
Code: Select all
10110111 XOR
11011101 <- we will use this one again
-----------
01101010 Result
01101010 XOR <- The Result from above
11011101 <- With the second input from above
-----------
10110111 <- Results in the first input from above
So when drawing exactly the same twice in XOR Mode, it looks like nothing has been done at all.
Edit: This is widely used, for example in drawing rubberbands (selection boxes) in nonbuffered gfx applications (with the widespread of newer Graphiccards there's no point in doing this anymore) and if you want to draw something that should be visible in 99% of all cases, no matter what background you use. A Box, for example, would look black on a white background and white on a black one. Only problem here, when you have a middle grey near rgb(128,128,128) you would see almost nothing.