Texture Class
A texture stores the information that represents an image or part of an image. It cannot be added to the display list directly. To do this use PIXI.Sprite. If no frame is provided then the whole image is used
Constructor
Texture
-
baseTexture -
frame
Parameters:
-
baseTextureBaseTextureThe base texture source to create the texture from
-
frameRectangleThe rectangle frame of the texture to show
Item Index
Methods
Properties
Methods
addEventListener
-
type -
listener
Adds a listener for a specific event
Parameters:
-
typeStringA string representing the event type to listen for.
-
listenerFunctionThe callback function that will be fired when the event occurs
addTextureToCache
-
texture -
id
Adds a texture to the textureCache.
Parameters:
-
textureTexture -
idStringthe id that the texture will be stored against.
destroy
-
destroyBase
Destroys this texture
Parameters:
-
destroyBaseBooleanWhether to destroy the base texture as well
dispatchEvent
-
event
Fires the event, ie pretends that the event has happened
Parameters:
-
eventEventthe event object
fromCanvas
-
canvas
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
Parameters:
-
canvasCanvasThe canvas element source of the texture
Returns:
Texture
fromFrame
-
frameId
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
Parameters:
-
frameIdStringThe frame id of the texture
Returns:
Texture
fromImage
-
imageUrl -
crossorigin
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
Parameters:
-
imageUrlStringThe image url of the texture
-
crossoriginBooleanWhether requests should be treated as crossorigin
Returns:
Texture
onBaseTextureLoaded
-
event
Called when the base texture is loaded
Parameters:
-
eventObject
removeAllEventListeners
-
type
Removes all the listeners that were active for the specified event type
Parameters:
-
typeStringA string representing the event type which will have all its listeners removed
removeEventListener
-
type -
listener
Removes the specified listener that was assigned to the specified event type
Parameters:
-
typeStringA string representing the event type which will have its listener removed
-
listenerFunctionThe callback function that was be fired when the event occured
removeTextureFromCache
-
id
Remove a texture from the textureCache.
Parameters:
-
idStringthe id of the texture to be removed
Returns:
the texture that was removed
renderCanvas
-
displayObject -
clear
This function will draw the display object to the texture.
Parameters:
-
displayObjectDisplayObjectThe display object to render this texture on
-
clearBooleanIf true the texture will be cleared before the displayObject is drawn
renderWebGL
-
displayObject -
clear
This function will draw the display object to the texture.
Parameters:
-
displayObjectDisplayObjectThe display object to render this texture on
-
clearBooleanIf true the texture will be cleared before the displayObject is drawn
setFrame
-
frame
Specifies the rectangle region of the baseTexture
Parameters:
-
frameRectangleThe frame of the texture to set it to
Properties
height
Number
The height of the render texture
listeners
Object
Holds all the listeners
width
Number
The with of the render texture
