Class ImageEdit
- Namespace
- PAC.ImageEditing
public static class ImageEdit
- Inheritance
-
ImageEdit
- Inherited Members
Methods
Blend(BlendMode, Color, Texture2D)
Blends topColour
onto each pixel of a deep copy of bottomTexture
using the given BlendMode.
public static Texture2D Blend(this BlendMode blendMode, Color topColour, Texture2D bottomTexture)
Parameters
blendMode
BlendModetopColour
ColorbottomTexture
Texture2D
Returns
- Texture2D
Remarks
Calls Texture2D.Apply() on the returned Texture2D.
Blend(BlendMode, Texture2D, Texture2D)
Blends a deep copy of topTexture
onto a deep copy of bottomTexture
using the given BlendMode, placing the bottom-left corner
of topTexture
on the bottom-left corner of bottomTexture
.
public static Texture2D Blend(this BlendMode blendMode, Texture2D topTexture, Texture2D bottomTexture)
Parameters
blendMode
BlendModetopTexture
Texture2DbottomTexture
Texture2D
Returns
- Texture2D
Remarks
Calls Texture2D.Apply() on the returned Texture2D.
Blend(BlendMode, Texture2D, Texture2D, IntVector2)
Blends a deep copy of topTexture
onto a deep copy of bottomTexture
using the given BlendMode, placing the bottom-left corner
of topTexture
at the coordinates topTextureOffset
on bottomTexture
.
public static Texture2D Blend(this BlendMode blendMode, Texture2D topTexture, Texture2D bottomTexture, IntVector2 topTextureOffset)
Parameters
blendMode
BlendModetopTexture
Texture2DbottomTexture
Texture2DtopTextureOffset
IntVector2
Returns
- Texture2D
Remarks
Calls Texture2D.Apply() on the returned Texture2D.
ExtendCrop(Texture2D, IntRect)
Creates a deep copy of the Texture2D with the dimensions changed to fit the given IntRect by adding/removing rows/columns of pixels from the sides of the Texture2D.
public static Texture2D ExtendCrop(this Texture2D texture, IntRect newRect)
Parameters
texture
Texture2DnewRect
IntRectThe coords of the new rect, relative to the coords of the old rect.
Returns
- Texture2D
Remarks
Calls Texture2D.Apply() on the returned Texture2D.
ExtendCrop(Texture2D, in ExtendCropOptions)
Creates a deep copy of the Texture2D with rows/columns of pixels added to / removed from the sides.
public static Texture2D ExtendCrop(this Texture2D texture, in ImageEdit.ExtendCropOptions options)
Parameters
texture
Texture2Doptions
ImageEdit.ExtendCropOptions
Returns
- Texture2D
Remarks
Calls Texture2D.Apply() on the returned Texture2D.
Exceptions
- ArgumentException
The resulting width is <= 0 or the resulting height is <= 0.
Flip(Texture2D, CardinalAxis)
Returns a deep copy of the Texture2D reflected across the given axis.
public static Texture2D Flip(this Texture2D texture, CardinalAxis axis)
Parameters
texture
Texture2Daxis
CardinalAxis
Returns
- Texture2D
Remarks
Calls Texture2D.Apply() on the returned Texture2D.
Exceptions
- ArgumentNullException
axis
is null.
ReplaceColour(Texture2D, Color, Color, float)
Returns a deep copy of the Texture2D with all occurrences of the colour toReplace
replaced with replaceWith
.
public static Texture2D ReplaceColour(this Texture2D texture, Color toReplace, Color replaceWith, float tolerance = 0)
Parameters
texture
Texture2DtoReplace
ColorreplaceWith
Colortolerance
floatHow close a colour has to be to
toReplace
to be replaced.
Returns
- Texture2D
Remarks
Calls Texture2D.Apply() on the returned Texture2D.
Exceptions
- ArgumentOutOfRangeException
tolerance
is negative.
Rotate(Texture2D, QuadrantalAngle)
Returns a deep copy of the Texture2D rotated by the given angle.
public static Texture2D Rotate(this Texture2D texture, QuadrantalAngle angle)
Parameters
texture
Texture2Dangle
QuadrantalAngle
Returns
- Texture2D
Remarks
Calls Texture2D.Apply() on the returned Texture2D.
Scale(Texture2D, int, int)
Returns a deep copy of the Texture2D scaled to size newWidth
x newHeight
using the nearest-neighbour algorithm.
public static Texture2D Scale(this Texture2D texture, int newWidth, int newHeight)
Parameters
Returns
- Texture2D
Remarks
Calls Texture2D.Apply() on the returned Texture2D.
Exceptions
- ArgumentOutOfRangeException
newWidth
is <= 0 ornewHeight
is <= 0.
Scale(Texture2D, float)
Calls Scale(Texture2D, float, float) with both scale factors equal to scaleFactor
.
public static Texture2D Scale(this Texture2D texture, float scaleFactor)
Parameters
texture
Texture2DscaleFactor
float
Returns
- Texture2D
Exceptions
- ArgumentOutOfRangeException
scaleFactor
is <= 0.
Scale(Texture2D, float, float)
Returns a deep copy of the Texture2D with the width scaled by xScaleFactor
and the height scaled by yScaleFactor
, using the
nearest-neighbour algorithm.
public static Texture2D Scale(this Texture2D texture, float xScaleFactor, float yScaleFactor)
Parameters
Returns
- Texture2D
Remarks
The width is multiplied by xScaleFactor
then rounded. Similarly for the height.
Calls Texture2D.Apply() on the returned Texture2D.
Exceptions
- ArgumentOutOfRangeException
xScaleFactor
is <= 0 oryScaleFactor
is <= 0.- ArgumentException
Rounding the scaled width results in a new width of 0 or rounding the scaled height results in a new height of 0.