Difference between revisions of "Sprite:setBlendMode"

(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === <br /> Sets the blend mode of the sprite. This method can be called with 1 or 2 parameters. If one pa...")
 
(9 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
'''Available since:''' Gideros 2011.6<br/>
+
<languages />
=== Description ===
+
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
<br />
+
'''<translate>Class</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/>
 +
=== <translate>Description</translate> ===
 +
<translate><br />
 
Sets the blend mode of the sprite. This method can be called with 1 or 2 parameters.  
 
Sets the blend mode of the sprite. This method can be called with 1 or 2 parameters.  
 
If one parameter is passed it must be one of the following blending modes:<br />
 
If one parameter is passed it must be one of the following blending modes:<br />
Line 14: Line 16:
 
</ul><br />
 
</ul><br />
 
<br />
 
<br />
If a `Sprite` object doesn't set any blending mode, it takes the blending mode from its parent sprite.<br />
+
If a [[Special:MyLanguage/Sprite|Sprite]] object doesn't set any blending mode, it takes the blending mode from its parent sprite.<br />
 
<br />
 
<br />
 
<ul><br />
 
<ul><br />
Line 40: Line 42:
 
<li>Sprite.ONE_MINUS_DST_ALPHA = "oneMinusDstAlpha"</li><br />
 
<li>Sprite.ONE_MINUS_DST_ALPHA = "oneMinusDstAlpha"</li><br />
 
<li>Sprite.SRC_ALPHA_SATURATE = "srcAlphaSaturate"</li><br />
 
<li>Sprite.SRC_ALPHA_SATURATE = "srcAlphaSaturate"</li><br />
</ul><br />
+
</ul><br /></translate>
 
<source lang="lua">
 
<source lang="lua">
= Sprite:setBlendMode(blendMode or srcdst,)
+
Sprite:setBlendMode(blendMode or src,dst)
 
</source>
 
</source>
'''blendMode or src:''' (String) If one parameter is used, this is the blend mode. If two parameters are used this is the source blend specification. ''''''<br/>
+
=== <translate>Parameters</translate> ===
'''dst:''' (string) Destination blend mode '''optional'''<br/>
+
'''blendMode or src''': (String) <translate>If one parameter is used, this is the blend mode. If two parameters are used this is the source blend specification.</translate> <br/>
 +
'''dst''': (string) <translate>Destination blend mode</translate> '''optional'''<br/>
 +
 
 +
{{Sprite}}

Revision as of 01:15, 4 December 2019


Available since: Gideros 2011.6
Class: Sprite

Description


Sets the blend mode of the sprite. This method can be called with 1 or 2 parameters. If one parameter is passed it must be one of the following blending modes:


  • Sprite.ALPHA = "alpha"

  • Sprite.NO_ALPHA = "noAlpha"

  • Sprite.ADD = "add"

  • Sprite.MULTIPLY = "multiply"

  • Sprite.SCREEN = "screen"



If a Sprite object doesn't set any blending mode, it takes the blending mode from its parent sprite.


  • *Note:** The following two lines are completely same:


<code><br />
	sprite:setBlendMode("add")<br />
	sprite:setBlendMode(Sprite.ADD)<br />
</code>


It's a matter of taste which one to choose.


If two parameters are passed to this method, then a source and destination blend can be set (in that order) and each take the values:


  • Sprite.ZERO = "zero"

  • Sprite.ONE = "one"

  • Sprite.SRC_COLOR = "srcColor"

  • Sprite.ONE_MINUS_SRC_COLOR = "oneMinusSrcColor"

  • Sprite.DST_COLOR = "dstColor"

  • Sprite.ONE_MINUS_DST_COLOR = "oneMinusDstColor"

  • Sprite.SRC_ALPHA = "srcAlpha"

  • Sprite.ONE_MINUS_SRC_ALPHA = "oneMinusSrcAlpha"

  • Sprite.DST_ALPHA = "dstAlpha"

  • Sprite.ONE_MINUS_DST_ALPHA = "oneMinusDstAlpha"

  • Sprite.SRC_ALPHA_SATURATE = "srcAlphaSaturate"


 Sprite:setBlendMode(blendMode or src,dst)

Parameters

blendMode or src: (String) If one parameter is used, this is the blend mode. If two parameters are used this is the source blend specification.
dst: (string) Destination blend mode optional