Gets the current transformation information for the toolkit.
#include "LtPnt.h"
L_LTPNT_API L_INT L_PntGetTransformation(pPaint, pXForm)
Pointer to a paint handle.
Pointer to a PAINTXFORM structure to be updated with the current painting transformations.
| Value | Meaning |
|---|---|
| SUCCESS | The function was successful. |
| < 1 | An error occurred. Refer to Return Codes. |
The transformation information is used for translating from external coordinates, such as mouse position, to the device context (DC) and/or bitmap coordinates.
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 ;}