Hi René!

René Dudfield <[email protected]>:
>
> #define BLEND_RGBA_ADD(tmp, sR, sG, sB, sA, dR, dG, dB, dA)  \
>     tmp = dR + sR; dR = (tmp <= 255 ? tmp : 255);       \
>     tmp = dG + sG; dG = (tmp <= 255 ? tmp : 255);       \
>     tmp = dB + sB; dB = (tmp <= 255 ? tmp : 255);       \
>     tmp = dA + sA; dA = (tmp <= 255 ? tmp : 255);

Ah. Intuitively I thought it would multiply the RGB addition by the
alpha, thus adding RGB(0, 0, 0) for fully transparent pixels.
Apparently it is much simpler. :-)

Still, that would be a useful operation for sprite and icon effects. In
my case I use BLEND_ADD to quickly and conveniently highlight a sprite.
Now I will have to mess with the source PNGs to make sure that the RGB
color for fully transparent pixels is actually black.

Regards,
        Florian

Reply via email to