pixi.textures.Texture

type
class
subclasses
pixi.textures.RenderTexture
metadata
:native
"PIXI.Texture"

Static Methods

addTextureToCache(texture : Texture, id : String) : Void

parameters
texture {Texture}
id {String} the id that the texture will be stored against.
Adds a texture to the textureCache.

fromCanvas(canvas : Dynamic, ?scaleMode : Int) : Texture

parameters
canvas {Canvas} The canvas element source of the texture
scaleMode {Int} Should be one of the PIXI.scaleMode consts
returns
Texture
Helper function that returns a texture based on a canvas element If the canvas is not in the texture cache it will be created and loaded

fromFrame(frameId : String) : Texture

parameters
frameId {String} The frame id of the texture
returns
Texture
Helper function that returns a texture based on a frame id If the frame id is not in the texture cache an error will be thrown

fromImage(imageId : String, ?crossorigin : Bool, ?scaleMode : Int) : Texture

parameters
imageUrl {String} The image url of the texture
crossorigin {Bool} Whether requests should be treated as crossorigin
scaleMode {Int} Should be one of the PIXI.scaleMode consts
returns
Texture
Helper function that returns a texture based on an image url If the image is not in the texture cache it will be created and loaded

removeTextureFromCache(id : String) : Texture

parameters
id {String} the id of the texture to be removed
returns
{Texture} the texture that was removed
Remove a texture from the textureCache.

setFrame(frame : pixi.geom.Rectangle) : Void

parameters
frame {Rectangle} The frame of the texture to set it to
Specifies the region of the baseTexture that this texture will use.

Constructor

new(baseTexture : BaseTexture, ?frame : pixi.geom.Rectangle, ?crop : pixi.geom.Rectangle, ?trim : pixi.geom.Rectangle)
parameters
baseTexture {BaseTexture} The base texture source to create the texture from
[frame] {Rectangle} The rectangle frame of the texture to show
[crop] {Rectangle} The area of original texture
[trim] {Rectangle} Trimmed texture rectangle
A texture stores the information that represents an image or part of an image. It cannot be added to the display list directly. Instead use it as the texture for a PIXI.Sprite. If no frame is provided then the whole image is used.

Instance Variables

baseTexture : BaseTexture

The base texture that this texture uses.
This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering, irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)
The frame specifies the region of the base texture that this texture uses

height : Float

The height of the Texture in pixels.

noFrame : Bool

Does this Texture have any frame data assigned to it?
The trim point

uvs : Dynamic

The WebGL UV data cache.

valid : Bool

This will let the renderer know if the texture is valid. If its not then it cannot be rendered.

width : Float

The width of the Texture in pixels.

Instance Methods

destroy(?destroyBase : Bool) : Void

parameters
destroyBase {Bool} Whether to destroy the base texture as well
Destroys this texture