Class ImageUtility
Utility component helping dealing with Texture2D and Sprite objects.
Inheritance
System.Object
ImageUtility
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Appearition.Common
Assembly: Appearition.SDK.dll
Syntax
public static class ImageUtility
Methods
View SourceDeleteAllTexturesLoadedInMemory()
Declaration
public static void DeleteAllTexturesLoadedInMemory()
GetPictureSavePath(String, String, String, Boolean, Boolean)
Returns a valid picture path based on the original path (if any. If not, the default appearition will be used.) and name.
Declaration
public static string GetPictureSavePath(string url, string folderPath, string fileName, bool avoidExisting = true, bool forceExtension = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | |
System.String | folderPath | Folder path. |
System.String | fileName | |
System.Boolean | avoidExisting | |
System.Boolean | forceExtension |
Returns
Type | Description |
---|---|
System.String | The picture save path. |
LoadOrCreateSprite(Byte[], String, Single)
Using given ApiData, creates a Sprite object.
Declaration
public static Sprite LoadOrCreateSprite(byte[] bytes, string checksum = "", float pixelsPerUnit = 100F)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | |
System.String | checksum | |
System.Single | pixelsPerUnit |
Returns
Type | Description |
---|---|
UnityEngine.Sprite |
LoadOrCreateSprite(String, String, Single)
Loads a picture from a given file path, and returns it as a Sprite object.
Declaration
public static Sprite LoadOrCreateSprite(string filePath, string checksum = "", float pixelsPerUnit = 100F)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | |
System.String | checksum | |
System.Single | pixelsPerUnit |
Returns
Type | Description |
---|---|
UnityEngine.Sprite |
LoadOrCreateSprite(Texture2D, String, Single)
Using a given Texture, creates a Sprite object.
Declaration
public static Sprite LoadOrCreateSprite(Texture2D tmpTexture, string checksum = "", float pixelPerUnit = 100F)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Texture2D | tmpTexture | |
System.String | checksum | |
System.Single | pixelPerUnit |
Returns
Type | Description |
---|---|
UnityEngine.Sprite |
LoadOrCreateSpriteAsync(String, String, Action<Sprite>, Single)
Loads a sprite at a given file path.
Declaration
public static IEnumerator LoadOrCreateSpriteAsync(string filePath, string checksum = "", Action<Sprite> onTextureLoaded = null, float pixelPerUnit = 100F)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | |
System.String | checksum | |
System.Action<UnityEngine.Sprite> | onTextureLoaded | |
System.Single | pixelPerUnit |
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |
LoadOrCreateTexture(Byte[], String)
Creates a texture from given ApiData.
Declaration
public static Texture2D LoadOrCreateTexture(byte[] bytes, string checksum = "")
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | |
System.String | checksum |
Returns
Type | Description |
---|---|
UnityEngine.Texture2D |
LoadOrCreateTexture(String, String)
Loads a texture from a given path.
Declaration
public static Texture2D LoadOrCreateTexture(string filePath, string checksum = "")
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | |
System.String | checksum |
Returns
Type | Description |
---|---|
UnityEngine.Texture2D |
LoadOrCreateTextureAsync(String, String, Action<Texture2D>)
Loads a texture at a given file path.
Declaration
public static IEnumerator LoadOrCreateTextureAsync(string filePath, string checksum = "", Action<Texture2D> onTextureLoaded = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | |
System.String | checksum | |
System.Action<UnityEngine.Texture2D> | onTextureLoaded |
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |
TryToFindLoadedSprite(String)
Declaration
public static Sprite TryToFindLoadedSprite(string checksum)
Parameters
Type | Name | Description |
---|---|---|
System.String | checksum |
Returns
Type | Description |
---|---|
UnityEngine.Sprite |
TryToFindLoadedTexture(String)
Declaration
public static Texture2D TryToFindLoadedTexture(string checksum)
Parameters
Type | Name | Description |
---|---|---|
System.String | checksum |
Returns
Type | Description |
---|---|
UnityEngine.Texture2D |