Difference between revisions of "Shape:setFillStyle"

From GiderosMobile
Line 2: Line 2:
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 
=== Description ===
 
=== Description ===
<br />
+
<translate><br />
Sets the fill style that `Shape` object uses for subsequent drawings. The fill style remains in effect until you call `setFillStyle()` function with different<br />
+
Sets the fill style that [[[Shape` object uses for subsequent drawings. The fill style remains in effect until you call `setFillStyle()]]] function with different<br />
 
parameters.<br />
 
parameters.<br />
 
<br />
 
<br />
`type` parameter can be one of the following values:<br />
+
[[[type]]] parameter can be one of the following values:<br />
 
<br />
 
<br />
 
&lt;ul&gt;<br />
 
&lt;ul&gt;<br />
Line 15: Line 15:
 
<br />
 
<br />
 
See the following example for more detailed usage of this function.<br />
 
See the following example for more detailed usage of this function.<br />
<br />
+
<br /></translate>
 
<source lang="lua">
 
<source lang="lua">
 
  Shape:setFillStyle(type,...)
 
  Shape:setFillStyle(type,...)
 
</source>
 
</source>
 
=== Parameters ===
 
=== Parameters ===
'''type''': (string) The type of the fill. Can be one of the Shape.NONE, Shape.SOLID or Shape.TEXTURE. <br/>
+
'''type''': (string) <translate>The type of the fill. Can be one of the Shape.NONE, Shape.SOLID or Shape.TEXTURE.</translate> <br/>
'''...''': (any) Parameters of the fill style. <br/>
+
'''...''': (any) <translate>Parameters of the fill style.</translate> <br/>
 
=== Examples ===
 
=== Examples ===
 
'''Example'''<br/>
 
'''Example'''<br/>
<source lang="lua">setFillStyle(Shape.NONE) -- clears the fill style<br />
+
<source lang="lua">setFillStyle(Shape.NONE) -- clears the fill style
<br />
+
 
setFillStyle(Shape.SOLID, 0xff0000) -- sets the fill style as solid red color<br />
+
setFillStyle(Shape.SOLID, 0xff0000) -- sets the fill style as solid red color
<br />
+
 
setFillStyle(Shape.SOLID, 0xff0000, 0.5) -- sets the fill style as solid red color with 0.5 transparency<br />
+
setFillStyle(Shape.SOLID, 0xff0000, 0.5) -- sets the fill style as solid red color with 0.5 transparency
<br />
+
 
local texture = Texture.new(&quot;image.png&quot;)<br />
+
local texture = Texture.new(&quot;image.png&quot;)
setFillStyle(Shape.TEXTURE, texture) -- sets the fill style as texture with &quot;image.png&quot;<br />
+
setFillStyle(Shape.TEXTURE, texture) -- sets the fill style as texture with &quot;image.png&quot;
<br />
+
 
local matrix = Matrix.new(0.5, 0, 0, 0.5, 0, 0)<br />
+
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<br />
+
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;<br />
+
&lt;/code&gt;&lt;/pre&gt;
&lt;!--<br />
+
&lt;!--
&lt;pre&gt;&lt;code&gt;<br />
+
&lt;pre&gt;&lt;code&gt;
setFillStyle(Shape.LINEAR_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet<br />
+
setFillStyle(Shape.LINEAR_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet
setFillStyle(Shape.RADIAL_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet<br />
+
setFillStyle(Shape.RADIAL_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet
&lt;/code&gt;&lt;/pre&gt;<br />
+
&lt;/code&gt;&lt;/pre&gt;
--&gt;<br />
+
--&gt;
<br /></source>
+
</source>

Revision as of 13:32, 23 August 2018

Available since: Gideros 2011.6

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.

[[[type]]] parameter can be one of the following values:

<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>

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

 Shape:setFillStyle(type,...)

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

Example

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(&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)
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.RADIAL_GRADIENT, {}, {}, {}, (optional) matrix)		-- not supported yet
&lt;/code&gt;&lt;/pre&gt;
--&gt;