Difference between revisions of "Pixel"

From GiderosMobile
(added example to the main pixel page)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
 
<languages />
 
<languages />
 +
 
<!-- GIDEROSOBJ:Pixel -->
 
<!-- GIDEROSOBJ:Pixel -->
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/>
+
 
'''<translate>Available since</translate>:''' Gideros 2016.06<br/>
+
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/>
+
<br/>
 +
 
 +
'''<translate>Available since</translate>:''' Gideros 2016.06
 +
<br/>
 +
 
 +
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]
 +
<br/>
 +
 
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
<translate>A rectangular Sprite which can be filled with solid colors, gradients or textures.
+
<translate>
Pixel aims at being a simpler and faster alternative to Shape when needing to display a coloured box or box with a gradient. It is also useful as Bitmap replacement since every texture will be fitted into Pixel dimensions automatically.</translate>
+
A rectangular Sprite which can be filled with solid colors, gradients or textures.
 +
Pixel aims at being a simpler and faster alternative to Shape when needing to display a coloured box or box with a gradient. It is also useful as Bitmap replacement since every texture will be fitted into Pixel dimensions automatically.
 +
</translate>
 +
 
 +
=== <translate>Example</translate> ===
 +
<source lang="lua">
 +
local mypixel = Pixel.new(0x0000FF, 0.75, 128, 128)
 +
mypixel:setAnchorPoint(0.5, 0.5)
 +
mypixel:setPosition(application:getContentWidth() / 2, 64)
 +
 
 +
stage:addChild(mypixel)
 +
</source>
 +
<br/>
 +
 
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
Line 27: Line 49:
 
[[Special:MyLanguage/Pixel:setTextureScale|Pixel:setTextureScale]] <br/><!-- GIDEROSMTD:Pixel:setTextureScale(sx,sy)  -->
 
[[Special:MyLanguage/Pixel:setTextureScale|Pixel:setTextureScale]] <br/><!-- GIDEROSMTD:Pixel:setTextureScale(sx,sy)  -->
 
[[Special:MyLanguage/Pixel:setWidth|Pixel:setWidth]] ''<translate>Sets the width of the pixel sprite.</translate>''<br/><!-- GIDEROSMTD:Pixel:setWidth(w) Sets the width of the pixel sprite. -->
 
[[Special:MyLanguage/Pixel:setWidth|Pixel:setWidth]] ''<translate>Sets the width of the pixel sprite.</translate>''<br/><!-- GIDEROSMTD:Pixel:setWidth(w) Sets the width of the pixel sprite. -->
 +
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Events</translate> ===
 
=== <translate>Events</translate> ===
 
=== <translate>Constants</translate> ===
 
=== <translate>Constants</translate> ===
 
|}
 
|}

Revision as of 18:24, 20 July 2019



Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png

Available since: Gideros 2016.06

Inherits from: Sprite

Description

A rectangular Sprite which can be filled with solid colors, gradients or textures. Pixel aims at being a simpler and faster alternative to Shape when needing to display a coloured box or box with a gradient. It is also useful as Bitmap replacement since every texture will be fitted into Pixel dimensions automatically.

Example

local mypixel = Pixel.new(0x0000FF, 0.75, 128, 128)
mypixel:setAnchorPoint(0.5, 0.5)
mypixel:setPosition(application:getContentWidth() / 2, 64)

stage:addChild(mypixel)


Methods

Pixel.new Create new pixel
Pixel.new Constructor to create a Pixel with texture in letterbox mode.
Pixel:getColor Gets the color(s) of the Pixel
Pixel:getDimensions
Pixel:getTexturePosition
Pixel:getTextureScale
Pixel:setColor Sets the color of the Pixel
Pixel:setColor
Pixel:setColor Sets 4-colour gradient.
Pixel:setDimensions Sets both width and height of the Pixel.
Pixel:setHeight Sets the height of the pixel sprite.
Pixel:setTexture
Pixel:setTextureMatrix
Pixel:setTexturePosition
Pixel:setTextureScale
Pixel:setWidth Sets the width of the pixel sprite.

Events

Constants