Class: BaseImageResource

PIXI.resources~BaseImageResource

Base for all the image/canvas resources

new BaseImageResource (source)

Name Type Description
source HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | SVGElement

Extends

Members

_height number protected inherited overrides

Internal height of the resource

_width number protected inherited overrides

Internal width of the resource

destroyed boolean readonly inherited overrides

If resource has been destroyed

Default Value:
  • false

height number readonly inherited overrides

The height of the resource.

internal boolean protected inherited overrides

true if resource is created by BaseTexture useful for doing cleanup with BaseTexture destroy and not cleaning up resources that were created externally.

source HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | SVGElement readonly

The source element

valid boolean readonly inherited overrides

Has been validated

width number readonly inherited overrides

The width of the resource.

Methods

PIXI.resources.BaseImageResource.crossOrigin (element, url, crossorigin) protectedstatic

Set cross origin based detecting the url and the crossorigin

Name Type Default Description
element HTMLElement

Element to apply crossOrigin

url string

URL to check

crossorigin boolean | string true optional

Cross origin value to use

bind (baseTexture) inherited overrides

Bind to a parent BaseTexture

Name Type Description
baseTexture PIXI.BaseTexture

Parent texture

Call when destroying resource, unbind any BaseTexture object before calling this method, as reference counts are maintained internally.

dispose (fromTexture)boolean protected inherited overrides

Destroy this BaseImageResource

Name Type Description
fromTexture PIXI.BaseTexture optional

Optional base texture

Returns:
Type Description
boolean Destroy was successful

load ()Promise.<void> protected inherited overrides

This can be overridden to start preloading a resource or do any other prepare step.

Returns:
Type Description
Promise.<void> Handle the validate event

resize (width, height) inherited overrides

Trigger a resize event

Name Type Description
width number

X dimension

height number

Y dimension

style (renderer, baseTexture, glTexture)boolean inherited overrides

Set the style, optional to override

Name Type Description
renderer PIXI.Renderer

yeah, renderer!

baseTexture PIXI.BaseTexture

the texture

glTexture PIXI.GLTexture

texture instance for this webgl context

Returns:
Type Description
boolean true is success

unbind (baseTexture) inherited overrides

Unbind to a parent BaseTexture

Name Type Description
baseTexture PIXI.BaseTexture

Parent texture

Checks if source width/height was changed, resize can cause extra baseTexture update. Triggers one update in any case.

upload (renderer, baseTexture, glTexture, source)boolean overrides

Upload the texture to the GPU.

Name Type Description
renderer PIXI.Renderer

Upload to the renderer

baseTexture PIXI.BaseTexture

Reference to parent texture

glTexture PIXI.GLTexture
source HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | SVGElement optional

(optional)

Returns:
Type Description
boolean true is success