quick question

Everything else that doesn't fall into one of the other PB categories.
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

quick question

Post 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
~Dreglor
Codemonger
Enthusiast
Enthusiast
Posts: 384
Joined: Sat May 24, 2003 8:02 pm
Location: Canada
Contact:

Post 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 ?
<br>"I deliver Justice, not Mercy"

    - Codemonger, 2004 A.D.
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post 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...
~Dreglor
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post 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

Code: Select all

   | 0 1
---------
0 | 0 1
1 | 1 0
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.
Post Reply