Class: PIXI.Texture
Constructor
new Texture(baseTexture, frame, crop, trim)
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.
Parameters
Name | Type | Argument | Description |
---|---|---|---|
baseTexture | PIXI.BaseTexture | The base texture source to create the texture from | |
frame | Rectangle | The rectangle frame of the texture to show | |
crop | Rectangle | <optional> | The area of original texture |
trim | Rectangle | <optional> | Trimmed texture rectangle |
- Source code: pixi/textures/Texture.js (Line 14)
Public Properties
- Source code: pixi/textures/Texture.js (Line 47)
- Source code: pixi/textures/Texture.js (Line 128)
- Source code: pixi/textures/Texture.js (Line 55)
- Source code: pixi/textures/Texture.js (Line 120)
- Source code: pixi/textures/Texture.js (Line 79)
- Source code: pixi/textures/Texture.js (Line 28)
- Source code: pixi/textures/Texture.js (Line 95)
- Source code: pixi/textures/Texture.js (Line 87)
- Source code: pixi/textures/Texture.js (Line 63)
- Source code: pixi/textures/Texture.js (Line 71)
- Source code: pixi/textures/Texture.js (Line 112)
baseTexture : PIXI.BaseTexture
The base texture that this texture uses.
crop :Rectangle
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)
frame :Rectangle
The frame specifies the region of the base texture that this texture uses
height : number
The height of the Texture in pixels.
isTiling : boolean
Is this a tiling texture? As used by the likes of a TilingSprite.
noFrame : boolean
Does this Texture have any frame data assigned to it?
requiresReTint : boolean
This will let a renderer know that a tinted parent has updated its texture.
requiresUpdate : boolean
This will let a renderer know that a texture has been updated (used mainly for webGL uv updates)
trim :Rectangle
The texture trim data.
valid : boolean
This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.
width : number
The width of the Texture in pixels.
Public Methods
- Source code: pixi/textures/Texture.js (Line 249)
- Source code: pixi/textures/Texture.js (Line 165)
- Source code: pixi/textures/Texture.js (Line 178)
<static> fromCanvas(canvas, scaleMode) → {PIXI.Texture}
Helper function that creates a new a Texture based on the given canvas element.
Parameters
Name | Type | Description |
---|---|---|
canvas | Canvas | The canvas element source of the texture |
scaleMode | Number | See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values |
Returns
destroy(destroyBase)
Destroys this texture
Parameters
Name | Type | Description |
---|---|---|
destroyBase | Boolean | Whether to destroy the base texture as well |
setFrame(frame)
Specifies the region of the baseTexture that this texture will use.
Parameters
Name | Type | Description |
---|---|---|
frame | Rectangle | The frame of the texture to set it to |
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/PIXI.Texture.html