Difference between revisions of "love.graphics.setBlendMode"

(Removed in 0.10 in favour of the second version, where the second parameter defaults to "alphamultiply")
m (Fixed)
Line 1: Line 1:
{{newinoldin|[[0.2.0]]|020|[[0.10.0]]|100|type=function}}
+
{{newin|[[0.2.0]]|020|type=function}}
 
Sets the [[BlendMode|blending mode]].
 
Sets the [[BlendMode|blending mode]].
  
 
== Function ==
 
== Function ==
 +
{{newin|[[0.10.0]]|100|type=variant}}
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
love.graphics.setBlendMode( mode )
+
love.graphics.setBlendMode( mode, alphamode )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
 
{{param|BlendMode|mode|The blend mode to use.}}
 
{{param|BlendMode|mode|The blend mode to use.}}
 +
{{param|BlendAlphaMode|alphamode ("alphamultiply")|What to do with the alpha of drawn objects when blending.}}
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 +
=== Notes ===
 +
The default "alphamultiply" alpha mode should normally be preferred except when drawing content with pre-multiplied alpha. If content is drawn to a [[Canvas]] using the "alphamultiply" mode, the Canvas texture will have pre-multiplied alpha afterwards, so the "premultiplied" alpha mode should generally be used when drawing a Canvas to the screen.
  
 
== Function ==
 
== Function ==
{{newin|[[0.10.0]]|100|type=variant}}
+
{{oldin|[[0.10.0]]|100|type=variant}}
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
love.graphics.setBlendMode( mode, alphamode )
+
love.graphics.setBlendMode( mode )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
 
{{param|BlendMode|mode|The blend mode to use.}}
 
{{param|BlendMode|mode|The blend mode to use.}}
{{param|BlendAlphaMode|alphamode ("alphamultiply")|What to do with the alpha of drawn objects when blending.}}
 
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
=== Notes ===
 
The default "alphamultiply" alpha mode should normally be preferred except when drawing content with pre-multiplied alpha. If content is drawn to a [[Canvas]] using the "alphamultiply" mode, the Canvas texture will have pre-multiplied alpha afterwards, so the "premultiplied" alpha mode should generally be used when drawing a Canvas to the screen.
 
  
 
== Examples ==
 
== Examples ==

Revision as of 14:39, 5 November 2023

Available since LÖVE 0.2.0
This function is not supported in earlier versions.

Sets the blending mode.

Function

Available since LÖVE 0.10.0
This variant is not supported in earlier versions.

Synopsis

love.graphics.setBlendMode( mode, alphamode )

Arguments

BlendMode mode
The blend mode to use.
BlendAlphaMode alphamode ("alphamultiply")
What to do with the alpha of drawn objects when blending.

Returns

Nothing.

Notes

The default "alphamultiply" alpha mode should normally be preferred except when drawing content with pre-multiplied alpha. If content is drawn to a Canvas using the "alphamultiply" mode, the Canvas texture will have pre-multiplied alpha afterwards, so the "premultiplied" alpha mode should generally be used when drawing a Canvas to the screen.

Function

Removed in LÖVE 0.10.0
This variant is not supported in that and later versions.

Synopsis

love.graphics.setBlendMode( mode )

Arguments

BlendMode mode
The blend mode to use.

Returns

Nothing.

Examples

function love.load()
	love.graphics.setBackgroundColor(.21, .67, .97)
end

function love.draw()
	love.graphics.setBlendMode("alpha") -- Default blend mode.
	love.graphics.setColor(.90, .17, .48)
	love.graphics.rectangle("fill", 50,50, 100,100)

	love.graphics.setColor(.04, .39, .90)
	love.graphics.setBlendMode("multiply", "premultiplied")
	love.graphics.rectangle("fill", 75,75, 125,125)
end

See Also


Other Languages