Difference between revisions of "Shape:setFillStyle"
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
'''<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>Description</translate> === | === <translate>Description</translate> === | ||
<translate><br /> | <translate><br /> | ||
− | Sets the fill style that | + | 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 /> | |
<br /> | <br /> | ||
<ul><br /> | <ul><br /> |
Revision as of 09:27, 24 August 2018
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.
`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("image.png")
setFillStyle(Shape.TEXTURE, texture) -- sets the fill style as texture with "image.png"
local matrix = Matrix.new(0.5, 0, 0, 0.5, 0, 0)
setFillStyle(Shape.TEXTURE, texture, matrix) -- sets the fill style as texture with "image.png" with a transformation matrix
</code></pre>
<!--
<pre><code>
setFillStyle(Shape.LINEAR_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet
setFillStyle(Shape.RADIAL_GRADIENT, {}, {}, {}, (optional) matrix) -- not supported yet
</code></pre>
-->