[]
        
(Showing Draft Content)

GrapeCity.Documents.Common.Matrix

Class Matrix

Namespace
GrapeCity.Documents.Common
Assembly
GcDocs.Imaging.dll

Represents a 3x2 coordinate system transformation matrix with double precision.

public class Matrix : IEquatable<Matrix>
Inheritance
object
Matrix
Implements
System.IEquatable<T><Matrix>
Inherited Members
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetType()
object.MemberwiseClone()

Constructors

Matrix(double, double, double, double, double, double)

Initializes a new instance of the Matrix class.

public Matrix(double m11, double m12, double m21, double m22, double m31, double m32)

Parameters

m11 double

The value to assign at row 1 column 1 of the matrix.

m12 double

The value to assign at row 1 column 2 of the matrix.

m21 double

The value to assign at row 2 column 1 of the matrix.

m22 double

The value to assign at row 2 column 2 of the matrix.

m31 double

The value to assign at row 3 column 1 of the matrix.

m32 double

The value to assign at row 3 column 2 of the matrix.

Matrix(Matrix3x2)

Initializes a new instance of the Matrix class from System.Numerics.Matrix3x2.

public Matrix(Matrix3x2 m)

Parameters

m System.Numerics.Matrix3x2

The source System.Numerics.Matrix3x2.

Fields

Identity

Gets the identity matrix.

public static readonly Matrix Identity

Field Value

Matrix

Properties

IsIdentity

Gets a value indicating whether this instance is an identity matrix.

public bool IsIdentity { get; }

Property Value

bool

M11

Gets element (1, 1).

public double M11 { get; }

Property Value

double

M12

Gets element (1, 2).

public double M12 { get; }

Property Value

double

M21

Gets element (2, 1).

public double M21 { get; }

Property Value

double

M22

Gets element (2, 2).

public double M22 { get; }

Property Value

double

M31

Gets element (3, 1).

public double M31 { get; }

Property Value

double

M32

Gets element (3, 2).

public double M32 { get; }

Property Value

double

Methods

CreateRotation(double, double, double)

Creates a rotation matrix.

public static Matrix CreateRotation(double radians, double cx, double cy)

Parameters

radians double

Angle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis.

cx double

X-coordinate of the center offset.

cy double

Y-coordinate of the center offset.

Returns

Matrix

The rotation matrix.

CreateRotation(double, PointF)

Creates a rotation matrix.

public static Matrix CreateRotation(double radians, PointF centerPoint)

Parameters

radians double

Angle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis.

centerPoint System.Drawing.PointF

The center offset.

Returns

Matrix

The rotation matrix.

CreateRotation(double)

Creates a rotation matrix.

public static Matrix CreateRotation(double radians)

Parameters

radians double

Angle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis.

Returns

Matrix

The rotation matrix.

CreateScale(double, double, double, double)

Creates a scaling matrix that is offset by a given center point.

public static Matrix CreateScale(double xScale, double yScale, double cx, double cy)

Parameters

xScale double

The value to scale by on the X axis.

yScale double

The value to scale by on the Y axis.

cx double

X-coordinate of the center offset.

cy double

Y-coordinate of the center offset.

Returns

Matrix

The scaling matrix.

CreateScale(double, double, double)

Creates a scaling matrix that scales uniformly with the specified scale with an offset from the specified center.

public static Matrix CreateScale(double scale, double cx, double cy)

Parameters

scale double

The uniform scale to use.

cx double

X-coordinate of the center offset.

cy double

Y-coordinate of the center offset.

Returns

Matrix

The scaling matrix.

CreateScale(double, double, PointF)

Creates a scaling matrix that is offset by a given center point.

public static Matrix CreateScale(double xScale, double yScale, PointF centerPoint)

Parameters

xScale double

The value to scale by on the X axis.

yScale double

The value to scale by on the Y axis.

centerPoint System.Drawing.PointF

The center offset.

Returns

Matrix

The scaling matrix.

CreateScale(double, double)

Creates a scaling matrix from the specified X and Y components.

public static Matrix CreateScale(double xScale, double yScale)

Parameters

xScale double

The value to scale by on the X axis.

yScale double

The value to scale by on the Y axis.

Returns

Matrix

The scaling matrix.

CreateScale(double, PointF)

Creates a scaling matrix that scales uniformly with the specified scale with an offset from the specified center.

public static Matrix CreateScale(double scale, PointF centerPoint)

Parameters

scale double

The uniform scale to use.

centerPoint System.Drawing.PointF

The center offset.

Returns

Matrix

The scaling matrix.

CreateScale(double)

Creates a scaling matrix that scales uniformly with the given scale.

public static Matrix CreateScale(double scale)

Parameters

scale double

The uniform scale to use.

Returns

Matrix

The scaling matrix.

CreateSkew(double, double, double, double)

Creates a skew matrix from the specified angles in radians and a center point.

public static Matrix CreateSkew(double radiansX, double radiansY, double cx, double cy)

Parameters

radiansX double

The X angle, in radians.

radiansY double

The Y angle, in radians.

cx double

X-coordinate of the center offset.

cy double

Y-coordinate of the center offset.

Returns

Matrix

The skew matrix.

CreateSkew(double, double, PointF)

Creates a skew matrix from the specified angles in radians and a center point.

public static Matrix CreateSkew(double radiansX, double radiansY, PointF centerPoint)

Parameters

radiansX double

The X angle, in radians.

radiansY double

The Y angle, in radians.

centerPoint System.Drawing.PointF

The center point.

Returns

Matrix

The skew matrix.

CreateSkew(double, double)

Creates a skew matrix from the specified angles in radians.

public static Matrix CreateSkew(double radiansX, double radiansY)

Parameters

radiansX double

The X angle, in radians.

radiansY double

The Y angle, in radians.

Returns

Matrix

The skew matrix.

CreateTranslation(double, double)

Creates a translation matrix.

public static Matrix CreateTranslation(double xPosition, double yPosition)

Parameters

xPosition double

The X position.

yPosition double

The Y position.

Returns

Matrix

The translation matrix.

CreateTranslation(PointF)

Creates a translation matrix.

public static Matrix CreateTranslation(PointF point)

Parameters

point System.Drawing.PointF

The translation position.

Returns

Matrix

The translation matrix.

Equals(Matrix)

Determines whether the specified Matrix is equal to this instance.

public bool Equals(Matrix other)

Parameters

other Matrix

Returns

bool

Equals(object)

Determines whether the specified object is equal to this instance.

public override bool Equals(object value)

Parameters

value object

Returns

bool

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

Invert()

Inverts the matrix if possible. Returns the inverted matrix if the operation succeeded.

public Matrix Invert()

Returns

Matrix

The inverted matrix or null.

Invert(out Matrix)

Inverts the matrix if possible. The return value indicates whether the operation succeeded.

public bool Invert(out Matrix result)

Parameters

result Matrix

When this method returns, contains the inverted matrix if the operation succeeded.

Returns

bool

true if the matrix was inverted successfully; otherwise, false.

Multiply(Matrix)

Determines the product of two matrices.

public Matrix Multiply(Matrix rightMatrix)

Parameters

rightMatrix Matrix

The second matrix to multiply.

Returns

Matrix

The product of the two matrices.

Multiply(Matrix3x2)

Determines the product of the current Matrix to System.Numerics.Matrix3x2.

public Matrix3x2 Multiply(Matrix3x2 rightMatrix)

Parameters

rightMatrix System.Numerics.Matrix3x2

The second matrix to multiply.

Returns

System.Numerics.Matrix3x2

The product of the two matrices in a shape of System.Numerics.Matrix3x2.

Rotate(double, double, double)

Applies the rotation transformation.

public Matrix Rotate(double radians, double cx, double cy)

Parameters

radians double

Angle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis.

cx double

X-coordinate of the center offset.

cy double

Y-coordinate of the center offset.

Returns

Matrix

The rotated matrix.

Rotate(double, PointF)

Applies the rotation transformation.

public Matrix Rotate(double radians, PointF centerPoint)

Parameters

radians double

Angle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis.

centerPoint System.Drawing.PointF

The center offset.

Returns

Matrix

The rotated matrix.

Rotate(double)

Applies the rotation transformation.

public Matrix Rotate(double radians)

Parameters

radians double

Angle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis.

Returns

Matrix

The rotated matrix.

Scale(double, double, double, double)

Applies the scaling transformation that is offset by a given center point.

public Matrix Scale(double sx, double sy, double cx, double cy)

Parameters

sx double

The value to scale by on the X axis.

sy double

The value to scale by on the Y axis.

cx double

X-coordinate of the center offset.

cy double

Y-coordinate of the center offset.

Returns

Matrix

The scaled matrix.

Scale(double, double, PointF)

Applies the scaling transformation that is offset by a given center point.

public Matrix Scale(double sx, double sy, PointF centerPoint)

Parameters

sx double

The value to scale by on the X axis.

sy double

The value to scale by on the Y axis.

centerPoint System.Drawing.PointF

The center offset.

Returns

Matrix

The scaled matrix.

Scale(double, double)

Applies the scaling transformation.

public Matrix Scale(double sx, double sy)

Parameters

sx double

The value to scale by on the X axis.

sy double

The value to scale by on the Y axis.

Returns

Matrix

The scaled matrix.

Scale(double)

Applies the scaling transformation.

public Matrix Scale(double scaleFactor)

Parameters

scaleFactor double

The value to scale by on the X and Y axes.

Returns

Matrix

The scaled matrix.

Skew(double, double, double, double)

Applies the skew transformation that is offset by a given center point.

public Matrix Skew(double radiansX, double radiansY, double cx, double cy)

Parameters

radiansX double

The X angle, in radians.

radiansY double

The Y angle, in radians.

cx double

X-coordinate of the center offset.

cy double

Y-coordinate of the center offset.

Returns

Matrix

The skew matrix.

Skew(double, double, PointF)

Applies the skew transformation that is offset by a given center point.

public Matrix Skew(double radiansX, double radiansY, PointF centerPoint)

Parameters

radiansX double

The X angle, in radians.

radiansY double

The Y angle, in radians.

centerPoint System.Drawing.PointF

The center point.

Returns

Matrix

The skew matrix.

Skew(double, double)

Applies the skew transformation.

public Matrix Skew(double radiansX, double radiansY)

Parameters

radiansX double

The X angle, in radians.

radiansY double

The Y angle, in radians.

Returns

Matrix

The skew matrix.

SkewX(double)

Applies the skew transformation along the X axis.

public Matrix SkewX(double radians)

Parameters

radians double

The X angle, in radians.

Returns

Matrix

The skew matrix.

SkewY(double)

Applies the skew transformation along the Y axis.

public Matrix SkewY(double radians)

Parameters

radians double

The Y angle, in radians.

Returns

Matrix

The skew matrix.

ToMatrix3x2()

Creates a System.Numerics.Matrix3x2 from this Matrix.

public Matrix3x2 ToMatrix3x2()

Returns

System.Numerics.Matrix3x2

ToString()

Returns a string that represents the current Matrix.

public override string ToString()

Returns

string

ToString(IFormatProvider)

Returns a string that represents this instance.

public string ToString(IFormatProvider formatProvider)

Parameters

formatProvider System.IFormatProvider

Returns

string

Transform(double, double)

Transforms a point by this matrix.

public (double, double) Transform(double x, double y)

Parameters

x double

X-coordinate of the original point.

y double

Y-coordinate of the original point.

Returns

(double, double)

A pair of transformed X and Y coordinates.

Transform(PointF)

Transforms a point by this matrix.

public PointF Transform(PointF point)

Parameters

point System.Drawing.PointF

The original point to apply the transformation.

Returns

System.Drawing.PointF

The transformed point.

Transform(PointF[], int, int)

Transforms an array of points by this matrix.

public void Transform(PointF[] points, int startIndex, int count)

Parameters

points System.Drawing.PointF[]
startIndex int
count int

Transform(float, float)

Transforms a point by this matrix.

public PointF Transform(float x, float y)

Parameters

x float

X-coordinate of the original point.

y float

Y-coordinate of the original point.

Returns

System.Drawing.PointF

The transformed point.

Translate(double, double)

Applies the translation transformation.

public Matrix Translate(double xPosition, double yPosition)

Parameters

xPosition double

The X position.

yPosition double

The Y position.

Returns

Matrix

The translated matrix.

Translate(PointF)

Applies the translation transformation.

public Matrix Translate(PointF point)

Parameters

point System.Drawing.PointF

The translation position.

Returns

Matrix

The translated matrix.

Operators

operator ==(Matrix, Matrix)

Returns a value that indicates whether the specified matrices are equal.

public static bool operator ==(Matrix matrix1, Matrix matrix2)

Parameters

matrix1 Matrix
matrix2 Matrix

Returns

bool

operator !=(Matrix, Matrix)

Returns a value that indicates whether the specified matrices are not equal.

public static bool operator !=(Matrix matrix1, Matrix matrix2)

Parameters

matrix1 Matrix
matrix2 Matrix

Returns

bool

operator *(Matrix, Matrix)

Determines the product of two matrices.

public static Matrix operator *(Matrix leftMatrix, Matrix rightMatrix)

Parameters

leftMatrix Matrix

The first matrix to multiply.

rightMatrix Matrix

The second matrix to multiply.

Returns

Matrix

The product of the two matrices.

operator *(Matrix, Matrix3x2)

Determines the product of the Matrix to System.Numerics.Matrix3x2.

public static Matrix3x2 operator *(Matrix leftMatrix, Matrix3x2 rightMatrix)

Parameters

leftMatrix Matrix

The first matrix to multiply.

rightMatrix System.Numerics.Matrix3x2

The second matrix to multiply.

Returns

System.Numerics.Matrix3x2

The product of the two matrices in a shape of System.Numerics.Matrix3x2.