TextureBrush::ScaleTransform method (gdiplusbrush.h)

The TextureBrush::ScaleTransform method updates this texture 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 amount to scale in the x direction.

[in] sy

Type: REAL

Real number that specifies the amount to scale in the y direction.

[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.

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 texture brush and sets the transformation of the brush. The code then uses the transformed brush to fill a rectangle.

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

   Image image(L"HouseAndTree.Gif");
   TextureBrush textureBrush(&image);
   textureBrush.RotateTransform(30);                      // first rotate
   textureBrush.ScaleTransform(3, 1, MatrixOrderAppend);  // then scale
   graphics.FillRectangle(&textureBrush, 0, 0, 400, 200);
}

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 gdiplusbrush.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Brushes and Filled Shapes

Filling Shapes with a Gradient Brush

Image

Matrix

Matrix Representation of Transformations

MatrixOrder

TextureBrush

TextureBrush::GetTransform

TextureBrush::MultiplyTransform

TextureBrush::RotateTransform

TextureBrush::SetTransform

TextureBrush::TranslateTransform

Transformations