L_PntRegionScale

#include "LtPnt.h"

L_LTPNT_API L_INT L_PntRegionScale(pPaint, nHScaleFactor, nVScaleFactor, nAlignment, phDestRgn)

pPAINTHANDLE pPaint;

/* pointer to a paint handle */

L_INT nHScaleFactor;

/* horizontal scale factor */

L_INT nVScaleFactor;

/* vertical scale factor */

PAINTALIGNMENT nAlignment;

/* alignment type */

pHRGN phDestRgn;

/* pointer to the region handle */

Scales a region.

Parameter

Description

pPaint

Pointer to a paint handle.

nHScaleFactor

Horizontal scale factor. Valid values are between 1 and 10000. For example:

 

Value

Meaning

 

100

The same dimensions.

 

110

1.1 times the original dimensions

 

120

1.2 times the original dimensions.

 

10000

100 times the original dimensions.

 

99

0.99 times the original dimensions.

 

98

0.98 times the original dimensions.

 

1

0.01 times the original dimensions.

nVScaleFactor

Vertical scale factor. Valid values are between 1 and 10000. For example:

 

Value

Meaning

 

100

The same dimensions.

 

110

1.1 times the original dimensions

 

120

1.2 times the original dimensions.

 

10000

100 times larger than the original dimensions.

 

99

0.99 times the original dimensions.

 

98

0.98 times the original dimensions.

 

1

0.01 times the original dimensions.

nAlignment

A value that determines how the scaled region will be aligned with respect to the original region. For a list of possible values, refer to PAINTALIGNMENT.

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 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_PntRegionSurface, L_PntRegionTranslate, L_PntSetClipRgn

Topics:

DigitalPaint Functions: Region Processing

 

Creating a Region

Example

 L_INT PntRegionScaleExample(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, 250, 110, 350, 210 ) ;

   /* Use the current region properties and the current painting 
       trasnformations to create an ellipse region */
   nRet = L_PntRegionEllipse ( pPaint, hDC, &rcRegion, &hRgn) ;
   if(nRet != SUCCESS)
      return nRet;

   /* Display the resulted region */
   FrameRgn ( hDC, hRgn, ( HBRUSH ) GetStockObject ( BLACK_BRUSH ), 1, 1 ) ;
  
   /* Scale the region */
   nRet = L_PntRegionScale (pPaint,
                           300,
                           300,
                           ( PAINTALIGNMENT ) (PAINT_ALIGNMENT_HCENTER |
                                               PAINT_ALIGNMENT_VCENTER),
                           &hRgn ) ;
   if(nRet != SUCCESS)
      return nRet;

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