Class TextureData
Contains texture data. This is used to be able to manipulate texture data without requiring access to the Unity API, which is not possible on any thread that is not the main thread.
Inheritance
Namespace: InsaneScatterbrain.MapGraph
Syntax
public class TextureData : object
Constructors
TextureData()
Declaration
public TextureData()
TextureData(Int32, Int32)
Creates new texture data.
Declaration
public TextureData(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
Properties
ColorCount
Declaration
public int ColorCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Colors
Declaration
public TextureData.Color32ArrayFacade Colors { get; }
Property Value
Type | Description |
---|---|
TextureData.Color32ArrayFacade |
Height
Gets the texture height.
Declaration
public int Height { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Item[Int32]
Declaration
public Color32 this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type | Description |
---|---|
Color32 |
Width
Gets the texture width.
Declaration
public int Width { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Clone()
Creates a new instance of this texture data.
Declaration
public TextureData Clone()
Returns
Type | Description |
---|---|
TextureData | A clone of this texture data |
Clone(TextureData)
Creates a new instance of this texture data.
Declaration
public void Clone(TextureData clone)
Parameters
Type | Name | Description |
---|---|---|
TextureData | clone | The instance that will be used to clone this into. |
CreateFromTexture(TextureData, Texture2D)
Creates texture data from texture.
Declaration
public static void CreateFromTexture(TextureData textureData, Texture2D texture)
Parameters
Type | Name | Description |
---|---|---|
TextureData | textureData | The texturedata instance to fill with the texture's data. |
Texture2D | texture | The texture. |
CreateFromTexture(Texture2D)
Creates texture data from texture.
Declaration
public static TextureData CreateFromTexture(Texture2D texture)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture | The texture. |
Returns
Type | Description |
---|---|
TextureData | The new texture data. |
GetColors()
Declaration
public IReadOnlyList<Color32> GetColors()
Returns
Type | Description |
---|---|
IReadOnlyList<Color32> |
Reset()
Declaration
public void Reset()
Resize(Int32, Int32)
Resizes the texture to the given size.
Declaration
public void Resize(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The new width. |
System.Int32 | height | The new height. |
Set(Int32, Int32)
Creates new texture data.
Declaration
public void Set(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
ToTexture2D()
Creates a new texture from the texture data.
Declaration
public Texture2D ToTexture2D()
Returns
Type | Description |
---|---|
Texture2D | The new texture. |