Class ImageUtility
Utility component helping dealing with Texture2D and Sprite objects.
Inheritance
System.Object
ImageUtility
Assembly: Appearition.SDK.dll
Syntax
public static class ImageUtility
Methods
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[], Single)
Using given ApiData, creates a Sprite object.
Declaration
public static Sprite LoadOrCreateSprite(byte[] bytes, float pixelsPerUnit = 100F)
Parameters
Type |
Name |
Description |
System.Byte[] |
bytes |
|
System.Single |
pixelsPerUnit |
|
Returns
Type |
Description |
UnityEngine.Sprite |
|
LoadOrCreateSprite(String, Single)
Loads a picture from a given file path, and returns it as a Sprite object.
Declaration
public static Sprite LoadOrCreateSprite(string filePath, float pixelsPerUnit = 100F)
Parameters
Type |
Name |
Description |
System.String |
filePath |
|
System.Single |
pixelsPerUnit |
|
Returns
Type |
Description |
UnityEngine.Sprite |
|
LoadOrCreateSprite(Texture2D, Single)
Using a given Texture, creates a Sprite object.
Declaration
public static Sprite LoadOrCreateSprite(Texture2D tmpTexture, float pixelPerUnit = 100F)
Parameters
Type |
Name |
Description |
UnityEngine.Texture2D |
tmpTexture |
|
System.Single |
pixelPerUnit |
|
Returns
Type |
Description |
UnityEngine.Sprite |
|
LoadOrCreateTexture(Byte[])
Creates a texture from given ApiData.
Declaration
public static Texture2D LoadOrCreateTexture(byte[] bytes)
Parameters
Type |
Name |
Description |
System.Byte[] |
bytes |
|
Returns
Type |
Description |
UnityEngine.Texture2D |
|
LoadOrCreateTexture(String)
Loads a texture from a given path.
Declaration
public static Texture2D LoadOrCreateTexture(string filePath)
Parameters
Type |
Name |
Description |
System.String |
filePath |
|
Returns
Type |
Description |
UnityEngine.Texture2D |
|