L_PntRegionTranslate

#include "LtPnt.h"

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

pPAINTHANDLE pPaint;

/* pointer to a paint handle */

L_INT dx;

/* x-direction offset */

L_INT dy;

/* y-direction offset */

pHRGN phDestRgn;

/* pointer to the region handle */

Translates (offsets) a region.

Parameter

Description

pPaint

Pointer to a paint handle.

dx

X-coordinate offset.

dy

Y-coordinate offset.

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

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

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:

L_PntSetProperty, L_PntSetTransformation, L_PntSetDCExtents, L_PntSetMetrics, L_PntDlgRegion, L_PntGetClipRgn, L_PntOffsetClipRgn, L_PntRegionBorder, L_PntRegionColor, L_PntRegionEllipse, L_PntRegionPolygon, L_PntRegionRect, L_PntRegionRoundRect, L_PntRegionScale, L_PntRegionSurface, L_PntSetClipRgn

Topics:

DigitalPaint Functions: Region Processing

 

Creating a Region

Example

L_INT RegionTraslateTest ( HWND hWnd )
{
   pPAINTHANDLE pPaint ;
   HDC          hDC ;
   RECT         rcRegion ;
   HRGN         hRgn ; 
   

   /* Initiate the Paint toolkit */
   if ( SUCCESS != L_PntInit ( &pPaint ) )
   {
         return FAILURE ; 
   }

   /* 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 */
   L_PntRegionRect ( pPaint, hDC, &rcRegion, &hRgn) ;

   /* Translate the region */
   L_PntRegionTranslate ( pPaint, 50, 50, &hRgn ) ; 

   /* 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 ;
}