Class ProjectiveTransformBuilder
- Namespace
- SixLabors.ImageSharp.Processing
- Assembly
- SixLabors.ImageSharp.dll
A helper class for constructing Matrix4x4 instances for use in projective transforms.
public class ProjectiveTransformBuilder
- Inheritance
-
ProjectiveTransformBuilder
- Inherited Members
Constructors
ProjectiveTransformBuilder()
public ProjectiveTransformBuilder()
Methods
AppendMatrix(Matrix4x4)
Appends a raw matrix.
public ProjectiveTransformBuilder AppendMatrix(Matrix4x4 matrix)
Parameters
matrix
Matrix4x4The matrix to append.
Returns
Exceptions
- DegenerateTransformException
The resultant matrix is degenerate containing one or more values equivalent to NaN or a zero determinant and therefore cannot be used for linear transforms.
AppendRotationDegrees(float)
Appends a centered rotation matrix using the given rotation in degrees.
public ProjectiveTransformBuilder AppendRotationDegrees(float degrees)
Parameters
degrees
floatThe amount of rotation, in degrees.
Returns
AppendRotationRadians(float)
Appends a centered rotation matrix using the given rotation in radians.
public ProjectiveTransformBuilder AppendRotationRadians(float radians)
Parameters
radians
floatThe amount of rotation, in radians.
Returns
AppendScale(SizeF)
Appends a scale matrix from the given vector scale.
public ProjectiveTransformBuilder AppendScale(SizeF scales)
Parameters
scales
SizeFThe horizontal and vertical scale.
Returns
AppendScale(Vector2)
Appends a scale matrix from the given vector scale.
public ProjectiveTransformBuilder AppendScale(Vector2 scales)
Parameters
scales
Vector2The horizontal and vertical scale.
Returns
AppendScale(float)
Appends a scale matrix from the given uniform scale.
public ProjectiveTransformBuilder AppendScale(float scale)
Parameters
scale
floatThe uniform scale.
Returns
AppendSkewDegrees(float, float, Vector2)
Appends a skew matrix using the given angles in degrees at the given origin.
public ProjectiveTransformBuilder AppendSkewDegrees(float degreesX, float degreesY, Vector2 origin)
Parameters
degreesX
floatThe X angle, in degrees.
degreesY
floatThe Y angle, in degrees.
origin
Vector2The skew origin point.
Returns
AppendSkewRadians(float, float)
Appends a centered skew matrix from the give angles in radians.
public ProjectiveTransformBuilder AppendSkewRadians(float radiansX, float radiansY)
Parameters
Returns
AppendSkewRadians(float, float, Vector2)
Appends a skew matrix using the given angles in radians at the given origin.
public ProjectiveTransformBuilder AppendSkewRadians(float radiansX, float radiansY, Vector2 origin)
Parameters
radiansX
floatThe X angle, in radians.
radiansY
floatThe Y angle, in radians.
origin
Vector2The skew origin point.
Returns
AppendTaper(TaperSide, TaperCorner, float)
Appends a matrix that performs a tapering projective transform.
public ProjectiveTransformBuilder AppendTaper(TaperSide side, TaperCorner corner, float fraction)
Parameters
side
TaperSideAn enumeration that indicates the side of the rectangle that tapers.
corner
TaperCornerAn enumeration that indicates on which corners to taper the rectangle.
fraction
floatThe amount to taper.
Returns
AppendTranslation(PointF)
Appends a translation matrix from the given vector.
public ProjectiveTransformBuilder AppendTranslation(PointF position)
Parameters
position
PointFThe translation position.
Returns
AppendTranslation(Vector2)
Appends a translation matrix from the given vector.
public ProjectiveTransformBuilder AppendTranslation(Vector2 position)
Parameters
position
Vector2The translation position.
Returns
BuildMatrix(Rectangle)
Returns the combined matrix for a given source rectangle.
public Matrix4x4 BuildMatrix(Rectangle sourceRectangle)
Parameters
sourceRectangle
RectangleThe rectangle in the source image.
Returns
Exceptions
- DegenerateTransformException
The resultant matrix is degenerate containing one or more values equivalent to NaN or a zero determinant and therefore cannot be used for linear transforms.
BuildMatrix(Size)
Returns the combined matrix for a given source size.
public Matrix4x4 BuildMatrix(Size sourceSize)
Parameters
sourceSize
SizeThe source image size.
Returns
GetTransformedSize(Rectangle)
Returns the size of a rectangle large enough to contain the transformed source rectangle.
public Size GetTransformedSize(Rectangle sourceRectangle)
Parameters
sourceRectangle
RectangleThe rectangle in the source image.
Returns
Exceptions
- DegenerateTransformException
The resultant matrix is degenerate containing one or more values equivalent to NaN or a zero determinant and therefore cannot be used for linear transforms.
PrependMatrix(Matrix4x4)
Prepends a raw matrix.
public ProjectiveTransformBuilder PrependMatrix(Matrix4x4 matrix)
Parameters
matrix
Matrix4x4The matrix to prepend.
Returns
Exceptions
- DegenerateTransformException
The resultant matrix is degenerate containing one or more values equivalent to NaN or a zero determinant and therefore cannot be used for linear transforms.
PrependRotationDegrees(float)
Prepends a centered rotation matrix using the given rotation in degrees.
public ProjectiveTransformBuilder PrependRotationDegrees(float degrees)
Parameters
degrees
floatThe amount of rotation, in degrees.
Returns
PrependRotationRadians(float)
Prepends a centered rotation matrix using the given rotation in radians.
public ProjectiveTransformBuilder PrependRotationRadians(float radians)
Parameters
radians
floatThe amount of rotation, in radians.
Returns
PrependScale(SizeF)
Prepends a scale matrix from the given vector scale.
public ProjectiveTransformBuilder PrependScale(SizeF scale)
Parameters
scale
SizeFThe horizontal and vertical scale.
Returns
PrependScale(Vector2)
Prepends a scale matrix from the given vector scale.
public ProjectiveTransformBuilder PrependScale(Vector2 scales)
Parameters
scales
Vector2The horizontal and vertical scale.
Returns
PrependScale(float)
Prepends a scale matrix from the given uniform scale.
public ProjectiveTransformBuilder PrependScale(float scale)
Parameters
scale
floatThe uniform scale.
Returns
PrependSkewDegrees(float, float, Vector2)
Prepends a skew matrix using the given angles in degrees at the given origin.
public ProjectiveTransformBuilder PrependSkewDegrees(float degreesX, float degreesY, Vector2 origin)
Parameters
degreesX
floatThe X angle, in degrees.
degreesY
floatThe Y angle, in degrees.
origin
Vector2The skew origin point.
Returns
PrependSkewRadians(float, float)
Prepends a centered skew matrix from the give angles in radians.
public ProjectiveTransformBuilder PrependSkewRadians(float radiansX, float radiansY)
Parameters
Returns
PrependSkewRadians(float, float, Vector2)
Prepends a skew matrix using the given angles in radians at the given origin.
public ProjectiveTransformBuilder PrependSkewRadians(float radiansX, float radiansY, Vector2 origin)
Parameters
radiansX
floatThe X angle, in radians.
radiansY
floatThe Y angle, in radians.
origin
Vector2The skew origin point.
Returns
PrependTaper(TaperSide, TaperCorner, float)
Prepends a matrix that performs a tapering projective transform.
public ProjectiveTransformBuilder PrependTaper(TaperSide side, TaperCorner corner, float fraction)
Parameters
side
TaperSideAn enumeration that indicates the side of the rectangle that tapers.
corner
TaperCornerAn enumeration that indicates on which corners to taper the rectangle.
fraction
floatThe amount to taper.
Returns
PrependTranslation(PointF)
Prepends a translation matrix from the given vector.
public ProjectiveTransformBuilder PrependTranslation(PointF position)
Parameters
position
PointFThe translation position.
Returns
PrependTranslation(Vector2)
Prepends a translation matrix from the given vector.
public ProjectiveTransformBuilder PrependTranslation(Vector2 position)
Parameters
position
Vector2The translation position.