[ view source ]
class Texture
package ceramic
extends Entity
extended by RenderTexture
Available on all targets
A texture is an image ready to be drawn.
Static methods
staticfromPixels(width:Float, height:Float, pixels:UInt8Array, density:Float = 1):Texture
Create a new texture from the given pixels buffer
Parameters:
width | Width of the texture |
---|---|
height | Height of the texture |
pixels | A pixel buffer in integer RGBA format |
density | (optional) density of the texture |
Returns:
Texture
staticfromBytes(bytes:Bytes, density:Float = 1, ?options:Null<LoadTextureOptions>, done:(texture:Texture) ‑> Void):Void
Create a new texture from the given bytes. The bytes must be PNG or JPEG data
Parameters:
bytes | The PNG or JPEG data as bytes |
---|---|
density | (optional) Density of the texture |
options | (optional) Additional options when loading texture (could depend on backend) |
done | A callback receiving the loaded texture, or |
Constructor
Variables
read onlynativeWidthActual:Int
The native actual width of the texture. Same as native width unless underlying backend needs pot (power of two) sizes.
read onlynativeHeightActual:Int
The native actual height of the texture. Same as native height unless underlying backend needs pot (power of two) sizes.
Methods
setWrap(wrapS:TextureWrap, ?wrapT:TextureWrap):Void
Shorthand for setting both wrapS and wrapT at the same time.
Possible values: CLAMP
, REPEAT
, MIRROR
Parameters:
wrapS | horizontal wrap mode |
---|---|
wrapT | vertical wrap mode |
inlinetoPng(path:String, reversePremultiplyAlpha:Bool = true, done:() ‑> Void):Void
inlinetoPng(reversePremultiplyAlpha:Bool = true, done:(data:Bytes) ‑> Void):Void
Export texture as PNG data and save it to the given file path
Parameters:
path | The png file path where to save the image ( |
---|---|
done | Called when the png has been exported |