PathGradientBrush::ScaleTransform method (gdipluspath.h)

The PathGradientBrush::ScaleTransform method updates this brush's current transformation matrix with the product of itself and a scaling matrix.

Syntax

Status ScaleTransform(
  [in] REAL        sx,
  [in] REAL        sy,
  [in] MatrixOrder order
);

Parameters

[in] sx

Type: REAL

Real number that specifies the horizontal scale factor.

[in] sy

Type: REAL

Real number that specifies the vertical scale factor.

[in] order

Type: MatrixOrder

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

Return value

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 T represents a translation and matrix S represents a scaling. If matrix M is the product TS, then matrix M represents a composite transformation: first translate, then scale.

Examples

The following example creates a PathGradientBrush object based on a triangular path. The calls to the PathGradientBrush::TranslateTransform and PathGradientBrush::ScaleTransform methods of the PathGradientBrush object set the elements of the brush's transformation matrix so that it represents a composite transformation: first translate, then scale. The code uses the path gradient brush twice to paint a rectangle: once before the transformation is set and once after the transformation is set.

VOID Example_ScaleTransform(HDC hdc)
{
   Graphics graphics(hdc);

   // Create a path gradient brush based on an array of points.
   Point pts[] = {Point(0, 0), Point(50, 0), Point(50, 50)};
   PathGradientBrush pthGrBrush(pts, 3);

   // Fill an area with the path gradient brush (no transformation).
   graphics.FillRectangle(&pthGrBrush, 0, 0, 500, 500);

   pthGrBrush.TranslateTransform(50.0f, 40.0f);               // translate
   pthGrBrush.ScaleTransform(3.0f, 2.0f, MatrixOrderAppend);  // then scale

   // Fill the same area with the transformed path gradient brush.
   graphics.FillRectangle(&pthGrBrush, 0, 0, 500, 500); 
}

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdipluspath.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Brushes and Filled Shapes

Creating a Path Gradient

Filling a Shape with a Color Gradient

Matrix

Matrix Representation of Transformations

MatrixOrder

PathGradientBrush

PathGradientBrush::GetTransform

PathGradientBrush::MultiplyTransform

PathGradientBrush::ResetTransform

PathGradientBrush::RotateTransform

PathGradientBrush::SetTransform

PathGradientBrush::TranslateTransform

Transformations