UID | title | description | helpviewer_keywords | old-location | tech.root | ms.assetid | ms.date | ms.keywords | req.header | req.include-header | req.target-type | req.target-min-winverclnt | req.target-min-winversvr | req.kmdf-ver | req.umdf-ver | req.ddi-compliance | req.unicode-ansi | req.idl | req.max-support | req.namespace | req.assembly | req.type-library | req.lib | req.dll | req.irql | targetos | req.typenames | req.redist | ms.custom | f1_keywords | dev_langs | topic_type | api_type | api_location | api_name | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NL:d2d1helper.Matrix3x2F |
Matrix3x2F (d2d1helper.h) |
The Matrix3x2F class represents a 3-by-2 matrix and provides convenience methods for creating matrices. |
|
direct2d\matrix3x2f.htm |
Direct2D |
54b9e75c-6316-44d3-b725-2039f39eeda5 |
12/05/2018 |
Matrix3x2F, Matrix3x2F class [Direct2D], Matrix3x2F class [Direct2D],described, d2d1/Matrix3x2F, direct2d.matrix3x2f |
d2d1helper.h |
D2d1helper.h |
Windows |
Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps \| UWP apps] |
Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps \| UWP apps] |
D2d1.lib |
D2d1.dll |
Windows |
19H1 |
|
|
|
|
|
|
The Matrix3x2F class represents a 3-by-2 matrix and provides convenience methods for creating matrices.
The Matrix3x2F class inherits from D2D1_MATRIX_3X2_F.
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.
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.
// 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.