Matrix3x2F class

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

Members

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

Constructors

The Matrix3x2F class has these constructors.

ConstructorDescription
Matrix3x2F() Constructor

Instantiates a new instance of the Matrix3x2F class.

Matrix3x2F(FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT) Constructor(FLOAT,FLOAT,FLOAT,FLOAT,FLOAT,FLOAT)

Instantiates a new instance of the Matrix3x2F class that contains the specified values.

 

Methods

The Matrix3x2F class has these methods.

MethodDescription
Determinant

Calculates the determinant of the matrix.

Identity

Creates an identity matrix.

Invert

Inverts the matrix, if it is invertible.

IsIdentity

Indicates whether this matrix is the identity matrix.

IsInvertible

Indicates whether the matrix is invertible.

ReinterpretBaseType(*D2D1_MATRIX_3X2_F)(D2D1_MATRIX_3X2_F)

Converts the specified D2D1_MATRIX_3X2_F matrix to a Matrix3x2F without making a copy.

ReinterpretBaseType(const *D2D1_MATRIX_3X2_F )(const D2D1_MATRIX_3X2_F)

Converts the specified D2D1_MATRIX_3X2_F matrix to a Matrix3x2F without making a copy.

Rotation

Creates a rotation transformation that has the specified angle and center point.

Scale(D2D1_SIZE_F,D2D1_POINT_2F)(D2D1_SIZE_F,D2D1_POINT_2F)

Creates a scale transformation that has the specified scale factors and center point.

Scale(FLOAT,FLOAT,D2D1_POINT_2F)(FLOAT,FLOAT,D2D1_POINT_2F)

Creates a scale transformation that has the specified scale factors and center point.

SetProduct

Multiplies the two matrices and stores the result in this matrix.

Skew

Creates a skew transformation that has the specified x-axis and y-axis values and center point.

TransformPoint

Uses this matrix to transform the specified point and returns the result.

Translation(D2D1_SIZE_F)(D2D1_SIZE_F)

Creates a translation transformation that has the specified x and y displacements.

Translation(FLOAT,FLOAT)

Creates a translation transformation that has the specified x and y displacements.

 

Operators

The Matrix3x2F class has these operators.

OperatorDescription
operator*

Multiplies this matrix with the specified matrix and returns the result.

 

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 the complete example, see the Single Transforms 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 | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Header

D2d1.h

Library

D2d1.lib

DLL

D2d1.dll

See also

Transforms Overview
Single Transforms Example

 

 

Community Additions

ADD
Show:
© 2014 Microsoft