Creating a Region

LEADTOOLS DigitalPaint provides the following functions for creating a region:

L_PntRegionRect

L_PntRegionRoundRect

L_PntRegionEllipse

L_PntRegionPolygon

L_PntRegionSurface

L_PntRegionBorder

L_PntRegionColor

These functions require:

image\sqrblit.gif a valid paint handle.

image\sqrblit.gif an optional windows device context.

image\sqrblit.gif the necessary data used to control the region creation.

image\sqrblit.gif 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 ) ;