L_LVKRN_API L_INT L_VecCopyObject(pVectorDst, pLayerDst, pObjectDst, pVectorSrc, pObjectSrc)
Copies a vector object to another object. This function is available in the LEADTOOLS Vector Imaging Pro Toolkit.
Pointer to the destination vector handle.
Pointer to the destination vector layer.
Pointer to the destination vector object.
Pointer to the source vector handle.
Pointer to the source vector object.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function can be used to do the following:
copy an object within the same layer.
copy an object from one layer to another layer within the same vector handle.
copy an object from a layer in one vector handle to a layer in another vector handle.
This function creates a new object that is a carbon copy of the source object, but they are not related. The source object can be deleted after the copying process without affecting the newly copied object.
Setting the pLayerDst parameter to NULL will copy the object into the current active layer in the destination vector handle (pVectorDst).
If the pObjectDst parameter is set to NULL, a handle to the newly added object will not be provided when the function returns. This is similar to calling L_VecAddObject with the pNewObject parameter set to NULL.
Required DLLs and Libraries
This example will copy the object under current mouse cursor to the active layer of another given vector handle.
L_LTVKRNTEX_API L_INT VecCopyObjectExample(
pVECTORHANDLE pVectorSrc,
pVECTORHANDLE pVectorDst,
const POINT* pptMouse )
{
VECTOROBJECT ObjectSrc;
VECTOROBJECT ObjectDst;
L_INT nRet;
/* Get object under mouse cursor */
nRet = L_VecHitTest( pVectorSrc, pptMouse, &ObjectSrc );
if( nRet == SUCCESS )
{
/* Object was found, copy to destination vector handle. Use the current active layer */
nRet = L_VecCopyObject( pVectorDst, NULL, &ObjectDst, pVectorSrc, &ObjectSrc );
}
else if (nRet == ERROR_VECTOR_OBJECT_NOT_FOUND)
return SUCCESS;
return nRet;
}