L_PntSetClipRgn

#include "LtPnt.h"

L_LTPNT_API L_INT L_PntSetClipRgn(pPaint, hClipRgn)

Sets the current clipping region for the toolkit.

Parameters

pPAINTHANDLE pPaint

Pointer to a paint handle.

L_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 L_PntSetMetrics 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 PntSetClipRgnExample(HWND hWnd) 
{ 
   L_INT nRet; 
   pPAINTHANDLE pPaint ; 
   HDC          hDC ; 
   HRGN         hClipRgn ; 
   RECT         rcShapeRect ; 
 
   /* Initiate the Paint toolkit */ 
   nRet = L_PntInit ( &pPaint ); 
   if ( SUCCESS != nRet ) 
   { 
      return nRet; 
   } 
 
   /* Get device context to draw on */ 
   hDC = GetDC ( hWnd ) ; 
 
   /* Set the rectangle coordinates with respect to the DC dimensions*/ 
   SetRect ( &rcShapeRect, 10, 10, 110, 110 ) ; 
 
   /* Set the DC Extents */ 
   RECT rcClient; 
   GetClientRect(hWnd, &rcClient); 
   nRet = L_PntSetDCExtents ( pPaint, &rcClient ); 
 
   /* Use the current shape properties to draw an ellipse to DC (hDC) */ 
   nRet = L_PntDrawShapeEllipse ( pPaint, hDC, &rcShapeRect ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   hClipRgn = CreateRectRgn ( 120, 20, 200, 100 ) ; 
 
   /* Set painting clip region */ 
   nRet = L_PntSetClipRgn ( pPaint, 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 to DC (hDC) */ 
   nRet = L_PntDrawShapeEllipse ( pPaint, hDC, &rcShapeRect ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Delete the clip region */ 
   DeleteObject ( ( HRGN ) hClipRgn ) ; 
 
   /* Release the device context */ 
   ReleaseDC ( hWnd, hDC ) ; 
 
   /* Free the paint tools handle */ 
   L_PntFree ( pPaint ) ; 
 
   return SUCCESS ; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Digital Paint C API Help