Difference between revisions of "Pixel"
(→Methods: removed get and set Dimensions as they are now part of the Sprite class) |
Tag: Undo |
||
Line 46: | Line 46: | ||
[[Special:MyLanguage/Pixel.new|Pixel.new]] ''<translate>Constructor to create a Pixel with texture in letterbox mode.</translate>''<br/><!-- GIDEROSMTD:Pixel.new(texture,width,height,texture_scale_x,texture_scale_y,texture_x,texture_y) Constructor to create a Pixel with texture in letterbox mode. --> | [[Special:MyLanguage/Pixel.new|Pixel.new]] ''<translate>Constructor to create a Pixel with texture in letterbox mode.</translate>''<br/><!-- GIDEROSMTD:Pixel.new(texture,width,height,texture_scale_x,texture_scale_y,texture_x,texture_y) Constructor to create a Pixel with texture in letterbox mode. --> | ||
[[Special:MyLanguage/Pixel:getColor|Pixel:getColor]] ''<translate>Gets the color(s) of the Pixel</translate>''<br/><!-- GIDEROSMTD:Pixel:getColor() Gets the color(s) of the Pixel --> | [[Special:MyLanguage/Pixel:getColor|Pixel:getColor]] ''<translate>Gets the color(s) of the Pixel</translate>''<br/><!-- GIDEROSMTD:Pixel:getColor() Gets the color(s) of the Pixel --> | ||
+ | [[Special:MyLanguage/Pixel:getDimensions|Pixel:getDimensions]] <br/><!-- GIDEROSMTD:Pixel:getDimensions() --> | ||
[[Special:MyLanguage/Pixel:getTexturePosition|Pixel:getTexturePosition]] <br/><!-- GIDEROSMTD:Pixel:getTexturePosition() --> | [[Special:MyLanguage/Pixel:getTexturePosition|Pixel:getTexturePosition]] <br/><!-- GIDEROSMTD:Pixel:getTexturePosition() --> | ||
[[Special:MyLanguage/Pixel:getTextureScale|Pixel:getTextureScale]] <br/><!-- GIDEROSMTD:Pixel:getTextureScale() --> | [[Special:MyLanguage/Pixel:getTextureScale|Pixel:getTextureScale]] <br/><!-- GIDEROSMTD:Pixel:getTextureScale() --> | ||
Line 51: | Line 52: | ||
[[Special:MyLanguage/Pixel:setColor|Pixel:setColor]] <br/><!-- GIDEROSMTD:Pixel:setColor(color1,alpha1,color2,alpha2,angle) --> | [[Special:MyLanguage/Pixel:setColor|Pixel:setColor]] <br/><!-- GIDEROSMTD:Pixel:setColor(color1,alpha1,color2,alpha2,angle) --> | ||
[[Special:MyLanguage/Pixel:setColor|Pixel:setColor]] ''<translate>Sets 4-colour gradient.</translate>''<br/><!-- GIDEROSMTD:Pixel:setColor(color1,alpha1,color2,alpha2,color3,alpha3,color4,alpha4) Sets 4-colour gradient. --> | [[Special:MyLanguage/Pixel:setColor|Pixel:setColor]] ''<translate>Sets 4-colour gradient.</translate>''<br/><!-- GIDEROSMTD:Pixel:setColor(color1,alpha1,color2,alpha2,color3,alpha3,color4,alpha4) Sets 4-colour gradient. --> | ||
+ | [[Special:MyLanguage/Pixel:setDimensions|Pixel:setDimensions]] ''<translate>Sets both width and height of the Pixel.</translate>''<br/><!-- GIDEROSMTD:Pixel:setDimensions(w,h) Sets both width and height of the Pixel. --> | ||
[[Special:MyLanguage/Pixel:setHeight|Pixel:setHeight]] ''<translate>Sets the height of the pixel sprite.</translate>''<br/><!-- GIDEROSMTD:Pixel:setHeight(h) Sets the height of the pixel sprite. --> | [[Special:MyLanguage/Pixel:setHeight|Pixel:setHeight]] ''<translate>Sets the height of the pixel sprite.</translate>''<br/><!-- GIDEROSMTD:Pixel:setHeight(h) Sets the height of the pixel sprite. --> | ||
[[Special:MyLanguage/Pixel:setNinePatch|Pixel:setNinePatch]] ''<translate>Configure 9-patch style texture rendering.</translate>''<br/><!-- GIDEROSMTD:Pixel:setNinePatch(vl,vr,vt,vb,tl,tr,tt,tb) --> | [[Special:MyLanguage/Pixel:setNinePatch|Pixel:setNinePatch]] ''<translate>Configure 9-patch style texture rendering.</translate>''<br/><!-- GIDEROSMTD:Pixel:setNinePatch(vl,vr,vt,vb,tl,tr,tt,tb) --> | ||
Line 60: | Line 62: | ||
| 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 17:34, 28 August 2020
Supported platforms:
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.
Examples
local mypixel = Pixel.new(0x0000FF, 0.75, 128, 128)
mypixel:setAnchorPoint(0.5, 0.5)
mypixel:setPosition(application:getContentWidth() / 2, 64)
stage:addChild(mypixel)
application:setBackgroundColor(0x323232)
local p = Pixel.new(0xffffff, 1, 32, 32)
p:set("redMultiplier", 1) -- OK
p:set("greenMultiplier", 0) -- OK
p:set("blueMultiplier", 0) -- OK
p:set("alphaMultiplier", 1) -- OK
--p:set("anchorX", .5) -- NOT OK
--p:set("anchorY", .5) -- NOT OK
p:set("anchorX", 16) -- OK
p:set("anchorY", 16) -- OK
p:set("alpha", .5) -- OK
p:set("scaleX", 1.5) -- OK
p:set("rotation", 10) -- OK
p:set("x", 32) -- OK
p:set("y", 32) -- OK
stage:addChild(p)
MethodsPixel.new Create new pixel |
EventsConstants |