Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

D2D1_MATRIX_3X2_F

Represents a 3-by-2 matrix.


typedef D2D_MATRIX_3X2_F D2D1_MATRIX_3X2_F;

Remarks

D2D1_MATRIX_3X2 is a new name for the D2D_MATRIX_3X2_F structure. For a list of fields provided by the matrix, see D2D_MATRIX_3X2_F.

To simplify common matrix operations, Direct2D provides the D2D1::Matrix3x2F class, which is derived from the D2D1_MATRIX_3X2 structure. The Matrix3x2F class provides a set of helper methods for performing common tasks, such as creating a translation or skew matrix.

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 of 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]

Header

D2d1.h

See also

D2D1::Matrix3x2F
Transforms Overview
Single Transforms Example
How to Rotate an Object
How to Scale an Object
How to Skew an Object
How to Translate an Object
D2D_MATRIX_3X2_F

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.