#

API Docs for: 1.6.0
Show: Inherited Protected Private Deprecated

# BaseTexture Class

Uses

- EventTarget

Defined in: `src/pixi/textures/BaseTexture.js:11`
Module: PIXI

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

## Constructor

### `BaseTexture`

(

- `source`
- `scaleMode`

)

Defined in `src/pixi/textures/BaseTexture.js:11`

#### Parameters:

- `source` String

  the source object (image or canvas)

- `scaleMode` Number

  Should be one of the PIXI.scaleMode consts

- Index
- Methods
- Properties

## Item Index

### Methods

- addEventListener
- destroy
- dispatchEvent
- fromCanvas static
- fromImage static
- removeAllEventListeners
- removeEventListener
- updateSourceImage

### Properties

- hasLoaded
- height
- scaleMode
- source
- width
- listeners

## Methods

### `addEventListener`

(

- `type`
- `listener`

)

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:32`

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`

()

Defined in `src/pixi/textures/BaseTexture.js:127`

Destroys this base texture

### `dispatchEvent`

(

- `event`

)

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:55`

Fires the event, ie pretends that the event has happened

#### Parameters:

- `event` Event

  the event object

### `fromCanvas`

(

- `canvas`
- `scaleMode`

)
static

Defined in `src/pixi/textures/BaseTexture.js:197`

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

Defined in `src/pixi/textures/BaseTexture.js:162`

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`

)

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:101`

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`

)

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:80`

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`

)

Defined in `src/pixi/textures/BaseTexture.js:149`

Changes the source image of the texture

#### Parameters:

- `newSrc` String

  the path of the image

## Properties

### `hasLoaded`

Boolean

Defined in `src/pixi/textures/BaseTexture.js:50`

[read-only] Describes if the base texture has loaded or not

### `height`

Number

Defined in `src/pixi/textures/BaseTexture.js:33`

[read-only] The height of the base texture set when the image has loaded

### `scaleMode`

PIXI.scaleModes

Defined in `src/pixi/textures/BaseTexture.js:42`

The scale mode to apply when scaling this texture

Default: PIXI.scaleModes.LINEAR

### `source`

Image

Defined in `src/pixi/textures/BaseTexture.js:59`

The source that is loaded to create the texture

### `width`

Number

Defined in `src/pixi/textures/BaseTexture.js:24`

[read-only] The width of the base texture set when the image has loaded

### ``

Boolean

Defined in `src/pixi/textures/BaseTexture.js:70`

Controls if RGB channels should be premultiplied by Alpha (WebGL only)

Default: TRUE

### `listeners`

Object

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:24`

Holds all the listeners