Class TextureUtils
Utility functions for texture utils.
Namespace: nickmaltbie.MinimapTools.Utils
Assembly: cs.temp.dll.dll
Syntax
public static class TextureUtils
Methods
CreateTexture(Int32, Int32, Nullable<Color>)
Create a texture of a given size with a given color.
Declaration
public static Texture2D CreateTexture(int width, int height, Color? color = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | Width fo texture. |
Int32 | height | Height of texture |
Nullable<Color> | color | Color to make texture. |
Returns
Type | Description |
---|---|
Texture2D |
DrawStamp(Texture2D, Texture2D, Vector2Int)
Draw a stamp texture on a base texture map given a specific offset.
Declaration
public static void DrawStamp(this Texture2D source, Texture2D stamp, Vector2Int offsetPixels)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | source | Source texture to draw stamp on. |
Texture2D | stamp | Stamp texture to draw on source. |
Vector2Int | offsetPixels | Center offset of stamp on the source image. |
DrawStampRelative(Texture2D, Texture2D, Vector2)
Draw a stamp at a relative position onto a texture map.
Declaration
public static void DrawStampRelative(this Texture2D source, Texture2D stamp, Vector2 relativePosition)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | source | Source texture to draw stamp on. |
Texture2D | stamp | Stamp texture to draw on source. |
Vector2 | relativePosition | Relative position of the center of the stamp on the source texture. |
GetResized(Texture2D, Vector2Int, Int32)
Get a resized Texture2D via GPU and RenderTexture.
Declaration
public static Texture2D GetResized(this Texture2D texture, Vector2Int size, int depth = 32)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture | Texture to resize. |
Vector2Int | size | Size to scale texture to. |
Int32 | depth | Number of values per pixel, 24 for rgb, 32 for rgba |
Returns
Type | Description |
---|---|
Texture2D | Newly created resized texture. |
GetRotated(Texture2D, Single)
Rotates a texture about its center.
Declaration
public static Texture2D GetRotated(this Texture2D texture, float rotation)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | texture | Texture to rotate. |
Single | rotation | Rotation of the image in degrees. |
Returns
Type | Description |
---|---|
Texture2D | Rotated texture. |