uLib  User mode C/C++ extended API library for Win32 programmers.

Module Description

Additional region numbers...

Region numbers for GetRandomRgn(), undocumented except SYSRGN.
On NT, these regions are in screen coordinates, and you need OffsetRgn.
Note:: GDI also has official GetClipRgn() and GetMetaRgn() (instead of 1,2).

Example:
HRGN hApiRgn = CreateRectRgn( 0,0,0,0 );
GetRandomRgn( hdc, hApiRgn, RR_APIRGN );
MapRegionToWindow( hApiRgn, hwnd );
Note
There is a 5th region, the Rao region, which is the intersect of the API region and the system region.
The Rao region and the API region are cached in the DC to improve GDI drawing performance,
and are recomputed only when the clipping region or meta region changes.
If an application needs to know the Rao region, it must manually intersect
the API region and system region.

SetMetaRegion() uses an implicit parameter, the current clipping region,
to replace the current meta region, and then clears the clipping region.
If SetMetaRegion is called again, the meta region can only get smaller.
The only way to reset the meta region is to use SaveDC on the fresh DC,
which will save it, and then RestoreDC to get it back to it's null state.

Less known features like the meta region always exist for a practical purpose.
The primary purpose of the meta region is to set a clip region for meta files
when they are displayed to a drawing surface, while allowing the clip region to
remain intact. This region can also be thought of as a second clip region.

See also
Feng Yuan, Windows Graphics Programming: Win32 GDI and DirectDraw, Ch.7.
and https://www.codeproject.com/Articles/2095/A-Guide-to-WIN32-Clipping-Regions

Macros

#define RR_CLIPRGN   1
 
#define RR_METARGN   2
 
#define RR_APIRGN   3
 
#define RR_SYSRGN   SYSRGN
 

Macro Definition Documentation

◆ RR_CLIPRGN

#define RR_CLIPRGN   1

See GetClipRgn()

Definition at line 2242 of file UtilFunc.h.

◆ RR_METARGN

#define RR_METARGN   2

See GetMetaRgn()

Definition at line 2243 of file UtilFunc.h.

◆ RR_APIRGN

#define RR_APIRGN   3

Intersect of Clip and Meta regions.

Definition at line 2244 of file UtilFunc.h.

◆ RR_SYSRGN

#define RR_SYSRGN   SYSRGN

Official, System region.

Definition at line 2245 of file UtilFunc.h.