Rotates all or part of the specified vector image. This function is available in the LEADTOOLS Vector Imaging Toolkit.
#include "ltvkrn.h"
L_LVKRN_API L_INT L_VecSetRotation(pVector, pRotation, pObject, pOrigin, dwFlags)
Pointer to a vector handle.
Pointer to a VECTORPOINT structure that contains the rotation values for each axis. The rotation values are in degrees.
Pointer to a VECTOROBJECT structure that references the object to rotate. If this parameter is not NULL, only the specified object will be rotated. If this parameter is NULL, the objects to rotate are determined by dwFlags.
Pointer to a VECTORPOINT structure that contains the center of rotation. If pOrigin is not NULL, rotation occurs around this point. If pOrigin is NULL, the center of rotation is the accumulative center of the objects to be rotated.
Flag that indicates which objects to rotate. This flag is valid only if pObject is NULL. If pObject is not NULL, this parameter is ignored. Possible values are:
Value | Meaning |
---|---|
0 | Rotate all objects. |
VECTOR_FLAGS_SELECTED_ONLY | Rotate only the currently selected objects within the vector handle. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Rotates all or part of the specified vector image based on the rotation values in pRotation.
The translation values may be retrieved using L_VecGetRotation.
You should call L_VecApplyTransformation to make the rotation part of the vector image, if you do not your changes will not be saved.
Note: When you rotate an object, it may or may not effect other unselected objects sharing vertices with the selected object. This depends on the current bind vertices mode set by L_VecSetBindVerticesMode.
This example will rotate all objects in a vector handle by 30 degrees along the x-axis, -20 degrees the y-axis and +50 degrees along the z-axis.
L_INT VecSetRotationExample(pVECTORHANDLE pVector)
{
L_INT nRet;
VECTORPOINT rotation;
/* Get current rotation values */
nRet = L_VecGetRotation( pVector, &rotation );
if(nRet != SUCCESS)
return nRet;
/* +30 degrees along the x-axis */
rotation.x += 30.0;
/* -20 degrees along the y-axis */
rotation.y -= 20.0;
/* +50 degrees along the z-axis */
rotation.z += 50.0;
/* Set new rotation values. Note that we will rotate around the center of the drawing */
nRet = L_VecSetRotation( pVector, &rotation, NULL, NULL, 0L );
return nRet;
}