BlendAlphaMode
Available since LÖVE 0.10.0
This enum is not supported in earlier versions.
Different ways alpha affects color blending. See BlendMode and the BlendMode Formulas for additional notes.
Constants
- alphamultiply
- The RGB values of what's drawn are multiplied by the alpha values of those colors during blending. This is the default alpha mode.
- premultiplied
- The RGB values of what's drawn are not multiplied by the alpha values of those colors during blending. For most blend modes to work correctly with this alpha mode, the colors of a drawn object need to have had their RGB values multiplied by their alpha values at some point previously ("premultiplied alpha").
Notes
The "premultiplied" constant should generally be used when drawing a Canvas to the screen, because the RGB values of the Canvas' texture had previously been multiplied by its alpha values when drawing content to the Canvas itself.
The "alphamultiply" constant does not affect the "multiply" BlendMode. Similarly, the "screen" BlendMode's math is only correct if the "premultiplied" alpha mode is used and the alpha of drawn objects has already been multiplied with its RGB values previously (possibly inside a shader).
Several articles have been written about premultiplied alpha and when to use it:
- http://www.realtimerendering.com/blog/gpus-prefer-premultiplication/
- https://developer.nvidia.com/content/alpha-blending-pre-or-not-pre
- http://blogs.msdn.com/b/shawnhar/archive/2009/11/06/premultiplied-alpha.aspx
- http://blogs.msdn.com/b/shawnhar/archive/2009/11/07/premultiplied-alpha-and-image-composition.aspx
See Also
© 2006–2020 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/BlendAlphaMode