L_PntRegionTranslate

Summary

Translates (offsets) a region.

Syntax

#include "LtPnt.h"

L_LTPNT_API L_INT L_PntRegionTranslate(pPaint, dx, dy, phDestRgn)

Parameters

pPAINTHANDLE pPaint

Pointer to a paint handle.

L_INT dx

X-coordinate offset.

L_INT dy

Y-coordinate offset.

pHRGN phDestRgn

Pointer to the region to be translated. After translation, the toolkit will delete the old region and replace it with the new one.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

The values for dx and dy will be used "as is". No transformation will be performed on these values.

The user is responsible for deleting the resulting region.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT PntRegionTranslateExample(HWND hWnd) 
{ 
   L_INT nRet; 
   pPAINTHANDLE pPaint ; 
   HDC          hDC ; 
   RECT         rcRegion ; 
   HRGN         hRgn ;  
 
   /* Initiate the Paint toolkit */ 
   nRet = L_PntInit ( &pPaint ); 
   if ( SUCCESS != nRet ) 
   { 
      return nRet; 
   } 
 
   /* 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  
       trasnformations to create a rectangle region */ 
   nRet = L_PntRegionRect ( pPaint, hDC, &rcRegion, &hRgn) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Translate the region */ 
   nRet = L_PntRegionTranslate ( pPaint, 50, 50, &hRgn ) ;  
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Display the resulted region */ 
   FrameRgn ( hDC, hRgn, ( HBRUSH ) GetStockObject ( BLACK_BRUSH ), 1, 1 ) ; 
    
   /* Release the device context */ 
   ReleaseDC ( hWnd, hDC ) ; 
 
   /*Delete the region */ 
   DeleteObject ( hRgn ) ; 
 
   /* Free the paint tools handle */ 
   L_PntFree ( pPaint ) ; 
 
   return SUCCESS ; 
} 
Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Digital Paint C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.