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.
Inherited Members
Namespace: InsaneScatterbrain.MapGraph
Syntax
public class TextureData
Constructors
TextureData()
Declaration
public TextureData()
TextureData(int, int)
Creates new texture data.
Declaration
[Obsolete("Please use the pool manager to get a TextureData instance. This constructor will probably be removed in version 2.0. Alternatively, use the parameterless constructor and call the Set method.")]
public TextureData(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | The width. |
| int | height | The height. |
Properties
ColorCount
Declaration
public int ColorCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
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 |
|---|---|
| int |
this[int]
Declaration
public Color32 this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index |
Property Value
| Type | Description |
|---|---|
| Color32 |
Width
Gets the texture width.
Declaration
public int Width { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Clone()
Creates a new instance of this texture data.
Declaration
[Obsolete("Please use the overload that takes an instance of TextureData to clone into. This overload will likely be removed in 2.0.")]
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(int, int)
Resizes the texture to the given size.
Declaration
public void Resize(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | The new width. |
| int | height | The new height. |
Set(int, int)
Creates new texture data.
Declaration
public void Set(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | The width. |
| int | height | The height. |
ToTexture2D()
Creates a new texture from the texture data.
Declaration
public Texture2D ToTexture2D()
Returns
| Type | Description |
|---|---|
| Texture2D | The new texture. |