Difference between revisions of "BlendAlphaMode"
m |
m (→Notes) |
||
Line 9: | Line 9: | ||
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). | 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: | + | 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 | * 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/06/premultiplied-alpha.aspx | ||
* http://blogs.msdn.com/b/shawnhar/archive/2009/11/07/premultiplied-alpha-and-image-composition.aspx | * http://blogs.msdn.com/b/shawnhar/archive/2009/11/07/premultiplied-alpha-and-image-composition.aspx | ||
+ | |||
== See Also == | == See Also == | ||
* [[parent::love.graphics]] | * [[parent::love.graphics]] |
Latest revision as of 22:12, 11 January 2016
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.
Contents
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
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info