![]() |
|
Subtractive Blending |
Michael Moffitt
Member #15,246
July 2013
|
Hi everyone, I've played around with Allegro's blending mode parameters, but I'm not sure I am exploring as fully as I could be to get this desired effect. Basically, let's say I have a bitmap already drawn called A. I have another bitmap, B, which has not yet been drawn. When I draw B on top of A, I want the result to be A - B, with all negative values clamped to zero. In reality, A represents a buffer to which I am blitting most of the game. For the final image B, I want that one to be blended with subtractive blending while the others are all normal. Is this something that can be done without massive complication? |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
See al_set_blender and al_set_separate_blender. I think this will do what you want. Not sure about clamping negative values though, but it probably does. al_set_blender(ALLEGRO_DEST_MINUS_SRC , ALLEGRO_ONE , ALLEGRO_ONE);
My Website! [members.allegro.cc] | EAGLE GUI Library Demos [members.allegro.cc] | My Deviant Art Gallery [nemonameless.deviantart.com] | Spiraloid Preview [members.allegro.cc] | A4 FontMaker | Skyline! (Missile Defense) [members.allegro.cc] Eagle and Allegro 5 binaries [github.com] | Older Allegro 4 and 5 binaries [bitbucket.org] | Allegro 5 compile guide [members.allegro.cc] |
|