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
NumberShould be one of the PIXI.scaleMode consts
Item Index
Methods
- destroy
- dirty
- emit
- fromCanvas static
- fromImage static
- listeners
- mixin
- off
- on
- once
- removeAllListeners
- updateSourceImage
Methods
destroy
()
Destroys this base texture
dirty
()
Sets all glTextures to be dirty.
emit
-
eventName
Emit an event to all registered event listeners.
Parameters:
-
eventName
StringThe name of the event.
Returns:
Indication if we've emitted an event.
fromCanvas
-
canvas
-
scaleMode
Helper function that creates a base texture from the given canvas element.
Parameters:
-
canvas
CanvasThe canvas element source of the texture
-
scaleMode
NumberShould be one of the PIXI.scaleMode consts
Returns:
BaseTexture
fromImage
-
imageUrl
-
crossorigin
-
scaleMode
Helper function that creates a base texture from the given 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
Boolean -
scaleMode
NumberShould 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
mixin
-
object
Mixes in the properties of the EventTarget prototype onto another object
Parameters:
-
object
ObjectThe obj to mix into
off
-
eventName
-
callback
Remove event listeners.
Parameters:
-
eventName
StringThe event we want to remove.
-
callback
FunctionThe listener that we need to find.
on
-
eventName
-
callback
Register a new EventListener for the given event.
Parameters:
-
eventName
StringName of the event.
-
callback
Functonfn Callback function.
once
-
eventName
-
callback
Add an EventListener that's only called once.
Parameters:
-
eventName
StringName of the event.
-
callback
FunctionCallback function.
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
_dirty
Array
private
_glTextures
Array
private
_powerOf2
Boolean
private
hasLoaded
Boolean
[read-only] Set to true once the base texture has loaded
height
Number
[read-only] The height of the base texture set when the image has loaded
imageUrl
String
premultipliedAlpha
Boolean
Controls if RGB channels should be pre-multiplied by Alpha (WebGL only)
Default: true
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 image source that is used to create the texture.
width
Number
[read-only] The width of the base texture set when the image has loaded