Class: Texture

PIXI. Texture

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 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:
src/pixi/textures/Texture.js line 25

Members

baseTexture : BaseTexture

The base texture that this texture uses.

Type:
  • BaseTexture
Source:
src/pixi/textures/Texture.js line 52

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)

Type:
  • Rectangle
Source:
src/pixi/textures/Texture.js line 134

frame : Rectangle

The frame specifies the region of the base texture that this texture uses

Type:
  • Rectangle
Source:
src/pixi/textures/Texture.js line 60

height : Number

The height of the Texture in pixels.

Type:
  • Number
Source:
src/pixi/textures/Texture.js line 125

isTiling : Boolean

Is this a tiling texture? As used by the likes of a TilingSprite.

Type:
  • Boolean
Source:
src/pixi/textures/Texture.js line 84

noFrame : Boolean

Does this Texture have any frame data assigned to it?

Type:
  • Boolean
Source:
src/pixi/textures/Texture.js line 33

requiresReTint : Boolean

This will let a renderer know that a tinted parent has updated its texture.

Type:
  • Boolean
Source:
src/pixi/textures/Texture.js line 100

requiresUpdate : Boolean

This will let a renderer know that a texture has been updated (used mainly for webGL uv updates)

Type:
  • Boolean
Source:
src/pixi/textures/Texture.js line 92

rotated : Boolean

A flag that controls if this frame is rotated or not. Rotation allows you to use rotated frames in texture atlas packing, it has nothing to do with Sprite rotation.

Type:
  • Boolean
Source:
src/pixi/textures/Texture.js line 144

trim : Rectangle

The texture trim data.

Type:
  • Rectangle
Source:
src/pixi/textures/Texture.js line 68

valid : Boolean

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

Type:
  • Boolean
Source:
src/pixi/textures/Texture.js line 76

width : Number

The width of the Texture in pixels.

Type:
  • Number
Source:
src/pixi/textures/Texture.js line 117

Methods

destroy(destroyBase)

Destroys this texture

Parameters:
Name Type Description
destroyBase Boolean

Whether to destroy the base texture as well

Source:
src/pixi/textures/Texture.js line 173

fromCanvas(canvas, scaleMode)

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

Source:
src/pixi/textures/Texture.js line 283
Returns:
Type
Texture

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

Source:
src/pixi/textures/Texture.js line 186

phaser-ce@2.20.1 is on GitHub and NPM

Documentation generated by JSDoc 3.6.11 on 2024-10-05 using Tomorrow.