[Scummvm-devel] 16bit alpha blending

Marcus Comstedt marcus at mc.pp.se
Sun Feb 20 19:22:39 CET 2011


Johannes Schickel <lordhoto at scummvm.org> writes:

>> 2) a pixel with min alpha must have all colour channels (RGB) set to
>>     0 as well
>
> Is there any rational behind 2, apart that it's easier to check
> against 0 than to only check the alpha channel in backends which need
> to do software "blending"?

The rationale came directly afterwards:

> In this case it doesn't matter if the backend uses pre-multiplied
> alpha or not, the result will be the same.

If you use a 0 alpha, but set some non-zero colour, the result _will_
differ depending on the blend function.  With non-pre-multiplied
alpha, the pixel will be completely transparent anyway, but with
pre-multiplied alpha you'd actually get an "add" effect, where the
resulting pixel is src+dest (the case that color > alpha is an
abnormal case with pre-multiplied alpha).


  // Marcus






More information about the Scummvm-devel mailing list