BaseTexture Class
A texture stores the information that represents an image. All textures have a base texture
Constructor
BaseTexture
-
source -
scaleMode
Parameters:
-
sourceStringthe source object (image or canvas)
-
scaleModeNumberShould be one of the PIXI.scaleMode consts
Item Index
Methods
- destroy
- emit
- fromCanvas static
- fromImage static
- listeners
- mixin
- off
- on
- once
- removeAllListeners
- updateSourceImage
Methods
destroy
()
Destroys this base texture
emit
-
eventName
Emit an event to all registered event listeners.
Parameters:
-
eventNameStringThe name of the event.
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:
-
canvasCanvasThe canvas element source of the texture
-
scaleModeNumberShould 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:
-
imageUrlStringThe image url of the texture
-
crossoriginBoolean -
scaleModeNumberShould be one of the PIXI.scaleMode consts
Returns:
BaseTexture
listeners
-
eventName
Return a list of assigned event listeners.
Parameters:
-
eventNameStringThe events that should be listed.
Returns:
An array of listener functions
mixin
-
object
Mixes in the properties of the EventTarget prototype onto another object
Parameters:
-
objectObjectThe obj to mix into
off
-
eventName -
callback
Remove event listeners.
Parameters:
-
eventNameStringThe event we want to remove.
-
callbackFunctionThe listener that we need to find.
on
-
eventName -
callback
Register a new EventListener for the given event.
Parameters:
-
eventNameStringName of the event.
-
callbackFunctonfn Callback function.
once
-
eventName -
callback
Add an EventListener that's only called once.
Parameters:
-
eventNameStringName of the event.
-
callbackFunctionCallback function.
removeAllListeners
-
eventName
Remove all listeners or only the listeners for the specified event.
Parameters:
-
eventNameStringThe event you want to remove all listeners for.
updateSourceImage
-
newSrc
Changes the source image of the texture
Parameters:
-
newSrcStringthe path of the image
Properties
hasLoaded
Boolean
[read-only] Describes if the base texture has loaded or not
height
Number
[read-only] The height of the base texture set when the image has loaded
resolution
Number
The Resolution of the texture.
scaleMode
PIXI.scaleModes
The scale mode to apply when scaling this texture
Default: PIXI.scaleModes.LINEAR
source
Image
The source that is loaded to create the texture
width
Number
[read-only] The width of the base texture set when the image has loaded
Controls if RGB channels should be premultiplied by Alpha (WebGL only)
Default: TRUE
