Class: BaseTexture

PIXI. BaseTexture

new BaseTexture(source, scaleMode [, resolution])

A texture stores the information that represents an image. All textures have a base texture.

Parameters:
Name Type Argument Description
source HTMLCanvasElement | HTMLImageElement | HTMLVideoElement

the source object (image or canvas)

scaleMode number

See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values

resolution number <optional>

the resolution of the texture (for HiDPI displays)

Source:
src/pixi/textures/BaseTexture.js line 14

Members

<readonly> hasLoaded : boolean

[read-only] Set to true once the base texture has loaded

Type:
  • boolean
Source:
src/pixi/textures/BaseTexture.js line 58

<readonly> height : number

[read-only] The height of the base texture set when the image has loaded

Type:
  • number
Source:
src/pixi/textures/BaseTexture.js line 40

mipmap : boolean

Set this to true if a mipmap of this texture needs to be generated. This value needs to be set before the texture is used Also the texture must be a power of two size to work

Type:
  • boolean
Source:
src/pixi/textures/BaseTexture.js line 93

premultipliedAlpha : boolean

Controls if RGB channels should be pre-multiplied by Alpha (WebGL only)

Type:
  • boolean
Default Value:
  • true
Source:
src/pixi/textures/BaseTexture.js line 75

resolution : number

The Resolution of the texture.

Type:
  • number
Source:
src/pixi/textures/BaseTexture.js line 22

scaleMode : number

The scale mode to apply when scaling this texture

Type:
  • number
Default Value:
  • PIXI.scaleModes.LINEAR
Source:
src/pixi/textures/BaseTexture.js line 49

skipRender : boolean

A BaseTexture can be set to skip the rendering phase in the WebGL Sprite Batch.

You may want to do this if you have a parent Sprite with no visible texture (i.e. uses the internal __default texture) that has children that you do want to render, without causing a batch flush in the process.

Type:
  • boolean
Source:
src/pixi/textures/BaseTexture.js line 131

source : HTMLCanvasElement | HTMLImageElement | HTMLVideoElement

The image source that is used to create the texture.

Type:
  • HTMLCanvasElement | HTMLImageElement | HTMLVideoElement
Source:
src/pixi/textures/BaseTexture.js line 66

textureIndex : number

The multi texture batching index number.

Type:
  • number
Source:
src/pixi/textures/BaseTexture.js line 100

<readonly> width : number

[read-only] The width of the base texture set when the image has loaded

Type:
  • number
Source:
src/pixi/textures/BaseTexture.js line 31

Methods

destroy()

Destroys this base texture

Source:
src/pixi/textures/BaseTexture.js line 160

dirty()

Sets all glTextures to be dirty.

Source:
src/pixi/textures/BaseTexture.js line 177

forceLoaded(width, height)

Forces this BaseTexture to be set as loaded, with the given width and height. Then calls BaseTexture.dirty. Important for when you don't want to modify the source object by forcing in complete or dimension properties it may not have.

Parameters:
Name Type Description
width number

The new width to force the BaseTexture to be.

height number

The new height to force the BaseTexture to be.

Source:
src/pixi/textures/BaseTexture.js line 143

fromCanvas(canvas, scaleMode [, resolution])

Helper function that creates a base texture from the given canvas element.

Parameters:
Name Type Argument Description
canvas HTMLCanvasElement

The canvas element source of the texture

scaleMode number

See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values

resolution number <optional>

the resolution of the texture (for HiDPI displays)

Source:
src/pixi/textures/BaseTexture.js line 217
Returns:
Type
PIXI.BaseTexture

unloadFromGPU()

Removes the base texture from the GPU, useful for managing resources on the GPU. Atexture is still 100% usable and will simply be reuploaded if there is a sprite on screen that is using it.

Source:
src/pixi/textures/BaseTexture.js line 190

phaser-ce@2.20.0 is on GitHub and NPM

Documentation generated by JSDoc 3.6.7 on 2022-12-10 using Tomorrow.