Class AffineTransformBuilder
A helper class for constructing Matrix3x2 instances for use in affine transforms.
Inherited Members
Namespace: SixLabors.ImageSharp.Processing
Assembly: SixLabors.ImageSharp.dll
Syntax
public class AffineTransformBuilder
Methods
| Edit this page View SourceAppendMatrix(Matrix3x2)
Appends a raw matrix.
Declaration
public AffineTransformBuilder AppendMatrix(Matrix3x2 matrix)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | matrix | The matrix to append. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
Exceptions
Type | Condition |
---|---|
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 rotation matrix using the given rotation angle in degrees and the image center point as rotation center.
Declaration
public AffineTransformBuilder AppendRotationDegrees(float degrees)
Parameters
Type | Name | Description |
---|---|---|
float | degrees | The amount of rotation, in degrees. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
AppendRotationDegrees(float, Vector2)
Appends a rotation matrix using the given rotation in degrees at the given origin.
Declaration
public AffineTransformBuilder AppendRotationDegrees(float degrees, Vector2 origin)
Parameters
Type | Name | Description |
---|---|---|
float | degrees | The amount of rotation, in degrees. |
Vector2 | origin | The rotation origin point. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
AppendRotationRadians(float)
Appends a rotation matrix using the given rotation angle in radians and the image center point as rotation center.
Declaration
public AffineTransformBuilder AppendRotationRadians(float radians)
Parameters
Type | Name | Description |
---|---|---|
float | radians | The amount of rotation, in radians. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
AppendRotationRadians(float, Vector2)
Appends a rotation matrix using the given rotation in radians at the given origin.
Declaration
public AffineTransformBuilder AppendRotationRadians(float radians, Vector2 origin)
Parameters
Type | Name | Description |
---|---|---|
float | radians | The amount of rotation, in radians. |
Vector2 | origin | The rotation origin point. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
AppendScale(SizeF)
Appends a scale matrix from the given vector scale.
Declaration
public AffineTransformBuilder AppendScale(SizeF scales)
Parameters
Type | Name | Description |
---|---|---|
SizeF | scales | The horizontal and vertical scale. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
AppendScale(Vector2)
Appends a scale matrix from the given vector scale.
Declaration
public AffineTransformBuilder AppendScale(Vector2 scales)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scales | The horizontal and vertical scale. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
AppendScale(float)
Appends a scale matrix from the given uniform scale.
Declaration
public AffineTransformBuilder AppendScale(float scale)
Parameters
Type | Name | Description |
---|---|---|
float | scale | The uniform scale. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
AppendSkewDegrees(float, float)
Appends a centered skew matrix from the give angles in degrees.
Declaration
public AffineTransformBuilder AppendSkewDegrees(float degreesX, float degreesY)
Parameters
Type | Name | Description |
---|---|---|
float | degreesX | The X angle, in degrees. |
float | degreesY | The Y angle, in degrees. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
AppendSkewDegrees(float, float, Vector2)
Appends a skew matrix using the given angles in degrees at the given origin.
Declaration
public AffineTransformBuilder AppendSkewDegrees(float degreesX, float degreesY, Vector2 origin)
Parameters
Type | Name | Description |
---|---|---|
float | degreesX | The X angle, in degrees. |
float | degreesY | The Y angle, in degrees. |
Vector2 | origin | The skew origin point. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
AppendSkewRadians(float, float)
Appends a centered skew matrix from the give angles in radians.
Declaration
public AffineTransformBuilder AppendSkewRadians(float radiansX, float radiansY)
Parameters
Type | Name | Description |
---|---|---|
float | radiansX | The X angle, in radians. |
float | radiansY | The Y angle, in radians. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
AppendSkewRadians(float, float, Vector2)
Appends a skew matrix using the given angles in radians at the given origin.
Declaration
public AffineTransformBuilder AppendSkewRadians(float radiansX, float radiansY, Vector2 origin)
Parameters
Type | Name | Description |
---|---|---|
float | radiansX | The X angle, in radians. |
float | radiansY | The Y angle, in radians. |
Vector2 | origin | The skew origin point. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
AppendTranslation(PointF)
Appends a translation matrix from the given vector.
Declaration
public AffineTransformBuilder AppendTranslation(PointF position)
Parameters
Type | Name | Description |
---|---|---|
PointF | position | The translation position. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
AppendTranslation(Vector2)
Appends a translation matrix from the given vector.
Declaration
public AffineTransformBuilder AppendTranslation(Vector2 position)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | position | The translation position. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
BuildMatrix(Rectangle)
Returns the combined transform matrix for a given source rectangle.
Declaration
public Matrix3x2 BuildMatrix(Rectangle sourceRectangle)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | sourceRectangle | The rectangle in the source image. |
Returns
Type | Description |
---|---|
Matrix3x2 | The Matrix3x2. |
Exceptions
Type | Condition |
---|---|
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.
Declaration
public Matrix3x2 BuildMatrix(Size sourceSize)
Parameters
Type | Name | Description |
---|---|---|
Size | sourceSize | The source image size. |
Returns
Type | Description |
---|---|
Matrix3x2 | The Matrix3x2. |
GetTransformedSize(Rectangle)
Returns the size of a rectangle large enough to contain the transformed source rectangle.
Declaration
public Size GetTransformedSize(Rectangle sourceRectangle)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | sourceRectangle | The rectangle in the source image. |
Returns
Type | Description |
---|---|
Size | The Size. |
Exceptions
Type | Condition |
---|---|
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(Matrix3x2)
Prepends a raw matrix.
Declaration
public AffineTransformBuilder PrependMatrix(Matrix3x2 matrix)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | matrix | The matrix to prepend. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
Exceptions
Type | Condition |
---|---|
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 rotation matrix using the given rotation angle in degrees and the image center point as rotation center.
Declaration
public AffineTransformBuilder PrependRotationDegrees(float degrees)
Parameters
Type | Name | Description |
---|---|---|
float | degrees | The amount of rotation, in degrees. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
PrependRotationDegrees(float, Vector2)
Prepends a rotation matrix using the given rotation in degrees at the given origin.
Declaration
public AffineTransformBuilder PrependRotationDegrees(float degrees, Vector2 origin)
Parameters
Type | Name | Description |
---|---|---|
float | degrees | The amount of rotation, in degrees. |
Vector2 | origin | The rotation origin point. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
PrependRotationRadians(float)
Prepends a rotation matrix using the given rotation angle in radians and the image center point as rotation center.
Declaration
public AffineTransformBuilder PrependRotationRadians(float radians)
Parameters
Type | Name | Description |
---|---|---|
float | radians | The amount of rotation, in radians. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
PrependRotationRadians(float, Vector2)
Prepends a rotation matrix using the given rotation in radians at the given origin.
Declaration
public AffineTransformBuilder PrependRotationRadians(float radians, Vector2 origin)
Parameters
Type | Name | Description |
---|---|---|
float | radians | The amount of rotation, in radians. |
Vector2 | origin | The rotation origin point. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
PrependScale(SizeF)
Prepends a scale matrix from the given vector scale.
Declaration
public AffineTransformBuilder PrependScale(SizeF scale)
Parameters
Type | Name | Description |
---|---|---|
SizeF | scale | The horizontal and vertical scale. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
PrependScale(Vector2)
Prepends a scale matrix from the given vector scale.
Declaration
public AffineTransformBuilder PrependScale(Vector2 scales)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scales | The horizontal and vertical scale. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
PrependScale(float)
Prepends a scale matrix from the given uniform scale.
Declaration
public AffineTransformBuilder PrependScale(float scale)
Parameters
Type | Name | Description |
---|---|---|
float | scale | The uniform scale. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
PrependSkewDegrees(float, float)
Prepends a centered skew matrix from the give angles in degrees.
Declaration
public AffineTransformBuilder PrependSkewDegrees(float degreesX, float degreesY)
Parameters
Type | Name | Description |
---|---|---|
float | degreesX | The X angle, in degrees. |
float | degreesY | The Y angle, in degrees. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
PrependSkewDegrees(float, float, Vector2)
Prepends a skew matrix using the given angles in degrees at the given origin.
Declaration
public AffineTransformBuilder PrependSkewDegrees(float degreesX, float degreesY, Vector2 origin)
Parameters
Type | Name | Description |
---|---|---|
float | degreesX | The X angle, in degrees. |
float | degreesY | The Y angle, in degrees. |
Vector2 | origin | The skew origin point. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
PrependSkewRadians(float, float)
Prepends a centered skew matrix from the give angles in radians.
Declaration
public AffineTransformBuilder PrependSkewRadians(float radiansX, float radiansY)
Parameters
Type | Name | Description |
---|---|---|
float | radiansX | The X angle, in radians. |
float | radiansY | The Y angle, in radians. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
PrependSkewRadians(float, float, Vector2)
Prepends a skew matrix using the given angles in radians at the given origin.
Declaration
public AffineTransformBuilder PrependSkewRadians(float radiansX, float radiansY, Vector2 origin)
Parameters
Type | Name | Description |
---|---|---|
float | radiansX | The X angle, in radians. |
float | radiansY | The Y angle, in radians. |
Vector2 | origin | The skew origin point. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
PrependTranslation(PointF)
Prepends a translation matrix from the given vector.
Declaration
public AffineTransformBuilder PrependTranslation(PointF position)
Parameters
Type | Name | Description |
---|---|---|
PointF | position | The translation position. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |
PrependTranslation(Vector2)
Prepends a translation matrix from the given vector.
Declaration
public AffineTransformBuilder PrependTranslation(Vector2 position)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | position | The translation position. |
Returns
Type | Description |
---|---|
AffineTransformBuilder |