#

API Docs for: 2.0.0
Show: Inherited Protected Private Deprecated

# BaseTexture Class

Uses

- EventTarget

Defined in: `src/pixi/textures/BaseTexture.js:9`
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:9`

#### 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

- destroy
- dirty
- emit
- fromCanvas static
- fromImage static
- listeners
- mixin
- off
- on
- once
- removeAllListeners
- updateSourceImage

### Properties

- _dirty
- _glTextures
- _powerOf2
- hasLoaded
- height
- imageUrl
- premultipliedAlpha
- resolution
- scaleMode
- source
- width

## Methods

### `destroy`

()

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

Destroys this base texture

### `dirty`

()

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

Sets all glTextures to be dirty.

### `emit`

(

- `eventName`

)
Boolean

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

Emit an event to all registered event listeners.

#### Parameters:

- `eventName` String

  The name of the event.

#### Returns:

Boolean:

Indication if we've emitted an event.

### `fromCanvas`

(

- `canvas`
- `scaleMode`

)
static

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

Helper function that creates a base texture from the given canvas element.

#### 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:212`

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` String

  The image url of the texture

- `crossorigin` Boolean
- `scaleMode` Number

  Should be one of the PIXI.scaleMode consts

#### Returns:

BaseTexture

### `listeners`

(

- `eventName`

)
Array

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

Return a list of assigned event listeners.

#### Parameters:

- `eventName` String

  The events that should be listed.

#### Returns:

Array:

An array of listener functions

### `mixin`

(

- `object`

)

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

Mixes in the properties of the EventTarget prototype onto another object

#### Parameters:

- `object` Object

  The obj to mix into

### `off`

(

- `eventName`
- `callback`

)

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

Remove event listeners.

#### Parameters:

- `eventName` String

  The event we want to remove.

- `callback` Function

  The listener that we need to find.

### `on`

(

- `eventName`
- `callback`

)

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

Register a new EventListener for the given event.

#### Parameters:

- `eventName` String

  Name of the event.

- `callback` Functon

  fn Callback function.

### `once`

(

- `eventName`
- `callback`

)

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

Add an EventListener that's only called once.

#### Parameters:

- `eventName` String

  Name of the event.

- `callback` Function

  Callback function.

### `removeAllListeners`

(

- `eventName`

)

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

Remove all listeners or only the listeners for the specified event.

#### Parameters:

- `eventName` String

  The event you want to remove all listeners for.

### `updateSourceImage`

(

- `newSrc`

)

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

Changes the source image of the texture

#### Parameters:

- `newSrc` String

  the path of the image

## Properties

### `_dirty`

Array private

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

### `_glTextures`

Array private

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

### `_powerOf2`

Boolean private

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

### `hasLoaded`

Boolean

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

[read-only] Set to true once the base texture has loaded

### `height`

Number

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

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

### `imageUrl`

String

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

### `premultipliedAlpha`

Boolean

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

Controls if RGB channels should be pre-multiplied by Alpha (WebGL only)

Default: true

### `resolution`

Number

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

The Resolution of the texture.

### `scaleMode`

PIXI.scaleModes

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

The scale mode to apply when scaling this texture

Default: PIXI.scaleModes.LINEAR

### `source`

Image

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

The image source that is used to create the texture.

### `width`

Number

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

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