PathGradientBrush::GetWrapMode method

The PathGradientBrush::GetWrapMode method gets the wrap mode currently set for this path gradient brush.

Syntax

WrapMode GetWrapMode(

);

Parameters

This method has no parameters.

Return Value

Type: Type: WrapMode

This method returns an element of the WrapMode enumeration that indicates the wrap mode currently set for this path gradient brush.

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.

The default wrap mode for a path gradient brush is WrapModeClamp, which 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 PathGradientBrushobject based on a triangular path. The code calls the PathGradientBrush::SetWrapMode method of the PathGradientBrushobject to set the wrap mode to WrapModeTileFlipX. Next, the code calls the PathGradientBrush::GetWrapMode method of the PathGradientBrushobject to obtain the brush's wrap mode. If the obtained wrap mode is WrapModeTileFlipX, the code calls FillRectangle to tile a large area with the path gradient brush.

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

   // Create a path gradient brush based on an array of points,
   // and set its wrap mode.
   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);

   // Obtain information about the path gradient brush.
   WrapMode wrapMode; 
   wrapMode = pthGrBrush.GetWrapMode();

   if(wrapMode == WrapModeTileFlipX)
         graphics.FillRectangle(&pthGrBrush, 0, 0, 800, 800);
}

Requirements

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

Tiling a Shape with an Image