API Docs for: 1.5.3
Show:

BaseTexture Class

A texture stores the information that represents an image. All textures have a base texture

Constructor

BaseTexture

(
  • source
  • scaleMode
)

Parameters:

  • source String

    the source object (image or canvas)

  • scaleMode Number

    Should be one of the PIXI.scaleMode consts

Methods

addEventListener

(
  • type
  • listener
)

Adds a listener for a specific event

Parameters:

  • type String

    A string representing the event type to listen for.

  • listener Function

    The callback function that will be fired when the event occurs

destroy

()

Destroys this base texture

dispatchEvent

(
  • event
)

Fires the event, ie pretends that the event has happened

Parameters:

  • event Event

    the event object

fromCanvas

(
  • canvas
  • scaleMode
)
static

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 Canvas

    The canvas element source of the texture

  • scaleMode Number

    Should be one of the PIXI.scaleMode consts

Returns:

BaseTexture

fromImage

(
  • imageUrl
  • crossorigin
  • scaleMode
)
static

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 String

    The image url of the texture

  • crossorigin Boolean
  • scaleMode Number

    Should be one of the PIXI.scaleMode consts

Returns:

BaseTexture

removeAllEventListeners

(
  • type
)

Removes all the listeners that were active for the specified event type

Parameters:

  • type String

    A 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:

  • type String

    A string representing the event type which will have its listener removed

  • listener Function

    The callback function that was be fired when the event occured

updateSourceImage

(
  • newSrc
)

Changes the source image of the texture

Parameters:

  • newSrc String

    the 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

listeners

Object

Holds all the listeners

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