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
blendModeBlendModetopColourColorbottomTextureTexture2D
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
blendModeBlendModetopTextureTexture2DbottomTextureTexture2D
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
blendModeBlendModetopTextureTexture2DbottomTextureTexture2DtopTextureOffsetIntVector2
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
textureTexture2DnewRectIntRectThe 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
textureTexture2DoptionsImageEdit.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
textureTexture2DaxisCardinalAxis
Returns
- Texture2D
 
Remarks
Calls Texture2D.Apply() on the returned Texture2D.
Exceptions
- ArgumentNullException
 axisis 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
textureTexture2DtoReplaceColorreplaceWithColortolerancefloatHow close a colour has to be to
toReplaceto be replaced.
Returns
- Texture2D
 
Remarks
Calls Texture2D.Apply() on the returned Texture2D.
Exceptions
- ArgumentOutOfRangeException
 toleranceis 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
textureTexture2DangleQuadrantalAngle
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
 newWidthis <= 0 ornewHeightis <= 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
textureTexture2DscaleFactorfloat
Returns
- Texture2D
 
Exceptions
- ArgumentOutOfRangeException
 scaleFactoris <= 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
 xScaleFactoris <= 0 oryScaleFactoris <= 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.