Applies the current transformation to the vector image. This function is available in the LEADTOOLS Vector Imaging Pro Toolkit.
#include "ltvkrn.h"
L_LVKRN_API L_INT L_VecApplyTransformation( pVector)
Pointer to a vector handle referencing an image drawing.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function will apply the current transformation (Rotation, scaling and translation) to the vector image. The vector image objects will be changed.
After a call to this function, rotation, scaling and translation values will be reset.
This example loads a vector drawing, applies some transformation then saves it back.
L_LTVKRNTEX_API L_INT VecApplyTransformationExample(L_TCHAR* pszFile, L_TCHAR* pszTargetFile)
{
L_INT nRet;
VECTORHANDLE TmpVector; /* Vector handle for initial loading */
VECTORPOINT point;
/* Load the drawing */
nRet = L_VecLoadFile( pszFile, &TmpVector, NULL, NULL );
if(nRet != SUCCESS)
return nRet;
/* Rotate 30 degrees along the 3 axes */
point.x = 30.0;
point.y = 30.0;
point.z = 30.0;
nRet = L_VecSetRotation( &TmpVector, &point, NULL, NULL, 0L );
if(nRet != SUCCESS)
return nRet;
/* Scale to 200% */
point.x = 2.0;
point.y = 2.0;
point.z = 2.0;
nRet = L_VecSetScale( &TmpVector, &point, NULL, NULL, 0L );
if(nRet != SUCCESS)
return nRet;
/* Translate 5 units along each axis */
point.x = 5.0;
point.y = 5.0;
point.z = 5.0;
nRet = L_VecSetTranslation( &TmpVector, &point, NULL, 0L );
if(nRet != SUCCESS)
return nRet;
/* Apply the transformation to the image */
nRet = L_VecApplyTransformation( &TmpVector );
if(nRet != SUCCESS)
return nRet;
/* Save it */
nRet = L_VecSaveFile(pszTargetFile, &TmpVector, FILE_DXF, NULL);
if(nRet != SUCCESS)
return nRet;
/* Free the vector */
nRet = L_VecFree( &TmpVector );
return nRet;
}