Class: PIXI.BaseTexture
Constructor
new BaseTexture(source, scaleMode)
A texture stores the information that represents an image. All textures have a base texture.
Parameters
Name | Type | Description |
---|---|---|
source | String | Canvas | the source object (image or canvas) |
scaleMode | Number | See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values |
- Source code: pixi/textures/BaseTexture.js (Line 5)
Public Properties
- Source code: pixi/textures/BaseTexture.js (Line 51)
- Source code: pixi/textures/BaseTexture.js (Line 33)
- Source code: pixi/textures/BaseTexture.js (Line 86)
- Default Value
- true
- Source code: pixi/textures/BaseTexture.js (Line 68)
- Source code: pixi/textures/BaseTexture.js (Line 16)
- Default Value
- PIXI.scaleModes.LINEAR
- Source code: pixi/textures/BaseTexture.js (Line 42)
- Source code: pixi/textures/BaseTexture.js (Line 115)
- Source code: pixi/textures/BaseTexture.js (Line 60)
- Source code: pixi/textures/BaseTexture.js (Line 24)
[readonly] hasLoaded : boolean
[read-only] Set to true once the base texture has loaded
[readonly] height : number
[read-only] The height of the base texture set when the image has loaded
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
premultipliedAlpha : boolean
Controls if RGB channels should be pre-multiplied by Alpha (WebGL only)
resolution : number
The Resolution of the texture.
scaleMode : number
The scale mode to apply when scaling this texture
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.
source :Image
The image source that is used to create the texture.
[readonly] width : number
[read-only] The width of the base texture set when the image has loaded
Public Methods
- Source code: pixi/textures/BaseTexture.js (Line 224)
- Source code: pixi/textures/BaseTexture.js (Line 154)
- Source code: pixi/textures/BaseTexture.js (Line 183)
- The new width to force the BaseTexture to be.
- The new height to force the BaseTexture to be.
- Source code: pixi/textures/BaseTexture.js (Line 137)
- Source code: pixi/textures/BaseTexture.js (Line 196)
- This method is deprecated and should not be used. It may be removed in the future.
- Deprecated:
- true
- Source code: pixi/textures/BaseTexture.js (Line 171)
<static> fromCanvas(canvas, scaleMode) → {PIXI.BaseTexture}
Helper function that creates a base texture from 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()
Destroys this base texture
dirty()
Sets all glTextures to be dirty.
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 | |
height | Number |
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.
updateSourceImage(newSrc)
Changes the source image of the texture
Parameters
Name | Type | Description |
---|---|---|
newSrc | String | the path of the image |
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/PIXI.BaseTexture.html