Matrix3x2F class (d2d1helper.h)

The Matrix3x2F class represents a 3-by-2 matrix and provides convenience methods for creating matrices.

Inheritance

The Matrix3x2F class inherits from D2D1_MATRIX_3X2_F. Matrix3x2F also has these types of members:

Methods

The Matrix3x2F class has these methods.

Method Description
Matrix3x2F::Determinant Calculates the determinant of the matrix.
Matrix3x2F::Identity Creates an identity matrix.
Matrix3x2F::Invert Inverts the matrix, if it is invertible.
Matrix3x2F::IsIdentity Indicates whether this matrix is the identity matrix.
Matrix3x2F::IsInvertible Indicates whether the matrix is invertible.
Matrix3x2F::Matrix3x2F Instantiates a new instance of the Matrix3x2F class that contains the specified values.
Matrix3x2F::Matrix3x2F Instantiates a new instance of the Matrix3x2F class without initializing the matrix values.
Matrix3x2F::operator* Multiplies this matrix with the specified matrix and returns the result.
Matrix3x2F::ReinterpretBaseType Converts the specified D2D1_MATRIX_3X2_F matrix to a Matrix3x2F without making a copy.
Matrix3x2F::ReinterpretBaseType Converts the specified D2D1_MATRIX_3X2_F matrix to a Matrix3x2F without making a copy.
Matrix3x2F::Rotation Creates a rotation transformation that has the specified angle and center point.
Matrix3x2F::Scale Creates a scale transformation that has the specified scale factors and center point.
Matrix3x2F::Scale Creates a scale transformation that has the specified scale factors and center point.
Matrix3x2F::SetProduct Multiplies the two matrices and stores the result in this matrix.
Matrix3x2F::Skew Creates a skew transformation that has the specified x-axis and y-axis values and center point.
Matrix3x2F::TransformPoint Uses this matrix to transform the specified point and returns the result.
Matrix3x2F::Translation Creates a translation transformation that has the specified x and y displacements.
Matrix3x2F::Translation Creates a translation transformation that has the specified x and y displacements.

Remarks

The Matrix3x2F class provides many static methods to create transformation matrices. The following table provides frequently used methods and the how-to topics associated with them.

Method How-To
Skew How to Skew an Object
Rotation How to Rotate an Object
Scale How to Scale an Object
Translation How to Translate an Object
 

Transforms can be applied to objects or to an entire drawing surface. To apply transforms to an entire drawing surface, call the ID2D1RenderTarget::SetTransform method. For individual objects, such as brushes or geometries, call the ID2D1Brush::SetTransform method or the ID2D1Geometry methods.

Examples

The following example uses the D2D1::Matrix3x2F::Rotation method to create a rotation matrix that rotates a square clockwise 45 degrees about the center of the square and passes the matrix to the SetTransform method of the render target (m_pRenderTarget).

The following illustration shows the effect of applying the preceding rotation transformation to the square. The original square is a dotted outline, and the rotated square is a solid outline.

Illustration a square rotated clockwise 45 degrees about the center of the original square
    // Create a rectangle.
    D2D1_RECT_F rectangle = D2D1::Rect(438.0f, 301.5f, 498.0f, 361.5f);

    // Draw the rectangle.
    m_pRenderTarget->DrawRectangle(
        rectangle,
        m_pOriginalShapeBrush,
        1.0f,
        m_pStrokeStyleDash
        );

    // Apply the rotation transform to the render target.
    m_pRenderTarget->SetTransform(
        D2D1::Matrix3x2F::Rotation(
            45.0f,
            D2D1::Point2F(468.0f, 331.5f))
        );

    // Fill the rectangle.
    m_pRenderTarget->FillRectangle(rectangle, m_pFillBrush);

    // Draw the transformed rectangle.
    m_pRenderTarget->DrawRectangle(rectangle, m_pTransformedShapeBrush);


Code has been omitted from this example. For more information about transforms, see the Transforms Overview.

Requirements

   
Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header d2d1helper.h (include D2d1helper.h)

See also

D2D1_MATRIX_3X2_F

Transforms Overview