Difference between revisions of "Shape:setFillStyle"

From GiderosMobile
(→‎Description: fixed some html tags)
Line 2: Line 2:
 
<languages />
 
<languages />
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Shape|Shape]]<br/>
+
'''<translate>Class</translate>:''' [[Special:MyLanguage/Shape|Shape]]
 +
<br/>
 +
 
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
<translate><br />
+
<translate>
Sets the fill style that [[Special:MyLanguage/Shape|Shape]] object uses for subsequent drawings. The fill style remains in effect until you call ''setFillStyle()'' function with different<br />
+
<br/>
parameters.<br />
+
Sets the fill style that [[Special:MyLanguage/Shape|Shape]] object uses for subsequent drawings. The fill style remains in effect until you call ''setFillStyle()'' function with different parameters.
<br />
+
<br/>
[[Special:MyLanguage/type|type]] parameter can be one of the following values:<br />
+
<br/>
<br />
+
 
&lt;ul&gt;<br />
+
See the following example for more detailed usage of this function:
&lt;li&gt;**Shape.NONE:** Clears the fill style.&lt;/li&gt;<br />
+
<br/>
&lt;li&gt;**Shape.SOLID:** Sets the fill style as a solid color. In this mode, the parameters are color (in hexedecial value) and an optional alpha value.&lt;/li&gt;<br />
 
&lt;li&gt;**Shape.TEXTURE:** Sets the fill style as a textured. In this mode, the parameters are texture and an optional transformation matrix.&lt;/li&gt;<br />
 
&lt;/ul&gt;<br />
 
<br />
 
See the following example for more detailed usage of this function.<br />
 
<br /></translate>
 
 
<source lang="lua">
 
<source lang="lua">
Shape:setFillStyle(type,...)
+
Shape:setFillStyle(type,...)
 
</source>
 
</source>
 +
<br/>
 +
 +
[[Special:MyLanguage/type|type]] parameter can be one of the following values:<br/>
 +
<ul>
 +
<li>'''Shape.NONE''': Clears the fill style.</li>
 +
<li>'''Shape.SOLID''': Sets the fill style as a solid color. In this mode, the parameters are color (in hexedecial value) and an optional alpha value.</li>
 +
<li>'''Shape.TEXTURE''': Sets the fill style as a textured. In this mode, the parameters are texture and an optional transformation matrix.</li>
 +
</ul>
 +
</translate>
 +
<br/>
 +
 
=== <translate>Parameters</translate> ===
 
=== <translate>Parameters</translate> ===
'''type''': (string) <translate>The type of the fill. Can be one of the Shape.NONE, Shape.SOLID or Shape.TEXTURE.</translate> <br/>
+
<br/>
'''...''': (any) <translate>Parameters of the fill style.</translate> <br/>
+
 
 +
'''type''': (string) <translate>The type of the fill. Can be one of the Shape.NONE, Shape.SOLID or Shape.TEXTURE.</translate>
 +
'''...''': (any) <translate>Parameters of the fill style.</translate>
 +
<br/>
 +
<br/>
 +
 
 
=== <translate>Examples</translate> ===
 
=== <translate>Examples</translate> ===
'''Example'''<br/>
+
<br/>
<source lang="lua">setFillStyle(Shape.NONE) -- clears the fill style
+
'''Examples'''
 +
<br/>
 +
 
 +
<source lang="lua">
 +
setFillStyle(Shape.NONE) -- clears the fill style
  
 
setFillStyle(Shape.SOLID, 0xff0000) -- sets the fill style as solid red color
 
setFillStyle(Shape.SOLID, 0xff0000) -- sets the fill style as solid red color
Line 32: Line 48:
 
setFillStyle(Shape.SOLID, 0xff0000, 0.5) -- sets the fill style as solid red color with 0.5 transparency
 
setFillStyle(Shape.SOLID, 0xff0000, 0.5) -- sets the fill style as solid red color with 0.5 transparency
  
local texture = Texture.new(&quot;image.png&quot;)
+
local texture = Texture.new("image.png")
 
setFillStyle(Shape.TEXTURE, texture) -- sets the fill style as texture with &quot;image.png&quot;
 
setFillStyle(Shape.TEXTURE, texture) -- sets the fill style as texture with &quot;image.png&quot;
  
 
local matrix = Matrix.new(0.5, 0, 0, 0.5, 0, 0)
 
local matrix = Matrix.new(0.5, 0, 0, 0.5, 0, 0)
 
setFillStyle(Shape.TEXTURE, texture, matrix) -- sets the fill style as texture with &quot;image.png&quot; with a transformation matrix
 
setFillStyle(Shape.TEXTURE, texture, matrix) -- sets the fill style as texture with &quot;image.png&quot; with a transformation matrix
&lt;/code&gt;&lt;/pre&gt;
+
 
&lt;!--
+
<!--
&lt;pre&gt;&lt;code&gt;
 
 
setFillStyle(Shape.LINEAR_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet
 
setFillStyle(Shape.LINEAR_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet
 
setFillStyle(Shape.RADIAL_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet
 
setFillStyle(Shape.RADIAL_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet
&lt;/code&gt;&lt;/pre&gt;
+
-->
--&gt;
 
 
</source>
 
</source>
 +
<br/>

Revision as of 01:51, 13 April 2019


Available since: Gideros 2011.6
Class: Shape

Description


Sets the fill style that Shape object uses for subsequent drawings. The fill style remains in effect until you call setFillStyle() function with different parameters.

See the following example for more detailed usage of this function:

Shape:setFillStyle(type,...)


type parameter can be one of the following values:

  • Shape.NONE: Clears the fill style.
  • Shape.SOLID: Sets the fill style as a solid color. In this mode, the parameters are color (in hexedecial value) and an optional alpha value.
  • Shape.TEXTURE: Sets the fill style as a textured. In this mode, the parameters are texture and an optional transformation matrix.


Parameters


type: (string) The type of the fill. Can be one of the Shape.NONE, Shape.SOLID or Shape.TEXTURE. ...: (any) Parameters of the fill style.

Examples


Examples

setFillStyle(Shape.NONE)						-- clears the fill style

setFillStyle(Shape.SOLID, 0xff0000)				-- sets the fill style as solid red color

setFillStyle(Shape.SOLID, 0xff0000, 0.5)		-- sets the fill style as solid red color with 0.5 transparency

local texture = Texture.new("image.png")
setFillStyle(Shape.TEXTURE, texture)			-- sets the fill style as texture with &quot;image.png&quot;

local matrix = Matrix.new(0.5, 0, 0, 0.5, 0, 0)
setFillStyle(Shape.TEXTURE, texture, matrix)	-- sets the fill style as texture with &quot;image.png&quot; with a transformation matrix

<!--
setFillStyle(Shape.LINEAR_GRADIENT, {}, {}, {}, (optional) matrix)		-- not supported yet
setFillStyle(Shape.RADIAL_GRADIENT, {}, {}, {}, (optional) matrix)		-- not supported yet
-->