PIXI.ImageResource

class ImageResource extends PIXI.BaseImageResource

Resource type for HTMLImageElement.

Constructor


new PIXI.ImageResource(source: HTMLImageElement | string, options: IImageResourceOptions) → {}
Parameters:
Name Type Attributes Default Description
source HTMLImageElement | string

image source or URL

options IImageResourceOptions

<optional>

options.autoLoad boolean

<optional>

true

start loading process

options.createBitmap boolean

<optional>

PIXI.settings.CREATE_IMAGE_BITMAP

whether its required to create a bitmap before upload

options.crossorigin boolean

<optional>

true

Load image using cross origin

options.alphaMode PIXI.ALPHA_MODES

<optional>

PIXI.ALPHA_MODES.UNPACK

Premultiply image alpha in bitmap

Summary


Properties from ImageResource

Methods from ImageResource

Properties inherited from BaseImageResource

HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | SVGElement
source

Properties inherited from Resource

boolean
destroyed = false
number
height
boolean
internal
string
src

The url of the resource

boolean
valid
number
width
number
protected _height

Internal height of the resource.

number
protected _width

Internal width of the resource.

Methods inherited from BaseImageResource

void
update()

Public Properties


alphaMode ImageResource.ts:45
alphaMode: PIXI.ALPHA_MODES

Controls texture alphaMode field Copies from options Default is null, copies option from baseTexture

bitmap ImageResource.ts:53
bitmap: ImageBitmap = null

The ImageBitmap element created for a HTMLImageElement.

createBitmap ImageResource.ts:39
createBitmap: boolean = PIXI.settings.CREATE_IMAGE_BITMAP

If capable, convert the image using createImageBitmap API.

preserveBitmap ImageResource.ts:33
preserveBitmap: boolean = false

If the image should be disposed after upload

url ImageResource.ts:30
url: string

URL of the image source

Public Methods


test ImageResource.ts:313
static test(source: unknown) → {boolean}

Used to auto-detect the type of resource.

Parameters:
Name Type Description
source unknown

The source object

Returns:
Type Description
boolean

true if source is string or HTMLImageElement

dispose ImageResource.ts:296
dispose() → {void}

Destroys this resource.

Returns:
Type Description
void
load ImageResource.ts:121
load(createBitmap: boolean) → {Promise<PIXI.ImageResource>}

Returns a promise when image will be loaded and processed.

Parameters:
Name Type Attributes Description
createBitmap boolean

<optional>

whether process image into bitmap

Returns:
Type Description
Promise<PIXI.ImageResource>
process ImageResource.ts:184
process() → {Promise<PIXI.ImageResource>}

Called when we need to convert image into BitmapImage. Can be called multiple times, real promise is cached inside.

Returns:
Type Description
Promise<PIXI.ImageResource>
  • Cached promise to fill that bitmap
upload ImageResource.ts:231
upload(renderer: PIXI.Renderer, baseTexture: PIXI.BaseTexture, glTexture: PIXI.GLTexture) → {boolean}

Upload the image resource to GPU.

Parameters:
Name Type Description
renderer PIXI.Renderer

Renderer to upload to

baseTexture PIXI.BaseTexture

BaseTexture for this resource

glTexture PIXI.GLTexture

GLTexture to use

Returns:
Type Description
boolean

true is success


Powered by webdoc!