Creating a Region

The LEADTOOLS LRasterPaint class provides the following functions for creating a region:

LRasterPaint::RegionRect

LRasterPaint::RegionRoundRect

LRasterPaint::RegionEllipse

LRasterPaint::RegionPolygon

LRasterPaint::RegionSurface

LRasterPaint::RegionBorder

LRasterPaint::RegionColor

These functions require:

These functions will create regions based on the current region properties. To determine the current region properties, call LRasterPaint::GetProperty. To set or change the current region properties, call LRasterPaint::SetProperty. For more information on the region properties, refer to the PAINTREGION structure.

The resulting region can be scaled or translated with the LRasterPaint::RegionScale or LRasterPaint::RegionTranslate functions.

Before creating a region, set the DigitalPaint metrics using the LRasterPaint::SetMetrics function.

The following example creates a rectangular region using the current region properties and the current transformations. It assumes the Digitalpaint class object 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  */
// Assume Paint was constructed from LRasterPaint class
Paint.RegionRect ( hDC, &rcRegion, &hRgn ) ;