Image asset class. More...
Public Member Functions | |
ImageAsset (string filename, bool asyncLoad) | |
Creates a new instance from a specified image file. | |
ImageAsset (string filename) | |
Creates a new instance from a specified image file. | |
ImageAsset (SystemImageAsset name) | |
Creates a new instance for a specified system image asset. | |
ImageAsset (Texture2D texture) | |
Creates a new instance from a specified existing texture. | |
ImageAsset (Image image, PixelFormat format) | |
Creates a new instance from a specified existing image. | |
ImageAsset (Image image) | |
Creates a new instance from a specified existing image. | |
ImageAsset (string filename, bool asyncLoad, bool scaledPixelDensity) | |
Creates a new instance from a specified image file. | |
ImageAsset (Texture2D texture, bool scaledPixelDensity) | |
Creates a new instance from a specified existing texture. | |
ImageAsset (Image image, PixelFormat format, bool scaledPixelDensity) | |
Creates a new instance from a specified existing image. | |
ImageAsset (Image image, bool scaledPixelDensity) | |
Creates a new instance from a specified existing image. | |
Texture2D | CloneTexture () |
Obtains texture duplicates. | |
void | WaitForLoad () |
Waits until the file is loaded. | |
void | Dispose () |
Frees used resources. | |
bool | UnloadFromCache () |
Deletes the ImageAsset cache loaded from an image file. | |
Static Public Member Functions | |
static void | WaitForLoadAll () |
Waits until the asynchronous loading of all images completes. | |
static bool | UnloadFromCache (string filename) |
Deletes the ImageAsset cache loaded from a file. | |
Properties | |
bool | Ready [get] |
Obtains whether image asset loading is completed. | |
int | Width [get] |
Obtains the width of an image asset. | |
int | Height [get] |
Obtains the height of an image asset. | |
string | FilePath [get] |
Obtains the image file path. |
Image asset class.
Class concealing texture loading. Asynchronous loading of image files and caching is supported. When ImageAsset has been created from an image file, the texture is cached. If an ImageAsset with the same filename is created from this cache, the unmanaged resources of the texture will be shared. Note that the cache will not be freed with just Dispose or garbage collection. For ImageAssets that are no longer used, after calling UnloadFromCache, call all Disposes for the ImageAssets of the same image files.
ImageAsset | ( | string | filename, |
bool | asyncLoad | ||
) |
Creates a new instance from a specified image file.
Once loaded, it will be cached. For those that are no longer used, call UnloadFromCache.
filename | Image filename |
asyncLoad | Whether or not asynchronous loading is performed |
ImageAsset | ( | string | filename | ) |
Creates a new instance from a specified image file.
Performs synchronous loading. Once loaded, it will be cached. For those that are no longer used, call UnloadFromCache.
filename | Image filename |
ImageAsset | ( | SystemImageAsset | name | ) |
Creates a new instance for a specified system image asset.
Image assets used for standard widgets, etc. Performs asynchronous loading.
name | System image asset |
ImageAsset | ( | Texture2D | texture | ) |
Creates a new instance from a specified existing texture.
Will not be cached. To hold the ShallowClone of a texture in ImageAsset, use Dispose on the instance for the texture specified in the argument as required.
texture | Textures |
ImageAsset | ( | Image | image, |
PixelFormat | format | ||
) |
Creates a new instance from a specified existing image.
Will not be cached. Use Dispose on the instance for the image specified in the argument as required.
image | Existing image |
format | Pixel format of specified existing image |
ImageAsset | ( | Image | image | ) |
Creates a new instance from a specified existing image.
Will not be cached. Use Dispose on the instance for the image specified in the argument as required.
image | Existing image |
ImageAsset | ( | string | filename, |
bool | asyncLoad, | ||
bool | scaledPixelDensity | ||
) |
Creates a new instance from a specified image file.
Once loaded, it will be cached. For those that are no longer used, call UnloadFromCache.
filename | Image filename |
asyncLoad | Whether or not asynchronous loading is performed |
scaledPixelDensity | Whether or not to scale according to the pixel density |
ImageAsset | ( | Texture2D | texture, |
bool | scaledPixelDensity | ||
) |
Creates a new instance from a specified existing texture.
Will not be cached. To hold the ShallowClone of a texture in ImageAsset, use Dispose on the instance for the texture specified in the argument as required.
texture | Textures |
scaledPixelDensity | Whether or not to scale according to the pixel density |
ImageAsset | ( | Image | image, |
PixelFormat | format, | ||
bool | scaledPixelDensity | ||
) |
Creates a new instance from a specified existing image.
Will not be cached. Use Dispose on the instance for the image specified in the argument as required.
image | Existing image |
format | Pixel format of specified existing image |
scaledPixelDensity | Whether or not to scale according to the pixel density |
ImageAsset | ( | Image | image, |
bool | scaledPixelDensity | ||
) |
Creates a new instance from a specified existing image.
Will not be cached. Use Dispose on the instance for the image specified in the argument as required.
image | Existing image |
scaledPixelDensity | Whether or not to scale according to the pixel density |
Texture2D CloneTexture | ( | ) |
Obtains texture duplicates.
Returns the ShallowClone of the texture. If texture loading is not yet completed during asynchronous loading, null is returned.
void Dispose | ( | ) |
Frees used resources.
Calls Dispose for a texture held by this instance. When ImageAsset is loaded from an image file, the cached texture is not freed. For complete release, UnloadFromCache must be called.
bool UnloadFromCache | ( | ) |
Deletes the ImageAsset cache loaded from an image file.
Frees a cached texture. Only textures in a cache are freed, so it is possible to continue using this instance. To free unmanaged resources of the target texture without waiting for garbage collection, Dispose must be called.
static bool UnloadFromCache | ( | string | filename | ) | [static] |
Deletes the ImageAsset cache loaded from a file.
filename | Filename |
void WaitForLoad | ( | ) |
Waits until the file is loaded.
Returns quickly if loaded synchronously or if already loaded.
string FilePath [get] |
Obtains the image file path.
Returns null when a file is not created.
int Height [get] |
Obtains the height of an image asset.
If loading is not yet completed during asynchronous loading, 0 is returned.
bool Ready [get] |
Obtains whether image asset loading is completed.
"true" returns if a non-image file is loaded or if loaded synchronously.
int Width [get] |
Obtains the width of an image asset.
If loading is not yet completed during asynchronous loading, 0 is returned