PathGradientBrush::SetBlendBellShape method (gdipluspath.h)

The PathGradientBrush::SetBlendBellShape method sets the blend shape of this path gradient brush.

Syntax

Status SetBlendBellShape(
  [in]           REAL focus,
  [in, optional] REAL scale
);

Parameters

[in] focus

Type: REAL

Real number that specifies where the center color will be at its highest intensity. This number must be in the range 0 through 1.

[in, optional] scale

Type: REAL

Optional. Real number that specifies the maximum intensity of center color that gets blended with the boundary color. This number must be in the range 0 through 1. The default value is 1.

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

By default, as you move from the boundary of a path gradient to the center point, the color changes gradually from the boundary color to the center color. You can customize the positioning and blending of the boundary and center colors by calling the PathGradientBrush::SetBlendBellShape method.

Examples

The following example creates a PathGradientBrush object based on an ellipse. The code calls the PathGradientBrush::SetBlendBellShape method of the PathGradientBrush object, passing a focus of 0.2 and a scale of 0.7. Then the code uses the path gradient brush to paint a rectangle that contains the ellipse.

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

   // Create a path that consists of a single ellipse.
   GraphicsPath path;
   path.AddEllipse(0, 0, 200, 100);

   // Use the path to construct a brush.
   PathGradientBrush pthGrBrush(&path);

   // Set the color at the center of the path to red.
   pthGrBrush.SetCenterColor(Color(255, 255, 0, 0));

   // Set the color along the entire boundary of the path to blue.
   Color colors[] = {Color(255, 0, 0, 255)};
   INT count = 1;
   pthGrBrush.SetSurroundColors(colors, &count);

   pthGrBrush.SetBlendBellShape(0.2f, 0.7f);

   // The color is blue on the boundary and at the center.
   // At points that are 20 percent of the way from the boundary to the
   // center, the color is 70 percent red and 30 percent blue.

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

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

Color

Creating a Path Gradient

Filling a Shape with a Color Gradient

GraphicsPath

PathGradientBrush

PathGradientBrush::GetBlend

PathGradientBrush::GetBlendCount

PathGradientBrush::SetBlend

PathGradientBrush::SetBlendTriangularShape