LRasterPaint::SetTransformation

#include "Ltwrappr.h"

L_INT LRasterPaint::SetTransformation(pXForm)

pPAINTXFORM pXForm;

pointer to a PAINTXFORM structure

Sets the toolkit transformation information.

Parameter

Description

pXForm

Pointer to a PAINTXFORM structure that contains transform values used to transform input coordinates. If this parameter is NULL, the zoom will default to 100 and the offset values will default to 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes

Comments

The toolkit will transform all input and output coordinates, using the values set by this function, unless otherwise stated.

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:

LRasterPaint::GetTransformation, LRasterPaint::GetDCExtents, LRasterPaint::SetDCExtents, LRasterPaint::SetMetrics, Class Members

Topics:

Setting General DigitalPaint Information

Example

L_INT LRasterPaint_SetTransformationExample( CWnd* pWnd, LBitmap* pBitmap, L_INT m_nZoomFactor, L_INT m_nHscroll, L_INT m_nVscroll) 
{ 
   //data member L_INT m_nZoomFactor = 500 ; 
   //data member L_INT m_nHscroll    = 0 ; 
   //data member L_INT m_nVscroll    = 0 ; 
   L_INT          nRet; 
   LRasterPaint   rstp ; 
   CDC*           pDC = pWnd->GetDC() ; 
   RECT           rcView ; 
   L_INT          nXOffset, nYOffset ; 
   RECT           rcShapeRect ; 
   PAINTXFORM     PntXForm ; 
   RECT           rcDCExtents ; 
   /* Initiate the Paint toolkit */ 
   nRet = rstp.Initialize (); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* set the painting rectangel */ 
   SetRect ( &rcView, 0, 0, pBitmap->GetWidth() , pBitmap->GetHeight() ) ; 
   if ( m_nZoomFactor < 100 ) 
   { 
      nXOffset = - MulDiv ( m_nHscroll, 100, m_nZoomFactor ) ; 
      nYOffset = - MulDiv ( m_nVscroll, 100, m_nZoomFactor ) ; 
   } 
   else 
   { 
      nXOffset = - m_nHscroll ; 
      nYOffset = - m_nVscroll ; 
   } 
   OffsetRect ( &rcView, nXOffset, nYOffset ) ; 
   rcView.left   = MulDiv ( rcView.left,   m_nZoomFactor, 100 ) ; 
   rcView.top    = MulDiv ( rcView.top,    m_nZoomFactor, 100 ) ; 
   rcView.right  = MulDiv ( rcView.right,  m_nZoomFactor, 100 ) ; 
   rcView.bottom = MulDiv ( rcView.bottom, m_nZoomFactor, 100 ) ; 
   // set the paintin transformatoins values. 
   PntXForm.nZoom    = m_nZoomFactor ; 
   PntXForm.nXOffset = - rcView.left ; 
   PntXForm.nYOffset = - rcView.top ; 
   /* Set the painting transformations to reflect a zoom-in by 5:1 */ 
   nRet = rstp.SetTransformation ( &PntXForm ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
   /* 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 ) ; 
   /* Free the paint tools handle */ 
   nRet = rstp.Free ( ) ; 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS ; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS DigitalPaint C++ Class Library Help