L_PntGetTransformation
#include "LtPnt.h"
L_LTPNT_API L_INT L_PntGetTransformation(pPaint, pXForm)
|
pPAINTHANDLE pPaint; |
/* pointer to a paint handle */ |
|
pPAINTXFORM pXForm; |
/* pointer to a structure */ |
Gets the current transformation information for the toolkit.
|
Parameter |
Description |
|
pPaint |
Pointer to a paint handle. |
|
pXForm |
Pointer to a PAINTXFORM structure to be updated with the current painting transformations. |
Returns
|
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
|
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_PntSetTransformation, L_PntGetDCExtents, L_PntSetDCExtents, L_PntSetMetrics |
|
Topics: |
|
|
|
Example
L_INT PntGetTransformationExample(pPAINTHANDLE pPaint,
HWND hWnd,
pBITMAPHANDLE pBitmap )
{
L_INT nRet;
HDC hDC ;
RECT rcView ;
RECT rcShapeRect ;
PAINTXFORM PntXForm ;
/* 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 ) ;
/* 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 ;
}