BaseTexture Class
A texture stores the information that represents an image. All textures have a base texture
Constructor
BaseTexture
-
source
-
scaleMode
Parameters:
-
source
Stringthe source object (image or canvas)
-
scaleMode
IntShould be one of the PIXI.scaleMode consts
Item Index
Methods
- destroy
- dirty
- emit
- fromCanvas static
- fromImage static
- listeners
- off
- on
- once
- removeAllListeners
- updateSourceImage
Methods
destroy
()
Destroys this base texture
dirty
()
Sets all glTextures to be dirty.
emit
-
eventName
-
data
Emit an event to all registered event listeners.
Parameters:
-
eventName
StringThe name of the event.
-
data
Dynamic
Returns:
Indication if we've emitted an event.
fromCanvas
-
canvas
-
scaleMode
Helper function that returns a base texture based on a canvas element If the image is not in the base texture cache it will be created and loaded
Parameters:
-
canvas
CanvasThe canvas element source of the texture
-
scaleMode
IntShould be one of the PIXI.scaleMode consts
Returns:
BaseTexture
fromImage
-
imageUrl
-
crossorigin
-
scaleMode
Helper function that returns a base texture based on an image url If the image is not in the base texture cache it will be created and loaded
Parameters:
-
imageUrl
StringThe image url of the texture
-
crossorigin
Bool -
scaleMode
IntShould be one of the PIXI.scaleMode consts
Returns:
BaseTexture
listeners
-
eventName
Return a list of assigned event listeners.
Parameters:
-
eventName
StringThe events that should be listed.
Returns:
An array of listener functions
off
-
eventName
-
callback
Remove event listeners.
on
-
eventName
-
callback
Register a new EventListener for the given event.
Parameters:
-
eventName
StringName of the event.
-
callback
FunctonCallback function.
once
-
eventName
-
callback
Add an EventListener that's only called once.
removeAllListeners
-
eventName
Remove all listeners or only the listeners for the specified event.
Parameters:
-
eventName
StringThe event you want to remove all listeners for.
updateSourceImage
-
newSrc
Changes the source image of the texture
Parameters:
-
newSrc
Stringthe path of the image
Properties
hasLoaded
Bool
[read-only] Describes if the base texture has loaded or not
height
Float
[read-only] The height of the base texture set when the image has loaded
resolution
Float
The Resolution of the texture.
scaleMode
Float
The scale mode to apply when scaling this texture
source
Dynamic
The source that is loaded to create the texture
width
Float
[read-only] The width of the base texture set when the image has loaded