Graphics::FillRegion method (gdiplusgraphics.h)

The Graphics::FillRegion method uses a brush to fill a specified region.

Syntax

Status FillRegion(
  [in] const Brush  *brush,
  [in] const Region *region
);

Parameters

[in] brush

Type: const Brush*

Pointer to a brush that is used to paint the region.

[in] region

Type: const Region*

Pointer to a region to be filled.

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

Because a region describes a set of pixels, a pixel is considered either fully inside, or fully outside the region. Consequently, Graphics::FillRegion does not antialias the edges of the region.

Examples

The following example creates a region from a rectangle and then fills the region.

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

   // Create a SolidBrush object.
   SolidBrush blackBrush(Color(255, 0, 0, 0));

   // Create a Region object from a rectangle.
   Region ellipseRegion(Rect(0, 0, 200, 100));

   // Fill the region.
   graphics.FillRegion(&blackBrush, &ellipseRegion);
}

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 gdiplusgraphics.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Color

Graphics

Pen

Region

Regions

Status