Matrix Functions

Windows GDI+ exposes a flat API that consists of about 600 functions, which are implemented in Gdiplus.dll and declared in Gdiplusflat.h. The functions in the GDI+ flat API are wrapped by a collection of about 40 C++ classes. It is recommended that you do not directly call the functions in the flat API. Whenever you make calls to GDI+, you should do so by calling the methods and functions provided by the C++ wrappers. Microsoft Product Support Services will not provide support for code that calls the flat API directly. For more information on using these wrapper methods, see GDI+ Flat API.

The following flat API functions are wrapped by the Matrix C++ class.

Matrix Functions and Corresponding Wrapper Methods

Flat function Wrapper method Description
GpStatus WINGDIPAPI GdipCreateMatrix(GpMatrix **matrix)
Matrix::Matrix
Creates and initializes a Matrix::Matrix object that represents the identity matrix.
GpStatus WINGDIPAPI GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy, GpMatrix **matrix)
Matrix::Matrix Creates and initializes a Matrix::Matrix object based on six numbers that define an affine transformation.
GpStatus WINGDIPAPI GdipCreateMatrix3(GDIPCONST GpRectF *rect, GDIPCONST GpPointF *dstplg, GpMatrix **matrix)
Matrix::Matrix Creates a Matrix::Matrix object based on a rectangle and a point.
GpStatus WINGDIPAPI GdipCreateMatrix3I(GDIPCONST GpRect *rect, GDIPCONST GpPoint *dstplg, GpMatrix **matrix)
Matrix::Matrix Creates a Matrix::Matrix object based on a rectangle and a point.
GpStatus WINGDIPAPI GdipCloneMatrix(GpMatrix *matrix, GpMatrix **cloneMatrix)
Matrix::Clone
The Matrix::Clone method creates a new Matrix object that is a copy of this Matrix object.
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
~Matrix()
Cleans up resources used by a Matrix::Matrix object.
GpStatus WINGDIPAPI GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
Matrix::SetElements
The Matrix::SetElements method sets the elements of this matrix.
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GpMatrix* matrix2, GpMatrixOrder order)
Matrix::Multiply
The Matrix::Multiply method updates this matrix with the product of itself and another matrix.
GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, GpMatrixOrder order)
Matrix::Translate
The Matrix::Translate method updates this matrix with the product of itself and a translation matrix.
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Matrix::Scale
The Matrix::Scale method updates this matrix with the product of itself and a scaling matrix.
GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order)
Matrix::Rotate
The Matrix::Rotate method updates this matrix with the product of itself and a rotation matrix.
GpStatus WINGDIPAPI GdipShearMatrix(GpMatrix *matrix, REAL shearX, REAL shearY, GpMatrixOrder order)
Matrix::Shear
The Matrix::Shear method updates this matrix with the product of itself and a shearing matrix.
GpStatus WINGDIPAPI GdipInvertMatrix(GpMatrix *matrix)
Matrix::Invert
If this matrix is invertible, the Matrix::Invert method replaces the elements of this matrix with the elements of its inverse.
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count)
Matrix::TransformPoints
The Matrix::TransformPoints method multiplies each point in an array by this matrix. Each point is treated as a row matrix. The multiplication is performed with the row matrix on the left and this matrix on the right.
GpStatus WINGDIPAPI GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, INT count)
Matrix::TransformPoints
The Matrix::TransformPoints method multiplies each point in an array by this matrix. Each point is treated as a row matrix. The multiplication is performed with the row matrix on the left and this matrix on the right.
GpStatus WINGDIPAPI GdipVectorTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count)
Matrix::TransformVectors
The Matrix::TransformVectors method multiplies each vector in an array by this matrix. The translation elements of this matrix (third row) are ignored. Each vector is treated as a row matrix. The multiplication is performed with the row matrix on the left and this matrix on the right.
GpStatus WINGDIPAPI GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, INT count)
Matrix::TransformVectors
The Matrix::TransformVectors method multiplies each vector in an array by this matrix. The translation elements of this matrix (third row) are ignored. Each vector is treated as a row matrix. The multiplication is performed with the row matrix on the left and this matrix on the right.
GpStatus WINGDIPAPI GdipGetMatrixElements(GDIPCONST GpMatrix *matrix, REAL *matrixOut)
Matrix::GetElements
The Matrix::GetElements method gets the elements of this matrix. The elements are placed in an array in the order m11, m12, m21, m22, m31, m32, where mij denotes the element in row i, column j.
GpStatus WINGDIPAPI GdipIsMatrixInvertible(GDIPCONST GpMatrix *matrix, BOOL *result)
Matrix::IsInvertible
The Matrix::IsInvertible method determines whether this matrix is invertible.
GpStatus WINGDIPAPI GdipIsMatrixIdentity(GDIPCONST GpMatrix *matrix, BOOL *result)
Matrix::IsIdentity
The Matrix::IsIdentity method determines whether this matrix is the identity matrix.
GpStatus WINGDIPAPI GdipIsMatrixEqual(GDIPCONST GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, BOOL *result)
Matrix::Equals
The Matrix::Equals method determines whether the elements of this matrix are equal to the elements of another matrix.