Region Functions (GDI+)

Windows GDI+ exposes a flat API that consists of about 600 functions, which are implemented in Gdiplus.dll and declared in Gdiplusflat.h. The functions in the GDI+ flat API are wrapped by a collection of about 40 C++ classes. It is recommended that you do not directly call the functions in the flat API. Whenever you make calls to GDI+, you should do so by calling the methods and functions provided by the C++ wrappers. Microsoft Product Support Services will not provide support for code that calls the flat API directly. For more information on using these wrapper methods, see GDI+ Flat API.

The following flat API functions are wrapped by the Region C++ class.

Region Functions and Corresponding Wrapper Methods

Flat function Wrapper method Remarks
GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
Region::Region()
Creates a region that is infinite. This is the default constructor.
GpStatus WINGDIPAPI GdipCreateRegionRect(GDIPCONST GpRectF *rect, GpRegion **region)
Region::Region(IN const RectF& rect)
Creates a region that is defined by a rectangle.
GpStatus WINGDIPAPI GdipCreateRegionRectI(GDIPCONST GpRect *rect, GpRegion **region)
Region::Region(IN const Rect& rect)
Creates a region that is defined by a rectangle.
GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region)
Region::Region(IN const GraphicsPath* path)
Creates a region that is defined by a GraphicsPath object and has a fill mode that is contained in the GraphicsPath object.
GpStatus WINGDIPAPI GdipCreateRegionRgnData(GDIPCONST BYTE *regionData, INT size, GpRegion **region)
Region::Region(IN const BYTE* regionData, IN INT size)
Creates a region that is defined by data obtained from another region.
GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hRgn, GpRegion **region)
Region::Region(IN HRGN hRgn)
Creates a region that is identical to the region that is specified by a handle to a GDI region.
GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *region, GpRegion **cloneRegion)
Region* Region::Clone() const
Makes a copy of this Region object and returns the address of the new Region object.
GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
Region::~Region()
Releases resources used by the Region object.
GpStatus WINGDIPAPI GdipSetInfinite(GpRegion *region)
Status Region::MakeInfinite()
Updates this region to an infinite region.
GpStatus WINGDIPAPI GdipSetEmpty(GpRegion *region)
Status Region::MakeEmpty()
Updates this region to an empty region. In other words, the region occupies no space on the display device.
GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region, GDIPCONST GpRectF *rect, CombineMode combineMode)
Status Region::Intersect(IN const RectF& rect)
Updates this region to the portion of itself that intersects the specified rectangle's interior.
The combineMode parameter in the flat function is a member of the CombineMode enumeration that specifies how the region and rectangle are combined.
GpStatus WINGDIPAPI GdipCombineRegionRectI(GpRegion *region, GDIPCONST GpRect *rect, CombineMode combineMode)
Status Region::Intersect(IN const Rect& rect)
Updates this region to the portion of itself that intersects the specified rectangle's interior.
The combineMode parameter in the flat function is a member of the CombineMode enumeration that specifies how the region and rectangle are combined.
GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, CombineMode combineMode)
Status Region::Intersect(IN const GraphicsPath* path)
Updates this region to the portion of itself that intersects the specified path's interior.
The combineMode parameter in the flat function is a member of the CombineMode enumeration that specifies how the region and path are combined.
GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region, GpRegion *region2, CombineMode combineMode)
Region::Intersect(IN const Region* region)
Updates this region to the portion of itself that intersects another region.
The combineMode parameter in the flat function is a member of the CombineMode enumeration that specifies how the regions are combined.
GpStatus WINGDIPAPI GdipTranslateRegion(GpRegion *region, REAL dx, REAL dy)
Region::Translate(IN REAL dx, IN REAL dy)
Offsets this region by specified amounts in the horizontal and vertical directions.
GpStatus WINGDIPAPI GdipTranslateRegionI(GpRegion *region, INT dx, INT dy)
Status Region::Translate(IN INT dx, IN INT dy)
Offsets this region by specified amounts in the horizontal and vertical directions.
GpStatus WINGDIPAPI GdipTransformRegion(GpRegion *region, GpMatrix *matrix)
Region::Transform(IN const Matrix* matrix)
Transforms this region by multiplying each of its data points by a specified matrix.
GpStatus WINGDIPAPI GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics, GpRectF *rect)
Status Region::GetBounds(OUT RectF* rect, IN const Graphics* g) const
Gets a rectangle that encloses this region.
GpStatus WINGDIPAPI GdipGetRegionBoundsI(GpRegion *region, GpGraphics *graphics, GpRect *rect)
Status Region::GetBounds(OUT Rect* rect, IN const Graphics* g) const
Gets a rectangle that encloses this region.
GpStatus WINGDIPAPI GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HRGN *hRgn)
HRGN Region::GetHRGN(IN const Graphics* g) const
Creates a GDI region from this region.
GpStatus WINGDIPAPI GdipIsEmptyRegion(GpRegion *region, GpGraphics *graphics, BOOL *result)
BOOL Region::IsEmpty(IN const Graphics *g)const
Determines whether this region is empty.
GpStatus WINGDIPAPI GdipIsInfiniteRegion(GpRegion *region, GpGraphics *graphics, BOOL *result)
BOOL Region::IsInfinite(IN const Graphics *g)const
Determines whether this region is infinite.
GpStatus WINGDIPAPI GdipIsEqualRegion(GpRegion *region, GpRegion *region2, GpGraphics *graphics, BOOL *result)
BOOL Region::Equals(IN const Region* region, IN const Graphics* g) const
Determines whether this region is equal to a specified region.
GpStatus WINGDIPAPI GdipGetRegionDataSize(GpRegion *region, UINT * bufferSize)
UINT Region::GetDataSize() const
Gets the number of bytes of data that describes this region.
GpStatus WINGDIPAPI GdipGetRegionData(GpRegion *region, BYTE * buffer, UINT bufferSize, UINT * sizeFilled)
Status Region::GetData(OUT BYTE* buffer, IN UINT bufferSize, OUT UINT* sizeFilled) const
Gets data that describes this region.
GpStatus WINGDIPAPI GdipIsVisibleRegionPoint(GpRegion *region, REAL x, REAL y, GpGraphics *graphics, BOOL *result)
BOOL Region::IsVisible(IN const PointF& point, IN const Graphics* g) const
Determines whether a point is inside this region.
The x and y parameters in the flat function specify the x and y coordinates of a point that corresponds to the point parameter in the wrapper method.
GpStatus WINGDIPAPI GdipIsVisibleRegionPointI(GpRegion *region, INT x, INT y, GpGraphics *graphics, BOOL *result)
BOOL Region::IsVisible(IN const Point& point, IN const Graphics* g) const
Determines whether a point is inside this region.
The x and y parameters in the flat function specify the x and y coordinates of a point that corresponds to the point parameter in the wrapper method.
GpStatus WINGDIPAPI GdipIsVisibleRegionRect(GpRegion *region, REAL x, REAL y, REAL width, REAL height, GpGraphics *graphics, BOOL *result)
BOOL Region::IsVisible(IN const RectF& rect, IN const Graphics* g) const
Determines whether a rectangle intersects this region.
The x, y, width, and height parameters in the flat function specify a rectangle that corresponds to the rect parameter in the wrapper method.
GpStatus WINGDIPAPI GdipIsVisibleRegionRectI(GpRegion *region, INT x, INT y, INT width, INT height, GpGraphics *graphics, BOOL *result)
BOOL Region::IsVisible(IN const Rect& rect, IN const Graphics* g) const
Determines whether a rectangle intersects this region.
The x, y, width, and height parameters in the flat function specify a rectangle that corresponds to the rect parameter in the wrapper method.
GpStatus WINGDIPAPI GdipGetRegionScansCount(GpRegion *region, UINT* count, GpMatrix* matrix)
UINT Region::GetRegionScansCount(IN const Matrix* matrix) const
Gets the number of rectangles that approximate this region. The region is transformed by a specified matrix before the rectangles are calculated.
GpStatus WINGDIPAPI GdipGetRegionScans(GpRegion *region, GpRectF* rects, INT* count, GpMatrix* matrix)
Status Region::GetRegionScans( IN const Matrix* matrix, OUT RectF* rects, IN OUT INT* count) const
Gets an array of rectangles that approximate this region. The region is transformed by a specified matrix before the rectangles are calculated.
GpStatus WINGDIPAPI GdipGetRegionScansI(GpRegion *region, GpRect* rects, INT* count, GpMatrix* matrix)
Status Region::GetRegionScans( IN const Matrix* matrix, OUT Rect* rects, IN OUT INT* count) const
Gets an array of rectangles that approximate this region. The region is transformed by a specified matrix before the rectangles are calculated.