3
« on: August 19, 2017, 03:38:01 pm »
You say that this is correct behavior when alpha blending the semi-transparent white text edges onto the (0, 0, 0, 0) background, but I disagree. I believe this is a bug (be it in SFML or OpenGL).
Firstly, the terms "Alpha Blending" and "Blend Mode Alpha" are vague. It should really be clarified that this refers to the Porter-Duff compositing mode "Source Over", and if it does not, well, that's a bug because it should.
The color and alpha formulae for this mode are:
co = αs x Cs + αb x Cb x (1 – αs)
αo = αs + αb x (1 – αs)
Where
co is the output color (with premultiplied alpha),
αo is the output alpha,
αs is source alpha,
αb is destination alpha,
Cs is source color,
Cb is destination color.
In this specific example, αs is a value between 0 and 1. It is 1 for pixels completely inside the glyphs, 0 completely outside the glyphs, and something inbetween on the edges. When blending this onto a (0, 0, 0, 0) background, αb is always 0, meaning that the Cb expression has no effect on the output color, no matter how you look at it. But you can clearly see that this is not the case. When changing the background to, say, (255, 0, 0, 0), the artifacts become red.