Closed prepare closed 6 years ago
from https://blogs.msdn.microsoft.com/shawnhar/2009/11/06/premultiplied-alpha/
In this world, RGB and alpha are linked. To make an object transparent you must reduce both its RGB (to contribute less color) and also its alpha (to obscure less of whatever is behind it). Fully transparent objects no longer have any RGB color, so there is only one value that represents 100% transparency (RGB and alpha all zero).
This is more like how light behaves in the real world. What is the RGB of my car windscreen? None: it is transparent, so has no color. How about my sunglasses? These have a fractional alpha value (letting some light some through, while blocking some) and also contribute some RGB for that nice rose-tinted glow.
To use premultiplied alpha, in addition to setting the appropriate renderstates, you must also convert your source graphics into premultiplied format. Drawing a non premultiplied color with premultiplied blending will not give sensible results!
Premultiplied alpha
from from https://microsoft.github.io/Win2D/html/PremultipliedAlpha.htm
...
see more at
https://blogs.msdn.microsoft.com/shawnhar/2009/11/06/premultiplied-alpha/
https://blogs.msdn.microsoft.com/shawnhar/2009/11/07/premultiplied-alpha-and-image-composition/
http://ssp.impulsetrain.com/gamma-premult.html