Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » XOR drawing mode

This thread is locked; no one can reply to it. rss feed Print
XOR drawing mode
crexalbo
Member #15,035
April 2013

I am looking to enable XOR drawing mode with Allegro 5. I have found the al_set_blender function, but i do not see any sort of XOR drawing mode it can use; only ADD, SRC_MINUS_DEST, and DEST_MINUS_SRC. Is there a way to use these existing drawing modes to implement XOR?

My ultimate goal is i want to negate pixels in a certain area of the screen. So, for example, if the pixel's color is originally <0.2, 0.9, 0.6>, then i want its new color after the drawing operation to be <0.8, 0.1, 0.4>.

Arthur Kalliokoski
Second in Command
February 2005
avatar

If you're using OpenGL, it looks like

glEnable(GL_BLEND);
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);

would work, otherwise I'd think you have to use shaders.

They all watch too much MSNBC... they get ideas.

SiegeLord
Member #7,827
October 2006
avatar

I imagine doing something like this would work al_set_blender(ALLEGRO_ADD, ALLEGRO_INVERSE_DEST_COLOR, ALLEGRO_ZERO) in conjunction with something white being drawn.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: