#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.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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.
Required DLLs and Libraries
This example opens an image, rotates it, and saves the result as a .dxf file.
The vector is saved as transformed.
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;
}