Class: ImageAsset
ImageAsset represents a graphical image asset that has been loaded/ attempted to be loaded. Stores meta info around the image, such as a name, the success of the image being loaded, and any errors from loading it. Also stores the image itself.
Table of contents
Constructors
Properties
Constructors
constructor
+ new ImageAsset(name
: string, image
: HTMLImageElement | ImageData, success
: boolean, xWrap
: TextureWrapping, yWrap
: TextureWrapping, magFilter
: TextureFiltering, minFilter
: TextureFiltering, generateMipmaps
: boolean, mirror
: boolean, error?
: Error): ImageAsset
Parameters:
Name | Type |
---|---|
name |
string |
image |
HTMLImageElement | ImageData |
success |
boolean |
xWrap |
TextureWrapping |
yWrap |
TextureWrapping |
magFilter |
TextureFiltering |
minFilter |
TextureFiltering |
generateMipmaps |
boolean |
mirror |
boolean |
error? |
Error |
Returns: ImageAsset
Properties
error
• Optional
error: undefined | Error
An optional field, contains any error from loading the image, if there is none it will be undefined.
generateMipmaps
• generateMipmaps: boolean
Texture option for generating mipmaps or not. True = generate mipmaps, false = don't generate mipmaps.
image
• image: HTMLImageElement | ImageData
The actual image.
magFilter
• magFilter: TextureFiltering
Texture magnification filter.
minFilter
• minFilter: TextureFiltering
Texture minification filter.
mirror
• mirror: boolean
Option for mirroring the texture when loading it (vertical and horizontal flip). True = mirror, false = don't mirror.
name
• name: string
Name of the image asset, how it is referred to throughout the system, should be unique.
success
• success: boolean
A boolean indicating the success of loading the image, true = successful load, false = failed loading.
xWrap
• xWrap: TextureWrapping
Texture wrapping along x axis.
yWrap
• yWrap: TextureWrapping
Texture wrapping along y axis.
MESSAGE_FINISH_LOAD
▪ Readonly
Static
MESSAGE_FINISH_LOAD: finish_image_load= "finish_image_load"
Message when an image asset is finished loading.