Class: Resource


Base resource class for textures that manages validation and uploading, depending on its type.

Uploading of a base texture to the GPU is required.

new PIXI.resources.Resource (width, height)

Name Type Default Description
width number 0 optional

Width of the resource

height number 0 optional

Height of the resource


_height number protected

Internal height of the resource

_width number protected

Internal width of the resource

destroyed boolean readonly

If resource has been destroyed

Default Value:
  • false

height number readonly

The height of the resource.

internal boolean protected

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

valid boolean readonly

Has been validated

width number readonly

The width of the resource.


PIXI.resources.Resource.test (source, extension) static

Abstract, used to auto-detect resource type

Name Type Description
source *

The source object

extension string

The extension of source, if set

bind (baseTexture)

Bind to a parent BaseTexture

Name Type Description
baseTexture PIXI.BaseTexture

Parent texture

destroy ()

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

dispose () protected

Clean up anything, this happens when destroying is ready.

load ()Promise.<void> protected

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

Type Description
Promise.<void> Handle the validate event

resize (width, height)

Trigger a resize event

Name Type Description
width number

X dimension

height number

Y dimension

style (renderer, baseTexture, glTexture)boolean

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

Type Description
boolean true is success

unbind (baseTexture)

Unbind to a parent BaseTexture

Name Type Description
baseTexture PIXI.BaseTexture

Parent texture

update ()

Has been updated trigger event