LRasterPaint::SetClipRgn

Summary

Sets the current clipping region for the toolkit.

Syntax

#include "Ltwrappr.h"

L_INT LRasterPaint::SetClipRgn(hClipRgn)

Parameters

HRGN 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

Value Meaning
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

See Also

Functions

Topics

Example

L_INT LRasterPaint_SetClipRgnExample( CWnd* pWnd )  
{ 
   L_INT          nRet; 
   LRasterPaint   rstp; 
   CDC*           pDC = pWnd->GetDC() ; 
   HRGN           hClipRgn ; 
   RECT           rcShapeRect ; 
   RECT           rcDCExtents ; 
 
   /* Initiate the Paint toolkit */ 
   nRet = rstp.Initialize ( ); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Set the rectangle coordinates with respect to the DC dimensions*/ 
   SetRect ( &rcShapeRect, 10, 10, 110, 110 ) ; 
 
 
   /* Get the destination DC dimensions */   
   pWnd->GetClientRect ( &rcDCExtents ) ; 
 
   /* Set the toolkit user DC extents */ 
   nRet = rstp.SetDCExtents ( &rcDCExtents ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Use the current shape properties to draw an ellipse */ 
   nRet = rstp.DrawShapeEllipse ( pDC->m_hDC, &rcShapeRect ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   hClipRgn = CreateRectRgn ( 120, 20, 200, 100 ) ; 
 
   /* Set painting clip region */ 
   nRet = rstp.SetClipRgn ( hClipRgn ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* 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*/ 
   nRet = rstp.DrawShapeEllipse ( pDC->m_hDC, &rcShapeRect ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Delete the clip region */ 
   DeleteObject ( ( HRGN ) hClipRgn ) ; 
 
   /* Free the paint tools handle */ 
   nRet = rstp.Free ( ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   pWnd->ReleaseDC( pDC ) ; 
 
   return SUCCESS ; 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DigitalPaint C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.