Subtractive Alphablending?

Is there a way to do Subtractive and Addictive Alphablending at the same time.
aka Source alpha and Destinaction alpha.

It would be nice when some one can implement it to SDL.

Is there a way to do Subtractive and Addictive Alphablending at the
same time.

Uhm… AFAIK, subtractive blending is one method, additive another,
and alpha a third method. To me, “additive alphablending” sounds like
"additive multiplication" or something. :slight_smile:

aka Source alpha and Destinaction alpha.

This makes some sense, though.

However, SDL supports only source alpha blending; that is, the source
alpha channel (or full surface alpha parameter) modulates the
source/destination balance.

I guess you’re trying to combine RGBA surfaces, to generate
pre-blended RGBA surfaces for blitting to the screen, or something
like that…?

It would be nice when some one can implement it to SDL.

Well, it could be implemented, but it’s sort of pointless having
software “fallbacks” for features that can probably only be
accelerated by one single backend: glSDL. (Which is not even included
in the official tree yet, and relies on accelerated OpenGL drivers.)

If you don’t need it accelerated (ie it’s just for load time
preprocessing, off-line rendering and stuff like that), it doesn’t
have to be part of SDL.

There are a few separate libraries that will do this sort of stuff.
Unfortunately, I’ve been out of the loop for a while, and can’t point
you at any specific solution that does exactly what (I think) you’re
asking for.

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Monday 29 August 2005 22.48, Vardar Sahin wrote:

Well, it could be implemented, but it’s sort of pointless having
software “fallbacks” for features that can probably only be
accelerated by one single backend: glSDL. (Which is not even included
in the official tree yet, and relies on accelerated OpenGL drivers.)

If you don’t need it accelerated (ie it’s just for load time
preprocessing, off-line rendering and stuff like that), it doesn’t
have to be part of SDL.

I’ve done simple 'take whatever alpha value is greater for each pixel’
alpha blending by looping through the pixel data and manually setting
the alpha channel.

Including blitting, it takes about 3 - 4x longer by my tests then just
regular blitting alone. For my purpose (storing the composited image
for later use), it was fast enoughOn Tue, 30 Aug 2005, David Olofson wrote:


With sufficient thrust, pigs fly just fine. However, this is
not necessarily a good idea. It is hard to be sure where they
are going to land, and it could be dangerous sitting under them
as they fly overhead. – RFC 1925