Difference between revisions of "Texture.new"

From GiderosMobile
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
<languages />
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/Texture|Texture]]<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/Texture|Texture]]<br/>
Line 18: Line 19:
 
local texture = Texture.new(&quot;image.png&quot;, true, {wrap = Texture.REPEAT}) -- enable filtering and repeat the texture</source>
 
local texture = Texture.new(&quot;image.png&quot;, true, {wrap = Texture.REPEAT}) -- enable filtering and repeat the texture</source>
 
__NOTOC__
 
__NOTOC__
 +
<languages />
 
'''<translate>Available since</translate>:''' Gideros 2016.08<br/>
 
'''<translate>Available since</translate>:''' Gideros 2016.08<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/Texture|Texture]]<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/Texture|Texture]]<br/>

Revision as of 09:57, 3 September 2018


Available since: Gideros 2011.6
Class: Texture

Description


Creates a new Texture object.

 Texture.new(filename,filtering,options)

Parameters

filename: (string) The name of the texture file to be loaded.
filtering: (boolean, default = false) Whether or not the texture is filtered.
options: (table, optional) A table that specifies optional paramaters. Currently, "transparentColor", "wrap", "format" and "extend" fields are supported. optional

Examples

Example

local texture = Texture.new(&quot;image.png&quot;, false, {transparentColor = 0xff00ff})	-- do not filter and make the color 0xff00ff transparent
local texture = Texture.new(&quot;image.png&quot;, true, {wrap = Texture.REPEAT})	-- enable filtering and repeat the texture


Available since: Gideros 2016.08
Class: Texture

Description

Create a texture from pixel data.

 Texture.new(pixels,width,height,filtering,options)

Parameters

pixels: (string) A string containing actual R,G,B,A compoents of each pixel in the new texture. Each component is stored as a byte. You can pass nil if you don't need to initialize texture content
width: (number) width of the texture to create
height: (number) Height of the texture to create
filtering: (boolean, default to false) indicate that the texture should be filtered optional
options: (table, optional) A table that specifies optional paramaters. Currently, "transparentColor", "wrap", "format" and "extend" fields are supported. optional

Examples

Example

local texture = Texture.new(nil,300,400;, false, {extend=false})	-- Create a 300x400 empty texture. Prevent gideros from extending the texture to the next power of two size