LVectorBase::ApplyTransformation

#include "ltwrappr.h"

virtual L_INT LVectorBase::ApplyTransformation(L_VOID)

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

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function will apply 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.

Not supported in DirectX engine.

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:

LVectorBase::SetTranslation, LVectorBase::SetRotation, LVectorBase::SetScale, LVectorDialog::DoModalVectorRotate, LVectorDialog::DoModalVectorTranslate, LVectorDialog::DoModalVectorScale

Topics:

Rotating, Translating, Scaling Vector

 

Vector Images: Modifying Vector Object Characteristics

Example

This example opens an image, rotates it, and saves the result as a .dxf file.

The vector is saved as transformed.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LVectorBase__ApplyTransformationExample(HWND hWnd)
{
   L_INT          nRet;
   LVectorBase    Vector; 
   RECT           rect;
   //Load the drawing 
   nRet = Vector.Load(MAKE_IMAGE_PATH(TEXT("random.dxf")));
   if(nRet != SUCCESS)
      return nRet;
   //Attach to window
   nRet = Vector.AttachToWindow(hWnd);
   if(nRet != SUCCESS)
      return nRet;
   //Set viewport
   GetClientRect(hWnd, &rect);
   nRet = Vector.SetViewport(&rect);
   if(nRet != SUCCESS)
      return nRet;
   //Rotate 
   VECTORPOINT rotatePoint;
   nRet = Vector.GetRotation(&rotatePoint);
   if(nRet != SUCCESS)
      return nRet;
   rotatePoint.x += 30.0F;
   rotatePoint.y -= 100.0F;
   rotatePoint.z += 50.0F;
   Vector.SetRotation(&rotatePoint,NULL,NULL);
   //Make transformations apply to save
   nRet = Vector.ApplyTransformation();
   if(nRet != SUCCESS)
      return nRet;
   //Save
   Vector.SetFileName(MAKE_IMAGE_PATH(TEXT("image.dxf")));
   nRet = Vector.Save(FILE_DXF);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}