LEADTOOLS DigitalPaint provides the following functions for creating a region:
These functions require:
a valid paint handle.
an optional windows device context.
the necessary data used to control the region creation.
a pointer to a region handle to be updated with the resulting region.
These functions will create regions based on the current region properties. To determine the current region properties, call L_PntGetProperty. To set or change the current region properties, call L_PntSetProperty. For more information on the region properties, refer to the PAINTREGION structure.
The resulting region can be scaled or translated with the L_PntRegionScale or L_PntRegionTranslate functions.
Before creating a region, set the DigitalPaint metrics using the L_PntSetMetrics function.
The following example creates a rectangular region using the current region properties and the current transformations. It assumes the paint handle has been initialized and the window handle is valid:
/* Get the device context */
hDC = GetDC ( hWnd ) ;
/* Set the coordinates with respect to the DC dimensions*/
SetRect ( &rcRegion, 10, 10, 100, 100 ) ;
/* Use the current region properties and the current painting
transformations to create a rectangular region */
L_PntRegionRect ( pPaint, hDC, &rcRegion, &hRgn ) ;