Class: BaseImageResource

PIXI.BaseImageResource

Base for all the image/canvas resources

new PIXI.BaseImageResource (source) overrides

Name Type Description
source HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | SVGElement

Extends

Members

source HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | SVGElement

The source element

Methods

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

Set cross origin based detecting the url and the crossorigin

Name Type Attributes Default Description
element HTMLElement

Element to apply crossOrigin

url string

URL to check

crossorigin boolean | string <optional>
true

Cross origin value to use

Destroy this BaseImageResource

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

Inherited Properties

From class PIXI.Resource

destroyed boolean inherited

If resource has been destroyed

Default Value:
  • false

height number inherited

The height of the resource.

valid boolean inherited

Has been validated

width number inherited

The width of the resource.

_height number protected inherited

Internal height of the resource

_width number protected inherited

Internal width of the resource

internal boolean protected inherited

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

Inherited Methods

From class PIXI.Resource

bind (baseTexture) void inherited

Bind to a parent BaseTexture

Name Type Description
baseTexture PIXI.BaseTexture

Parent texture

destroy () void inherited

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

resize (width, height) void inherited

Trigger a resize event

Name Type Description
width number

X dimension

height number

Y dimension

style (renderer, baseTexture, glTexture) boolean inherited

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) void inherited

Unbind to a parent BaseTexture

Name Type Description
baseTexture PIXI.BaseTexture

Parent texture

load () Promise protected inherited

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

Returns:
Type Description
Promise Handle the validate event