new PIXI.ImageResource (source, options) overrides
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
source |
HTMLImageElement | string |
image source or URL |
||
options |
object |
<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 |
Extends
Members
alphaMode PIXI.ALPHA_MODES | unknown
Controls texture alphaMode field
Copies from options
Default is null
, copies option from baseTexture
The ImageBitmap element created for HTMLImageElement
- Default Value:
- null
If capable, convert the image using createImageBitmap API
- Default Value:
- PIXI.settings.CREATE_IMAGE_BITMAP
- See:
-
- PIXI.ImageResource#alphaMode
If the image should be disposed after upload
- Default Value:
- false
URL of the image source
Methods
Used to auto-detect the type of resource.
Name | Type | Description |
---|---|---|
source |
string | HTMLImageElement |
The source object |
Returns:
Type | Description |
---|---|
boolean | true if source is string or HTMLImageElement |
dispose () void overrides
Destroys this texture
load
(createBitmap) Promise
overrides
returns a promise when image will be loaded and processed
Name | Type | Attributes | Description |
---|---|---|---|
createBitmap |
boolean |
<optional> |
whether process image into bitmap |
Returns:
Type | Description |
---|---|
Promise |
Called when we need to convert image into BitmapImage. Can be called multiple times, real promise is cached inside.
Returns:
Type | Description |
---|---|
Promise |
cached promise to fill that bitmap |
upload (renderer, baseTexture, glTexture) boolean overrides
Upload the image resource to GPU.
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 |
Inherited Properties
From class PIXI.BaseImageResource
source HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | SVGElement inherited
The source element
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.BaseImageResource
update () void inherited
Checks if source width/height was changed, resize can cause extra baseTexture update. Triggers one update in any case.
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 |