Mintoris Forum

Author Topic: Xor Graphics  (Read 2111 times)

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Xor Graphics
« on: Nov 29, 2015, 03:32 AM »
I was bored today so I added XOR drawing to the Graphics mode. You just set a new optional parameter on the Color command. When XOR is set to 1 the color drawn will be XOR(ed) with the existing color. It'll be in the next release.

Color r,g,b{,alpha, xor}

Some of you will know what this function is used for. The exclusive or function (XOR) is a reversible binary operation. You can xor draw something to the screen and a contrasting color will result. Xor Draw the same thing in the same place again and you get the original image back. It's a great (cheap) way to make reversible changes to a graphic without erasing the entire screen. The contrasting color effect can also be useful if employed correctly.

hichame

  • Full Member
  • ***
  • Posts: 22
Re: Xor Graphics
« Reply #1 on: Mar 19, 2016, 11:35 PM »
hi
is this function also true for drawing a bitmap or just for colors?

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Xor Graphics
« Reply #2 on: Mar 20, 2016, 12:13 AM »
It will work on bitmaps as well as the screen. The colors are xor'd. The main feature of this mode is to make sure what you draw has a high contrast with the existing background without totally obscuring what is behind it. Like the cross hairs of a gun. Then you just draw it again on top of itself and the background is restored. It's a way of drawing a cursor on the screen without totally redrawing the screen. It's an old-old graphics trick. Experiment with it.

hichame

  • Full Member
  • ***
  • Posts: 22
Re: Xor Graphics
« Reply #3 on: Mar 20, 2016, 05:51 PM »
thank you
it is exactly what i expect.

WandaTog

  • Full Member
  • ***
  • Posts: 15
Xor Graphics
« Reply #4 on: Oct 30, 2019, 05:24 AM »
In my opinion you commit an error. I suggest it to discuss. Write to me in PM, we will communicate.