PathGradientBrush::SetWrapMode method (gdipluspath.h)

The PathGradientBrush::SetWrapMode method sets the wrap mode of this path gradient brush.

Syntax

Status SetWrapMode(
  [in] WrapMode wrapMode
);

Parameters

[in] wrapMode

Type: WrapMode

Element of the WrapMode enumeration that specifies how areas painted with the path gradient brush will be tiled. The default value is WrapModeClamp.

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

The bounding rectangle of a path gradient brush is the smallest rectangle that encloses the brush's boundary path. When you paint the bounding rectangle with the path gradient brush, only the area inside the boundary path gets filled. The area inside the bounding rectangle but outside the boundary path does not get filled.

WrapModeClamp (the default wrap mode) indicates that no painting occurs outside of the brush's bounding rectangle. All of the other wrap modes indicate that areas outside the brush's bounding rectangle will be tiled. Each tile is a copy (possibly flipped) of the filled path inside its bounding rectangle.

Examples

The following example creates a PathGradientBrush object based on a triangular path. The code calls the PathGradientBrush::SetWrapMode method of the PathGradientBrush object to set the brush's wrap mode to WrapModeTileFlipX. The Graphics::FillRectangle method uses the path gradient brush to tile a large area.

The output of the code is a grid of tiles. As you move from one tile to the next in a given row, the image (filled boundary path inside the bounding rectangle) is flipped horizontally.

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

   Point points[] = {
      Point(0, 0), 
      Point(100, 0), 
      Point(100, 100)};

   Color colors[] = {
      Color(255, 255, 0, 0),   // red
      Color(255, 0, 0, 255),   // blue
      Color(255, 0, 255, 0)};  // green

   INT count = 3;

   PathGradientBrush pthGrBrush(points, 3);
   pthGrBrush.SetSurroundColors(colors, &count);
   pthGrBrush.SetWrapMode(WrapModeTileFlipX);

   graphics.FillRectangle(&pthGrBrush, 0, 0, 800, 800); 
}

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

PathGradientBrush

PathGradientBrush::GetWrapMode

PathGradientBrush::SetWrapMode