L_PntGetTransformation

#include "LtPnt.h"

L_LTPNT_API L_INT L_PntGetTransformation(pPaint, pXForm)

Gets the current transformation information for the toolkit.

Parameters

pPAINTHANDLE pPaint

Pointer to a paint handle.

pPAINTXFORM pXForm

Pointer to a PAINTXFORM structure to be updated with the current painting transformations.

Returns

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

Comments

The transformation information is used for translating from external coordinates, such as mouse position, to the device context (DC) and/or bitmap coordinates.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT PntGetTransformationExample(pPAINTHANDLE     pPaint, 
                                                  HWND             hWnd, 
                                                  pBITMAPHANDLE    pBitmap ) 
{ 
   L_INT nRet; 
   HDC        hDC ; 
   RECT       rcView ; 
   RECT       rcShapeRect ; 
   PAINTXFORM PntXForm ; 
 
   /* Initiate the Paint toolkit */ 
   nRet = L_PntInit ( &pPaint ); 
   if ( SUCCESS != nRet) 
   { 
      return nRet; 
   } 
 
   /* Get the Current painting transformations  */ 
   nRet = L_PntGetTransformation ( pPaint, &PntXForm ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   rcView.left   = - PntXForm.nXOffset ; 
   rcView.top    = - PntXForm.nYOffset ; 
   rcView.right  = rcView.left + MulDiv ( BITMAPWIDTH  ( pBitmap ), PntXForm.nZoom, 100 ) ; 
   rcView.bottom = rcView.top  + MulDiv ( BITMAPHEIGHT ( pBitmap ), PntXForm.nZoom, 100 ) ; 
 
   /* Get the device context */ 
   hDC = GetDC ( hWnd ) ; 
 
   /* paint the bitmap */ 
   nRet = L_PaintDC( hDC, pBitmap, NULL, NULL, &rcView, NULL, SRCCOPY ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Set the rectangle coordinates with respect to the DC dimensions*/ 
   SetRect ( &rcShapeRect, 10, 10, 150, 150 ) ; 
 
   /* Set the DC Extents */ 
   RECT rcClient; 
   GetClientRect(hWnd, &rcClient); 
   nRet = L_PntSetDCExtents ( pPaint, &rcClient ); 
 
   /* Use the current shape properties to draw a rectangle to DC (hDC) */ 
   nRet = L_PntDrawShapeRectangle ( pPaint, hDC, &rcShapeRect ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Release the device context */ 
   ReleaseDC ( hWnd, hDC ) ; 
 
   return SUCCESS ; 
} 
Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Digital Paint C API Help