TextureBrush::SetTransform method (gdiplusbrush.h)

The TextureBrush::SetTransform method sets the transformation matrix of this texture brush.

Syntax

Status SetTransform(
  [in] const Matrix *matrix
);

Parameters

[in] matrix

Type: const Matrix*

Pointer to a Matrix object that specifies the transformation matrix to use.

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 TextureBrush object maintains a transformation matrix that can store any affine transformation. When you use a texture brush to fill an area, Windows GDI+ transforms the brush's image according to the brush's transformation matrix and then fills the area. The transformed image exists only during rendering; the image stored in the TextureBrush object is not transformed. For example, suppose you call and then paint an area with someTextureBrush.ScaleTransform(3) and then paint an area with someTextureBrush. The width of the brush's image triples when the area is painted, but the image stored in someTextureBrush remains unchanged.

Examples

The following example creates a texture brush and sets the transformation of the brush. The code then uses the transformed brush to fill an ellipse.

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

   Matrix matrix(2, 0, 0, 1, 0, 0);  // Horizontal stretch

   Image image(L"HouseAndTree.gif");
   TextureBrush textureBrush(&image);
   textureBrush.SetTransform(&matrix);
   graphics.FillEllipse(&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

Coordinate Systems and Transformations

Filling a Shape with an Image Texture

Matrix

TextureBrush

TextureBrush::GetTransform

TextureBrush::ResetTransform

Transformations