Matrix::Reset method (gdiplusmatrix.h)

The Matrix::Reset method updates this matrix with the elements of the identity matrix.

Syntax

Status Reset();

Return value

Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

Remarks

The elements on the main diagonal of the identity matrix are 1. All other elements of the identity matrix are 0.

Examples

The following example creates a Matrix object that represents a horizontal scaling by a factor of 5 and a vertical scaling by a factor of 3. The code calls the Matrix::Reset method to replace the elements of that matrix with the elements of the identity matrix. Then the code calls the Matrix::Translate method to update the matrix with the product of itself (the identity) and a translation matrix. The result is that the matrix represents only the translation, not the scaling. The code uses the matrix to set the world transformation of a Graphics object and then draws a rectangle that is transformed according to that world transformation.

VOID Example_Reset(HDC hdc)
{
   Graphics graphics(hdc);
   Pen pen(Color(255, 0, 0, 255));

   Matrix matrix(5.0f, 0.0f, 0.0f, 3.0f, 0.0f, 0.0f);
   matrix.Reset();
   matrix.Translate(50.0f, 40.0f);

   graphics.SetTransform(&matrix);
   graphics.DrawRectangle(&pen, 0, 0, 100, 100);  
}

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusmatrix.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Global and Local Transformations

Matrix

Matrix Representation of Transformations

Matrix::IsIdentity

Transformations