TextureBrush::GetTransform method (gdiplusbrush.h)

The TextureBrush::GetTransform method gets the transformation matrix of this texture brush.

Syntax

Status GetTransform(
  [out] Matrix *matrix
);

Parameters

[out] matrix

Type: Matrix*

Pointer to a Matrix object that receives the transformation matrix.

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, 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 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 gets the brush's transformation matrix and proceeds to inspect or use the elements.

VOID Example_GetTransform(HDC hdc)
{
   Graphics graphics(hdc);
  
   // Create a texture brush, and set its transform.
   Image image(L"marble.jpg");
   TextureBrush textureBrush(&image);
   textureBrush.ScaleTransform(3, 2);

   // Obtain information about the texture brush.
   Matrix matrix;
   REAL elements[6];

   textureBrush.GetTransform(&matrix);
   matrix.GetElements(elements);

   for(INT j = 0; j <=5; ++j)
   {
      // Inspect or use the value in elements[j].
   }
}

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::ResetTransform

TextureBrush::SetTransform

Transformations