Alpha blitting again

Hello!
I’m just wondering what is the reason that SDL just keep the destination alpha when blitting RGBA surfaces instead of using something like (1 - ((1 - srcA)*(1 - dstA)))? Is there any chance that this behaviour is going to be changed in near future? In its current state it is impossible to create a surface as a composition of some existing surfaces having transparency (for example to put several surfaces from TTF_RenderUTF8_Blended() together).

Thanks in advance,
Alexander

I’m actually investigating this now. Currently the OpenGL renderer uses
the same formula for the alpha channel as the other channels:
dA = (sA * sA) + (dA * (1.0 - sA))

I’m thinking that the software renderer and surface blits needs to do the
same thing, for consistency if nothing else.

Thoughts?On Sun, Jul 14, 2013 at 9:56 AM, Aleksandr Skobelev wrote:

Hello!
I’m just wondering what is the reason that SDL just keep the destination
alpha when blitting RGBA surfaces instead of using something like (1 - ((1

  • srcA)*(1 - dstA)))? Is there any chance that this behaviour is going to
    be changed in near future? In its current state it is impossible to create
    a surface as a composition of some existing surfaces having transparency
    (for example to put several surfaces from TTF_RenderUTF8_Blended()
    together).

Thanks in advance,
Alexander


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I’d rather use the formula I wrote than OpenGL renderer’s one. The first formula seems to me to be more correct, just because when the destination is fully transparent (i.e. dA = 0), the OpenGL formula produces dA = sA * sA, while it definitely should be just sA.On Jul 14, 2013, at 21:17, Sam Lantinga wrote:

I’m actually investigating this now. Currently the OpenGL renderer uses the same formula for the alpha channel as the other channels:
dA = (sA * sA) + (dA * (1.0 - sA))

I’m thinking that the software renderer and surface blits needs to do the same thing, for consistency if nothing else.

Thoughts?

On Sun, Jul 14, 2013 at 9:56 AM, Aleksandr Skobelev <@Aleksandr_Skobelev> wrote:
Hello!
I’m just wondering what is the reason that SDL just keep the destination alpha when blitting RGBA surfaces instead of using something like (1 - ((1 - srcA)*(1 - dstA)))? Is there any chance that this behaviour is going to be changed in near future? In its current state it is impossible to create a surface as a composition of some existing surfaces having transparency (for example to put several surfaces from TTF_RenderUTF8_Blended() together).

Thanks in advance,
Alexander


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

In fact, if replace sA * sA in the OpenGL fomula with only sA the both formulas will be equal:
dA = sA + (dA * (1.0 - sA)), or dA = dA + sA - (dA * sA)On Jul 15, 2013, at 08:51, Aleksandr Skobelev <@Aleksandr_Skobelev> wrote:

I’d rather use the formula I wrote than OpenGL renderer’s one. The first formula seems to me to be more correct, just because when the destination is fully transparent (i.e. dA = 0), the OpenGL formula produces dA = sA * sA, while it definitely should be just sA.

On Jul 14, 2013, at 21:17, Sam Lantinga wrote:

I’m actually investigating this now. Currently the OpenGL renderer uses the same formula for the alpha channel as the other channels:
dA = (sA * sA) + (dA * (1.0 - sA))

I’m thinking that the software renderer and surface blits needs to do the same thing, for consistency if nothing else.

Thoughts?

On Sun, Jul 14, 2013 at 9:56 AM, Aleksandr Skobelev <@Aleksandr_Skobelev> wrote:
Hello!
I’m just wondering what is the reason that SDL just keep the destination alpha when blitting RGBA surfaces instead of using something like (1 - ((1 - srcA)*(1 - dstA)))? Is there any chance that this behaviour is going to be changed in near future? In its current state it is impossible to create a surface as a composition of some existing surfaces having transparency (for example to put several surfaces from TTF_RenderUTF8_Blended() together).

Thanks in advance,
Alexander


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org