Matrix

public static class Matrix
Methods to create and manage an IMatrix

Properties

Instantiator

#
public static Func<IMatrix> Instantiator { get; }
obsolete: Use Matrix.Create() instead
Gets a delegate that can be used to create an identity matrix with little overhead

InstantiatorWithElements

#
public static Func<float, float, float, float, float, float, IMatrix> InstantiatorWithElements { get; }
obsolete: Use Matrix.Create() instead
Gets a delegate that can be used to create instances of a matrix with specified components with little overhead

Methods

Append

#Example
public static void Append(this IMatrix matrix, params IMatrix[] matrices)
Append the specified matrices to the matrix
matrix (IMatrix)Matrix to append to
matrices (params IMatrix[])Matrices to append to the matrix

Create

#
public static IMatrix Create(float xx, float yx, float xy, float yy, float x0, float y0)
Creates a new matrix with the specified components
xx (float)Xx component of the matrix
yx (float)Yx component of the matrix
xy (float)Xy component of the matrix
yy (float)Yy component of the matrix
x0 (float)X0 component of the matrix
y0 (float)Y0 component of the matrix

Create

#
public static IMatrix Create(float[] elements)
Creates a new matrix with the specified elements

FromRotation

#
public static IMatrix FromRotation(float angle)
Creates a new rotation matrix
angle (float)Angle in degrees to rotate. A positive value indicates a clockwise rotation, whereas a negative value will rotate counter clockwise
A new rotation matrix

FromRotationAt

#
public static IMatrix FromRotationAt(float angle, float centerX, float centerY)
Creates a new rotation matrix around a (centerX, centerY) point with the specified angle
angle (float)Angle in degrees to rotate. A positive value indicates a clockwise rotation, whereas a negative value will rotate counter clockwise
centerX (float)X co-ordinate of the point to rotate around
centerY (float)Y co-ordinate of the point to rotate around
A new rotation matrix

FromRotationAt

#
public static IMatrix FromRotationAt(float angle, PointF center)
Creates a new rotation matrix around a center point with the specified angle
angle (float)Angle in degrees to rotate. A positive value indicates a clockwise rotation, whereas a negative value will rotate counter clockwise
center (PointF)the point to rotate around
A new rotation matrix

FromScale

#
public static IMatrix FromScale(float scaleX, float scaleY)
Creates a new matrix with the specified scale factor
scaleX (float)The amount to multiply coordinates along the x axis
scaleY (float)The amount to multiply coordinates along the y axis
A new matrix with a scale transform

FromScale

#
public static IMatrix FromScale(SizeF scale)
Creates a new matrix with the specified scale
scale (SizeF)Scale size for the X and Y coordinates
A new matrix with a scale transform

FromScaleAt

#
public static IMatrix FromScaleAt(float scaleX, float scaleY, float centerX, float centerY)
Creates a new matrix with a scale at the specified point
scaleX (float)The amount to multiply coordinates along the x axis
scaleY (float)The amount to multiply coordinates along the y axis
centerX (float)X co-ordinate of the point to scale from
centerY (float)Y co-ordinate of the point to scale from
A new matrix with a scale transform

FromScaleAt

#
public static IMatrix FromScaleAt(SizeF scale, PointF center)
Creates a new matrix with a scale at the specified center point
scale (SizeF)The amount to multiply coordinates by
center (PointF)Point to scale from
A new matrix with a scale transform

FromSkew

#
public static IMatrix FromSkew(float skewX, float skewY)
Creates a new matrix with a skew
skewX (float)Amount to skew along the X axis, 1.0 does not skew
skewY (float)Amount to skew along the Y axis, 1.0 does not skew
A new skew matrix

FromTranslation

#
public static IMatrix FromTranslation(float distanceX, float distanceY)
Creates a new matrix with a translation
distanceX (float)Distance to translate along the x axis
distanceY (float)Distance to translate along the y axis
A new translation matrix

FromTranslation

#
public static IMatrix FromTranslation(PointF offset)
Creates a new matrix with a translation
offset (PointF)Offset to translate by
A new translation matrix

FromTranslation

#
public static IMatrix FromTranslation(SizeF offset)
Creates a new matrix with a translation
offset (SizeF)Offset to translate by
A new translation matrix

GetScale

#Example
public static PointF GetScale(this IMatrix matrix)
Returns the scale coordinates Xx and Yy of the matrix as a PointF.

Inverse

#Example
public static IMatrix Inverse(this IMatrix matrix)
Creates an inverted copy of the specified matrix.

Multiply

#
public static IMatrix Multiply(IMatrix matrix, params IMatrix[] matrices)
Multiply the specified matrix and matrices.
matrix (IMatrix)Matrix to multiply with
matrices (params IMatrix[])Matrices to append
A new matrix with the product of multiplying each of the specified matrix and matrices

Prepend

#Example
public static void Prepend(this IMatrix matrix, params IMatrix[] matrices)
Prepends the specified matrices to the matrix
matrix (IMatrix)Matrix to prepend to
matrices (params IMatrix[])Matrices to prepend to the matrix

RotateAt

#Example
public static void RotateAt(this IMatrix matrix, float angle, PointF center)
Prepend a rotation around the specified point to the matrix
matrix (IMatrix)Matrix to rotate
angle (float)Angle in degrees to rotate. A positive value indicates a clockwise rotation, whereas a negative value will rotate counter clockwise
center (PointF)Point to rotate around
public static void Scale(this IMatrix matrix, float scale)
Prepend a scale to the matrix from the origin (0, 0)
matrix (IMatrix)Matrix to scale
scale (float)The amount to multiply coordinates along both the x and y axis
public static void Scale(this IMatrix matrix, SizeF scale)
Prepend a scale to the matrix from the origin (0, 0)

ScaleAt

#Example
public static void ScaleAt(this IMatrix matrix, float scale, float centerX, float centerY)
Prepend a scale to the matrix from the specified point
matrix (IMatrix)Matrix to scale
scale (float)The amount to multiply coordinates along both the x and y axis
centerX (float)X co-ordinate of the point to scale from
centerY (float)Y co-ordinate of the point to scale from

ScaleAt

#Example
public static void ScaleAt(this IMatrix matrix, float scale, PointF center)
Prepend a scale to the matrix from the specified point
matrix (IMatrix)Matrix to scale
scale (float)The amount to multiply coordinates along both the x and y axis
center (PointF)Point to scale from

ScaleAt

#Example
public static void ScaleAt(this IMatrix matrix, SizeF scale, PointF center)
Prepend a scale to the matrix from the specified point
matrix (IMatrix)Matrix to scale
scale (SizeF)The amount to multiply coordinates
center (PointF)Point to scale from

TransformRectangle

#Example
public static RectangleF TransformRectangle(this IMatrix matrix, RectangleF rect)
Transforms the rectangle with the current matrix.
Remarks: This returns a rectangle that encompasses the specified rect after it is translated. When rotating, this means that the new rectangle may be larger in size to encompass the translated rectangle.
matrix (IMatrix)Matrix to transform each point of the rectangle.
rect (RectangleF)Rectangle to transform.
A new rectangle that encompasses the translated rect.

TransformSize

#Example
public static SizeF TransformSize(this IMatrix matrix, SizeF size)
Transforms the size with the current matrix.

Translate

#Example
public static void Translate(this IMatrix matrix, PointF offset)
Prepend a translation to the matrix

Translate

#Example
public static void Translate(this IMatrix matrix, SizeF offset)
Prepend a translation to the matrix