Show / Hide Table of Contents

Class Texture2DUtility

Texture2D Utility methods.

Inheritance
System.Object
Texture2DUtility
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.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: StansAssets.Foundation
Assembly: cs.temp.dll.dll
Syntax
public static class Texture2DUtility

Methods

MakePlainColorImage(Color, Int32, Int32, Boolean)

Generates plane color object with given size. You can also choose if you would like to cache generated image, so the next time you ask for the image with the same color, cache result will be returned instead of generating new image.

Declaration
public static Texture2D MakePlainColorImage(Color color, int width = 1, int height = 1, bool cacheGeneratedImage = true)
Parameters
Type Name Description
Color color

Texture color.

System.Int32 width

Texture width.

System.Int32 height

Texture height.

System.Boolean cacheGeneratedImage

When set to true the generated image is cached.

Returns
Type Description
Texture2D

MakePlainColorImage(String, Int32, Int32, Boolean)

Generates plane color object with given size. You can also choose if you would like to cache generated image, so the next time you ask for the image with the same color, cache result will be returned instead of generating new image.

Declaration
public static Texture2D MakePlainColorImage(string colorHtmlString, int width = 1, int height = 1, bool cacheGeneratedImage = true)
Parameters
Type Name Description
System.String colorHtmlString

Case insensitive html string to be converted into a color. MakeColorFromHtml(String) for more info about format.

System.Int32 width

Texture width.

System.Int32 height

Texture height.

System.Boolean cacheGeneratedImage

When set to true the generated image is cached.

Returns
Type Description
Texture2D

Resize(Texture2D, Int32, Int32, FilterMode)

Resize Texture2D.

Declaration
public static Texture2D Resize(Texture2D source, int newWidth, int newHeight, FilterMode filterMode)
Parameters
Type Name Description
Texture2D source

Source texture to resize.

System.Int32 newWidth

New texture width.

System.Int32 newHeight

New texture height.

FilterMode filterMode

The filtering mode to use during resize.

Returns
Type Description
Texture2D

Rotate(Texture2D, Single)

Rotates pixels to a specified angle.

Declaration
public static Texture2D Rotate(Texture2D tex, float angle)
Parameters
Type Name Description
Texture2D tex

Source texture to rotate.

System.Single angle

Rotate angle.

Returns
Type Description
Texture2D

ScaleTexture(Texture2D, Single, Texture2DUtility.TextureScaleMode)

Scale Texture.

Declaration
public static Texture2D ScaleTexture(Texture2D source, float scale, Texture2DUtility.TextureScaleMode textureScaleMode)
Parameters
Type Name Description
Texture2D source
System.Single scale
Texture2DUtility.TextureScaleMode textureScaleMode
Returns
Type Description
Texture2D
Exceptions
Type Condition
System.ArgumentOutOfRangeException
In This Article
Back to top Generated by DocFX