L_VecCopyObject

#include "lvkrn.h"

L_LVKRN_API L_INT L_VecCopyObject(pVectorDst, pLayerDst, pObjectDst, pVectorSrc, pObjectSrc)

pVECTORHANDLE pVectorDst;

/* pointer to a vector handle */

const pVECTORLAYER pLayerDst;

/* pointer to a vector layer */

pVECTOROBJECT pObjectDst;

/* pointer to a vector object */

const pVECTORHANDLE pVectorSrc;

/* pointer to a vector handle */

const pVECTOROBJECT pObjectSrc;

/* pointer to a vector object */

Copies a vector object to another object. This function is available in the LEADTOOLS Vector Imaging Pro Toolkit.

Parameter

Description

pVectorDst

Pointer to the destination vector handle.

pLayerDst

Pointer to the destination vector layer.

pObjectDst

Pointer to the destination vector object.

pVectorSrc

Pointer to the source vector handle.

pObjectSrc

Pointer to the source vector object.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function can be used to do the following:

image\sqrblit.gif copy an object within the same layer.

image\sqrblit.gif copy an object from one layer to another layer within the same vector handle.

image\sqrblit.gif 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

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_VecAddObject, L_VecGetObject, L_VecFreeObject, L_VecSetObject, L_VecExplodeObject

Topics:

Working with Vector Objects

Example

This example will copy the object under current mouse cursor to the active layer of another given vector handle.

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;
}