Skip to content

Latest commit

 

History

History
168 lines (104 loc) · 6.68 KB

nf-gdiplusbrush-lineargradientbrush-translatetransform.md

File metadata and controls

168 lines (104 loc) · 6.68 KB
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 req.product ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:gdiplusbrush.LinearGradientBrush.TranslateTransform
LinearGradientBrush::TranslateTransform (gdiplusbrush.h)
The LinearGradientBrush::TranslateTransform method updates this brush's current transformation matrix with the product of itself and a translation matrix.
LinearGradientBrush class [GDI+]
TranslateTransform method
LinearGradientBrush.TranslateTransform
LinearGradientBrush::TranslateTransform
TranslateTransform
TranslateTransform method [GDI+]
TranslateTransform method [GDI+]
LinearGradientBrush class
_gdiplus_CLASS_LinearGradientBrush_TranslateTransform_dx_dy_order_
gdiplus._gdiplus_CLASS_LinearGradientBrush_TranslateTransform_dx_dy_order_
gdiplus\_gdiplus_CLASS_LinearGradientBrush_TranslateTransform_dx_dy_order_.htm
gdiplus
VS|gdicpp|~\gdiplus\gdiplusreference\classes\lineargradientbrushclass\lineargradientbrushmethods\translatetransform_38dx_dy_order.htm
12/05/2018
LinearGradientBrush class [GDI+],TranslateTransform method, LinearGradientBrush.TranslateTransform, LinearGradientBrush::TranslateTransform, TranslateTransform, TranslateTransform method [GDI+], TranslateTransform method [GDI+],LinearGradientBrush class, _gdiplus_CLASS_LinearGradientBrush_TranslateTransform_dx_dy_order_, gdiplus._gdiplus_CLASS_LinearGradientBrush_TranslateTransform_dx_dy_order_
gdiplusbrush.h
Gdiplus.h
Windows
Windows XP, Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
Gdiplus.lib
Gdiplus.dll
Windows
GDI+ 1.0
19H1
LinearGradientBrush::TranslateTransform
gdiplusbrush/LinearGradientBrush::TranslateTransform
c++
APIRef
kbSyntax
COM
Gdiplus.dll
LinearGradientBrush.TranslateTransform

LinearGradientBrush::TranslateTransform

-description

The LinearGradientBrush::TranslateTransform method updates this brush's current transformation matrix with the product of itself and a translation matrix.

-parameters

-param dx [in]

Type: REAL

Real number that specifies the horizontal component of the translation.

-param dy [in]

Type: REAL

Real number that specifies the vertical component of the translation.

-param order [in]

Type: MatrixOrder

Optional. Element of the MatrixOrder enumeration that specifies the order of the multiplication. MatrixOrderPrepend specifies that the translation matrix is on the left, and MatrixOrderAppend specifies that the translation matrix is on the right. The default value is MatrixOrderPrepend.

-returns

Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

-remarks

A single 3 ×3 matrix can store any sequence of affine transformations. If you have several 3 ×3 matrices, each of which represents an affine transformation, the product of those matrices is a single 3 ×3 matrix that represents the entire sequence of transformations. The transformation represented by that product is called a composite transformation. For example, suppose matrix S represents a scaling, and matrix T represents a translation. If matrix M is the product ST, then matrix M represents a composite transformation: first scale, then translate.

The order of matrix multiplication is important. In general, the matrix product RT is not the same as the matrix product TR. In the example given in the previous paragraph, the composite transformation represented by RT (first rotate, then translate) is not the same as the composite transformation represented by TR (first translate, then rotate).

Examples

The following example creates a linear gradient brush and uses it to fill a rectangle. Next, the code modifies the brush's transformation matrix, applying a composite transformation, and then fills a rectangle with the transformed brush.

VOID Example_TranslateTrans(HDC hdc)
{
   Graphics myGraphics(hdc);

   LinearGradientBrush linGrBrush(
      Rect(0, 0, 80, 40),
      Color(255, 255, 0, 0),  // red
      Color(255, 0, 0, 255),  // blue
      LinearGradientModeHorizontal);

   // Fill a large area with the linear gradient brush (no transformation).
   myGraphics.FillRectangle(&linGrBrush, 0, 0, 800, 150);

   // Apply a composite transformation: first scale, then translate.
   linGrBrush.ScaleTransform(2, 1);                     // horizontal doubling
   linGrBrush.TranslateTransform(30, MatrixOrderAppend);// translation

   // Fill a large area with the transformed linear gradient brush.
   myGraphics.FillRectangle(&linGrBrush, 0, 200, 800, 150);
}

-see-also

Brushes and Filled Shapes

Filling Shapes with a Gradient Brush

LinearGradientBrush

LinearGradientBrush::MultiplyTransform

LinearGradientBrush::ResetTransform

LinearGradientBrush::RotateTransform

LinearGradientBrush::ScaleTransform

Matrix

Matrix Representation of Transformations

MatrixOrder

Transformations