Difference between revisions of "BlendMode"

m
m (Constants)
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{newin|[[0.2.0]]|020|type=enum}}
 
 
Different ways to do color blending. See [[BlendAlphaMode]] and the [[BlendMode Formulas]] for additional notes.
 
Different ways to do color blending. See [[BlendAlphaMode]] and the [[BlendMode Formulas]] for additional notes.
 
== Constants ==
 
== Constants ==
 
;alpha: Alpha blending (normal). The alpha of what's drawn determines its opacity.
 
;alpha: Alpha blending (normal). The alpha of what's drawn determines its opacity.
{{newin|[[0.9.0]]|090|type=constant}}
+
{{New feature|0.9.0|
;replace: The colors of what's drawn completely replace what was on the screen, with no additional blending.
+
;replace: The colors of what's drawn completely replace what was on the screen, with no additional blending. The [[BlendAlphaMode]] specified in [[love.graphics.setBlendMode]] still affects what happens.
{{newin|[[0.9.1]]|091|type=constant}}
+
}}
 +
{{New feature|0.9.1|
 
;screen: 'Screen' blending.
 
;screen: 'Screen' blending.
{{newin|[[0.10.0]]|100|type=constants|plural=y}}
+
}}
 +
{{New feature|0.10.0|
 
;add: The pixel colors of what's drawn are added to the pixel colors already on the screen. The alpha of the screen is not modified.
 
;add: The pixel colors of what's drawn are added to the pixel colors already on the screen. The alpha of the screen is not modified.
 
;subtract: The pixel colors of what's drawn are subtracted from the pixel colors already on the screen. The alpha of the screen is not modified.
 
;subtract: The pixel colors of what's drawn are subtracted from the pixel colors already on the screen. The alpha of the screen is not modified.
 
;multiply: The pixel colors of what's drawn are multiplied with the pixel colors already on the screen (darkening them). The alpha of drawn objects is multiplied with the alpha of the screen rather than determining how much the colors on the screen are affected, even when the "alphamultiply" [[BlendAlphaMode]] is used.
 
;multiply: The pixel colors of what's drawn are multiplied with the pixel colors already on the screen (darkening them). The alpha of drawn objects is multiplied with the alpha of the screen rather than determining how much the colors on the screen are affected, even when the "alphamultiply" [[BlendAlphaMode]] is used.
----
+
}}
{{oldin|[[0.10.0]]|100|type=constants|plural=y}}
+
{{New feature|0.10.1|
 +
;lighten: The pixel colors of what's drawn are compared to the existing pixel colors, and the larger of the two values for each color component is used. Only works when the "premultiplied" [[BlendAlphaMode]] is used in [[love.graphics.setBlendMode]].
 +
;darken: The pixel colors of what's drawn are compared to the existing pixel colors, and the smaller of the two values for each color component is used. Only works when the "premultiplied" [[BlendAlphaMode]] is used in [[love.graphics.setBlendMode]].
 +
}}
 +
{{Removed feature|0.10.0|
 
;additive: Additive blend mode.
 
;additive: Additive blend mode.
{{newinoldin|[[0.7.0]]|070|[[0.10.0]]|100|type=constants|plural=y}}
+
}}
 +
{{Removed new feature|0.7.0|0.10.0|
 
;subtractive: Subtractive blend mode.
 
;subtractive: Subtractive blend mode.
 
;multiplicative: Multiply blend mode.
 
;multiplicative: Multiply blend mode.
{{newinoldin|[[0.8.0]]|080|[[0.10.0]]|100|type=constant}}
+
}}
 +
{{Removed new feature|0.8.0|0.10.0|
 
;premultiplied: Premultiplied alpha blend mode.
 
;premultiplied: Premultiplied alpha blend mode.
== Example ==
+
}}
[[File:blendModes_0.9.2.png|800px|thumb|none]]
+
 
[https://drive.google.com/file/d/0BxsLw2s2AfEiNjRkRHh2a1Fsbjg/view?usp=sharing Source .love]
 
 
== See Also ==
 
== See Also ==
 
* [[parent::love.graphics]]
 
* [[parent::love.graphics]]
Line 30: Line 36:
 
[[Category:Enums]]
 
[[Category:Enums]]
 
{{#set:Description=Different ways to do color blending.}}
 
{{#set:Description=Different ways to do color blending.}}
 +
{{#set:Since=020}}
 +
{{#set:PrettySince=0.2.0}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|BlendMode}}
 
{{i18n|BlendMode}}

Revision as of 17:26, 12 February 2016

Different ways to do color blending. See BlendAlphaMode and the BlendMode Formulas for additional notes.

Constants

alpha
Alpha blending (normal). The alpha of what's drawn determines its opacity.
Available since LÖVE 0.9.0
replace
The colors of what's drawn completely replace what was on the screen, with no additional blending. The BlendAlphaMode specified in love.graphics.setBlendMode still affects what happens.


Available since LÖVE 0.9.1
screen
'Screen' blending.


Available since LÖVE 0.10.0
add
The pixel colors of what's drawn are added to the pixel colors already on the screen. The alpha of the screen is not modified.
subtract
The pixel colors of what's drawn are subtracted from the pixel colors already on the screen. The alpha of the screen is not modified.
multiply
The pixel colors of what's drawn are multiplied with the pixel colors already on the screen (darkening them). The alpha of drawn objects is multiplied with the alpha of the screen rather than determining how much the colors on the screen are affected, even when the "alphamultiply" BlendAlphaMode is used.


Available since LÖVE 0.10.1
lighten
The pixel colors of what's drawn are compared to the existing pixel colors, and the larger of the two values for each color component is used. Only works when the "premultiplied" BlendAlphaMode is used in love.graphics.setBlendMode.
darken
The pixel colors of what's drawn are compared to the existing pixel colors, and the smaller of the two values for each color component is used. Only works when the "premultiplied" BlendAlphaMode is used in love.graphics.setBlendMode.


Removed in LÖVE 0.10.0
additive
Additive blend mode.


Available since LÖVE 0.7.0 and removed in LÖVE 0.10.0
subtractive
Subtractive blend mode.
multiplicative
Multiply blend mode.


Available since LÖVE 0.8.0 and removed in LÖVE 0.10.0
premultiplied
Premultiplied alpha blend mode.


See Also


Other Languages