LRasterPaint::SetClipRgn

#include "Ltwrappr.h"

L_INT LRasterPaint::SetClipRgn(hClipRng)

HRGN hClipRgn;

/* region handle */

Sets the current clipping region for the toolkit.

Parameter

Description

hClipRgn

A handle to the region to be used to clip the painting output. If this parameter is NULL, there is no clipping region.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes

Comments

This function creates a copy of the specified region and uses it to clip the painting output. The toolkit will use the region as it is, without doing any transformations.

If a bitmap has been set using the LRasterPaint::SetMetrics function, the toolkit will perform any necessary clipping, draw to the bitmap, and finally draw the resulting bitmap to the specified device context.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

LRasterPaint::OffsetClipRgn, LRasterPaint::GetClipRgn, Class Members

Topics:

Setting a DigitalPaint Clipping Region

Example

L_INT OnPaintShape ( CWnd* pWnd ) 
{
   LRasterPaint rstp;
   CDC* pDC = pWnd->GetDC() ;
   HRGN hClipRgn ;
   RECT rcShapeRect ;

   /* Initiate the Paint toolkit */
   if ( SUCCESS != rstp.Initialize ( ) )
   {
     return FAILURE ; 
   }

   /* Set the rectangle coordinates with respect to the DC dimensions*/
   SetRect ( &rcShapeRect, 10, 10, 110, 110 ) ;

   /* Use the current shape properties to draw an ellipse */
   rstp.DrawShapeEllipse ( pDC->m_hDC, &rcShapeRect ) ;

   hClipRgn = CreateRectRgn ( 120, 20, 200, 100 ) ;

   /* Set painting clip region */
   rstp.SetClipRgn ( hClipRgn ) ;

   /* Set the rectangle coordinates with respect to the DC dimensions*/
   SetRect ( &rcShapeRect, 110, 10, 210, 110 ) ;

   /* Use the current shape properties to draw an ellipse*/
   rstp.DrawShapeEllipse ( pDC->m_hDC, &rcShapeRect ) ;

   /* Delete the clip region */
   DeleteObject ( ( HRGN ) hClipRgn ) ;

   /* Free the paint tools handle */
   rstp.Free ( ) ;

   pWnd->ReleaseDC( pDC ) ;

   return SUCCESS ;
}