Table of Contents

Class Tex2DSprite

Namespace
PAC
public static class Tex2DSprite
Inheritance
Tex2DSprite
Inherited Members

Methods

ApplyMask(Texture2D, IntVector2[])

public static Texture2D ApplyMask(Texture2D texture, IntVector2[] mask)

Parameters

texture Texture2D
mask IntVector2[]

Returns

Texture2D

ApplyMask(Texture2D, Texture2D)

public static Texture2D ApplyMask(Texture2D texture, Texture2D mask)

Parameters

texture Texture2D
mask Texture2D

Returns

Texture2D

BlankTexture(int, int)

public static Texture2D BlankTexture(int width, int height)

Parameters

width int
height int

Returns

Texture2D

Blend(Color, Texture2D, BlendMode)

Overlays topColour onto each pixel of bottomTex using the given blend mode.

public static Texture2D Blend(Color topColour, Texture2D bottomTex, BlendMode blendMode)

Parameters

topColour Color
bottomTex Texture2D
blendMode BlendMode

Returns

Texture2D

Blend(Texture2D, Texture2D, BlendMode)

Overlays topTex onto bottomTex using the given blend mode, placing the bottom-left corner on the bottom-left corner.

public static Texture2D Blend(Texture2D topTex, Texture2D bottomTex, BlendMode blendMode)

Parameters

topTex Texture2D
bottomTex Texture2D
blendMode BlendMode

Returns

Texture2D

Blend(Texture2D, Texture2D, IntVector2, BlendMode)

Overlays topTex onto bottomTex using the given blend mode, placing the bottom-left corner at the coordinates topTexOffset (which don't have to be within the image).

public static Texture2D Blend(Texture2D topTex, Texture2D bottomTex, IntVector2 topTexOffset, BlendMode blendMode)

Parameters

topTex Texture2D
bottomTex Texture2D
topTexOffset IntVector2
blendMode BlendMode

Returns

Texture2D

ChangeRect(Texture2D, IntRect)

Changes the dimensions of the texture to the new rect.

public static Texture2D ChangeRect(Texture2D texture, IntRect newRect)

Parameters

texture Texture2D
newRect IntRect

The coords of the new rect relative to the coords of the old rect.

Returns

Texture2D

CheckerboardBackground(int, int)

public static Texture2D CheckerboardBackground(int width, int height)

Parameters

width int
height int

Returns

Texture2D

ContainsPixel(Texture2D, IntVector2)

public static bool ContainsPixel(this Texture2D texture, IntVector2 pixel)

Parameters

texture Texture2D
pixel IntVector2

Returns

bool

ContainsPixel(Texture2D, int, int)

public static bool ContainsPixel(this Texture2D texture, int x, int y)

Parameters

texture Texture2D
x int
y int

Returns

bool

Copy(Texture2D)

Creates a deepcopy of the texture using Color colours.

public static Texture2D Copy(Texture2D texture)

Parameters

texture Texture2D

Returns

Texture2D

Copy32(Texture2D)

Creates a deepcopy of the texture using Color32 colours.

public static Texture2D Copy32(Texture2D texture)

Parameters

texture Texture2D

Returns

Texture2D

Extend(Texture2D, int, int, int, int)

Adds the given number of transparent pixels to each side of the texture. Negative amounts will crop the image.

public static Texture2D Extend(Texture2D texture, int left, int right, int up, int down)

Parameters

texture Texture2D
left int
right int
up int
down int

Returns

Texture2D

Fill(Texture2D, IntVector2, Color, int)

public static Texture2D Fill(Texture2D texture, IntVector2 startPoint, Color colour, int maxNumOfIterations = 1000000)

Parameters

texture Texture2D
startPoint IntVector2
colour Color
maxNumOfIterations int

Returns

Texture2D

Flip(Texture2D, FlipDirection)

public static Texture2D Flip(Texture2D texture, FlipDirection direction)

Parameters

texture Texture2D
direction FlipDirection

Returns

Texture2D

FlipX(Texture2D)

public static Texture2D FlipX(Texture2D texture)

Parameters

texture Texture2D

Returns

Texture2D

FlipY(Texture2D)

public static Texture2D FlipY(Texture2D texture)

Parameters

texture Texture2D

Returns

Texture2D

GetFillMask(Texture2D, IntVector2, int)

public static Texture2D GetFillMask(Texture2D texture, IntVector2 startPoint, int maxNumOfIterations = 100000)

Parameters

texture Texture2D
startPoint IntVector2
maxNumOfIterations int

Returns

Texture2D

GetPixel(Texture2D, IntVector2)

public static Color GetPixel(this Texture2D texture, IntVector2 coords)

Parameters

texture Texture2D
coords IntVector2

Returns

Color

GetPixelsToFill(Texture2D, IntVector2, int)

public static IntVector2[] GetPixelsToFill(Texture2D texture, IntVector2 startPoint, int maxNumOfIterations = 100000)

Parameters

texture Texture2D
startPoint IntVector2
maxNumOfIterations int

Returns

IntVector2[]

HSLHueSaturationGrid(int, int)

public static Texture2D HSLHueSaturationGrid(int width, int height)

Parameters

width int
height int

Returns

Texture2D

LoadFromFile(string)

public static Texture2D LoadFromFile(string filePath)

Parameters

filePath string

Returns

Texture2D

Multiply(Texture2D, Color)

public static Texture2D Multiply(Texture2D texture, Color colour)

Parameters

texture Texture2D
colour Color

Returns

Texture2D

Offset(Texture2D, IntVector2)

public static Texture2D Offset(Texture2D texture, IntVector2 offset)

Parameters

texture Texture2D
offset IntVector2

Returns

Texture2D

Outline(Texture2D, Color, bool, OutlineSideFill)

Makes an outline around the non-transparent pixels of the given texture.

public static Texture2D Outline(Texture2D texture, Color outlineColour, bool outlineOutside, OutlineSideFill outlineSideFill)

Parameters

texture Texture2D
outlineColour Color
outlineOutside bool

When true: the outline is created next to existing pixels (widens the sprite). When false: replaces the outer pixels.

outlineSideFill OutlineSideFill

Returns

Texture2D

Overlay(Texture2D, Texture2D)

Overlays topTex onto bottomTex, placing the bottom-left corner on the bottom-left corner. Uses Normal blend mode.

public static Texture2D Overlay(Texture2D topTex, Texture2D bottomTex)

Parameters

topTex Texture2D
bottomTex Texture2D

Returns

Texture2D

Overlay(Texture2D, Texture2D, IntVector2)

Overlays topTex onto bottomTex, placing the bottom-left corner at the coordinates topTexOffset (which don't have to be within the image). Uses Normal blend mode.

public static Texture2D Overlay(Texture2D topTex, Texture2D bottomTex, IntVector2 topTexOffset)

Parameters

topTex Texture2D
bottomTex Texture2D
topTexOffset IntVector2

Returns

Texture2D

ReplaceColour(Texture2D, Color, Color)

public static Texture2D ReplaceColour(Texture2D texture, Color toReplace, Color replaceWith)

Parameters

texture Texture2D
toReplace Color
replaceWith Color

Returns

Texture2D

Rotate(Texture2D, RotationAngle)

Rotation is clockwise.

public static Texture2D Rotate(Texture2D texture, RotationAngle angle)

Parameters

texture Texture2D
angle RotationAngle

Returns

Texture2D

Rotate180(Texture2D)

public static Texture2D Rotate180(Texture2D texture)

Parameters

texture Texture2D

Returns

Texture2D

Rotate90(Texture2D)

Rotation is clockwise.

public static Texture2D Rotate90(Texture2D texture)

Parameters

texture Texture2D

Returns

Texture2D

RotateMinus90(Texture2D)

Rotation is clockwise.

public static Texture2D RotateMinus90(Texture2D texture)

Parameters

texture Texture2D

Returns

Texture2D

Scale(Texture2D, int, int)

public static Texture2D Scale(Texture2D texture, int newWidth, int newHeight)

Parameters

texture Texture2D
newWidth int
newHeight int

Returns

Texture2D

Scale(Texture2D, float)

public static Texture2D Scale(Texture2D texture, float scaleFactor)

Parameters

texture Texture2D
scaleFactor float

Returns

Texture2D

Scale(Texture2D, float, float)

public static Texture2D Scale(Texture2D texture, float xScaleFactor, float yScaleFactor)

Parameters

texture Texture2D
xScaleFactor float
yScaleFactor float

Returns

Texture2D

SetPixel(Texture2D, IntVector2, Color)

public static void SetPixel(this Texture2D texture, IntVector2 coords, Color colour)

Parameters

texture Texture2D
coords IntVector2
colour Color

SolidTexture(int, int, Color)

Creates a texture of the given dimensions filled with the given colour.

NOTE: the overload that takes in a Color32 is faster.

public static Texture2D SolidTexture(int width, int height, Color colour)

Parameters

width int
height int
colour Color

Returns

Texture2D

SolidTexture(int, int, Color32)

Creates a texture of the given dimensions filled with the given colour.

NOTE: this is faster than the overload that takes in a Color.

public static Texture2D SolidTexture(int width, int height, Color32 colour)

Parameters

width int
height int
colour Color32

Returns

Texture2D

Subtract(Texture2D, Texture2D)

public static Texture2D Subtract(Texture2D topTex, Texture2D bottomTex)

Parameters

topTex Texture2D
bottomTex Texture2D

Returns

Texture2D

Tex2DToSprite(Texture2D)

public static Sprite Tex2DToSprite(Texture2D tex)

Parameters

tex Texture2D

Returns

Sprite