LRasterPaint::GetTransformation

#include "Ltwrappr.h"

L_INT LRasterPaint::GetTransformation(pXForm)

Gets the toolkit's current transformation information.

Parameters

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 LRasterPaint_GetTransformationExample( LRasterPaint &rstp, CWnd* pWnd, LBitmap* pBitmap ) 
{ 
   L_INT       nRet; 
   CDC*        pDC = pWnd->GetDC( ) ; 
   RECT        rcView ; 
   RECT        rcShapeRect ; 
   PAINTXFORM  PntXForm ; 
   RECT           rcDCExtents ; 
 
   /* Get the Current painting transformations  */ 
   nRet = rstp.GetTransformation ( &PntXForm ) ;  
   if(nRet != SUCCESS) 
      return nRet; 
 
   rcView.left   = - PntXForm.nXOffset ;  
   rcView.top    = - PntXForm.nYOffset ;  
   rcView.right  = rcView.left + MulDiv ( pBitmap->GetWidth (  ), PntXForm.nZoom, 100 ) ; 
   rcView.bottom = rcView.top  + MulDiv ( pBitmap->GetHeight (  ), PntXForm.nZoom, 100 ) ; 
 
   /* paint the bitmap */ 
   pBitmap->Paint( )->SetDC( pDC->m_hDC ); 
   pBitmap->SetDstRect( &rcView ); 
   pBitmap->Paint( )->PaintDC(); 
 
   /* Set the rectangle coordinates with respect to the DC dimensions*/ 
   SetRect ( &rcShapeRect, 10, 10, 150, 150 ) ; 
 
   /* Get the destination DC dimensions */   
   pWnd->GetClientRect ( &rcDCExtents ) ; 
 
   /* Set the toolkit user DC extents */ 
   nRet = rstp.SetDCExtents ( &rcDCExtents ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Use the current shape properties to draw a rectangle to DC (hDC) */ 
   nRet = rstp.DrawShapeRectangle ( pDC->m_hDC, &rcShapeRect ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Release the device context */ 
   pWnd->ReleaseDC( pDC ) ; 
 
   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 DigitalPaint C++ Class Library Help