L_VecApplyTransformation

#include "lvkrn.h"

L_LVKRN_API L_INT L_VecApplyTransformation( pVector)

pVECTORHANDLE pVector;

/* pointer to a vector handle */

Applies the current transformation to the vector image. This function is available in the LEADTOOLS Vector Imaging Pro Toolkit.

Parameter

Description

pVector

Pointer to a vector handle referencing an image drawing.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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.

Required DLLs and Libraries

LVKRN

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_VecSetRotation, L_VecSetScale, L_VecSetTranslation

Example

This example loads a vector drawing, applies some transformation then saves it back.

L_INT VecApplyTransformationExample(L_TCHAR* pszFile)
{
   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;
   /* Saves it back */
   nRet = L_VecSaveFile( pszFile, &TmpVector, FILE_DXF, NULL );
   if(nRet != SUCCESS)
      return nRet;
   /* Free the vector */
   nRet = L_VecFree( &TmpVector );
   return nRet;
}