Difference between revisions of "Shape:setFillStyle"
Line 19: | Line 19: | ||
Shape:setFillStyle(type,...) | Shape:setFillStyle(type,...) | ||
</source> | </source> | ||
− | '''type''': (string) The type of the fill. Can be one of the Shape.NONE, Shape.SOLID or Shape.TEXTURE. | + | === Parameters === |
− | '''...''': (any) Parameters of the fill style. ''''''<br/> | + | '''type''': (string) The type of the fill. Can be one of the Shape.NONE, Shape.SOLID or Shape.TEXTURE. <br/> |
+ | '''...''': (any) Parameters of the fill style. <br/> | ||
+ | === Examples === | ||
+ | '''Example'''<br/> | ||
+ | <source lang="lua">setFillStyle(Shape.NONE) -- clears the fill style<br /> | ||
+ | <br /> | ||
+ | setFillStyle(Shape.SOLID, 0xff0000) -- sets the fill style as solid red color<br /> | ||
+ | <br /> | ||
+ | setFillStyle(Shape.SOLID, 0xff0000, 0.5) -- sets the fill style as solid red color with 0.5 transparency<br /> | ||
+ | <br /> | ||
+ | local texture = Texture.new("image.png")<br /> | ||
+ | setFillStyle(Shape.TEXTURE, texture) -- sets the fill style as texture with "image.png"<br /> | ||
+ | <br /> | ||
+ | local matrix = Matrix.new(0.5, 0, 0, 0.5, 0, 0)<br /> | ||
+ | setFillStyle(Shape.TEXTURE, texture, matrix) -- sets the fill style as texture with "image.png" with a transformation matrix<br /> | ||
+ | </code></pre><br /> | ||
+ | <!--<br /> | ||
+ | <pre><code><br /> | ||
+ | setFillStyle(Shape.LINEAR_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet<br /> | ||
+ | setFillStyle(Shape.RADIAL_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet<br /> | ||
+ | </code></pre><br /> | ||
+ | --><br /> | ||
+ | <br /></source> |
Revision as of 10:37, 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<br />
<br />
setFillStyle(Shape.SOLID, 0xff0000) -- sets the fill style as solid red color<br />
<br />
setFillStyle(Shape.SOLID, 0xff0000, 0.5) -- sets the fill style as solid red color with 0.5 transparency<br />
<br />
local texture = Texture.new("image.png")<br />
setFillStyle(Shape.TEXTURE, texture) -- sets the fill style as texture with "image.png"<br />
<br />
local matrix = Matrix.new(0.5, 0, 0, 0.5, 0, 0)<br />
setFillStyle(Shape.TEXTURE, texture, matrix) -- sets the fill style as texture with "image.png" with a transformation matrix<br />
</code></pre><br />
<!--<br />
<pre><code><br />
setFillStyle(Shape.LINEAR_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet<br />
setFillStyle(Shape.RADIAL_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet<br />
</code></pre><br />
--><br />
<br />