TextureBrush::SetWrapMode method (gdiplusbrush.h)

The TextureBrush::SetWrapMode method sets the wrap mode of this texture brush.

Syntax

Status SetWrapMode(
  [in] WrapMode wrapMode
);

Parameters

[in] wrapMode

Type: WrapMode

Element of the WrapMode enumeration that specifies how repeated copies of an image are used to tile an area when it is painted with this texture brush.

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

An area that extends beyond the boundaries of the brush is tiled with repeated copies of the brush. A texture brush may have alternate tiles flipped in a certain direction, as specified by the wrap mode. Flipping has the effect of reversing the brush's image. For example, if the wrap mode is specified as WrapModeTileFlipX, the brush is flipped about a line that is parallel to the y-axis.

The texture brush is always oriented at (0, 0). If the wrap mode is specified as WrapModeClamp, no area outside of the brush is tiled. For example, suppose you create a texture brush, specifying WrapModeClamp as the wrap mode:

TextureBrush(&SomeImage, WrapModeClamp)

Then you paint an area with the brush. If the size of the brush has a height of 50 and the painted area is a rectangle with its upper-left corner at (0, 50), you will see no repeated copies of the brush (no tiling).

The default wrap mode for a texture brush is WrapModeTile, which specifies no flipping of the tile and no clamping.

Examples

The following example creates a texture brush, sets the wrap mode of the brush, and uses the brush to fill a rectangle.

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

   Image image(L"HouseAndTree.gif");
   TextureBrush textureBrush(&image);
   textureBrush.SetWrapMode(WrapModeTileFlipX);
   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 a Shape with an Image Texture

TextureBrush

TextureBrush::GetWrapMode

Tiling a Shape with an Image

WrapMode