Matrix3x2F::Translation(D2D1_SIZE_F) method (d2d1helper.h)

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


Matrix3x2F Translation(
  D2D1_SIZE_F size



Type: D2D1_SIZE_F

The distance to translate along the x-axis and the y-axis.

Return value

Type: Matrix3x2F

A transformation matrix that translates an object the specified horizontal and vertical distance.


Translation is an affine transformation, which moves every point by a fixed distance in the same direction. It is similar to shifting the origin of the coordinate space. You can translate an object along the x-axis, the y-axis, or both.

When calling this method, specify the x and y displacements and create a D2D1_SIZE_F structure for storing the displacements. If you prefer to specify each displacement as a parameter, call the other Translation method. The following illustration shows a square moved 20 pixels to the right along the x-axis, and 10 pixels downward along the y-axis.

Illustration of a square moved to the right and down from its original position For an example, see How to Translate an Object.


Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps only]
Target Platform Windows
Header d2d1helper.h
Library D2d1.lib
DLL D2d1.dll

See also