- Online Community Forums » Programming Questions » Subtractive Blending

This thread is locked; no one can reply to it. rss feed Print
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
Member #8,592
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.


Go to: