Copies the contents of one group to another. This function is available in the LEADTOOLS Vector Imaging Toolkit.
#include "ltvkrn.h"
L_LVKRN_API L_INT L_VecCopyGroup(pVectorDst, pGroupDst, pVectorSrc, pGroupSrc, dwFlags)
Pointer to the destination vector handle.
Pointer to a VECTORGROUP structure that references the destination group.
Pointer to the source vector handle.
Pointer to a VECTORGROUP structure that references the source group.
Flag that indicates whether or not to empty the destination group before copying. Possible values are:
Value | Meaning |
---|---|
0 | Do not empty the destination group before copying. |
VECTOR_FLAGS_REPLACE | Empty the destination group before copying. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
The destination group can be in the same vector handle as the source group, or it can be in a different vector handle.
This example will copy the group with the given name from the source vector to the destination vector.
L_INT VecCopyGroupExample(
pVECTORHANDLE pVectorDst,
pVECTORHANDLE pVectorSrc,
L_TCHAR* pszName)
{
VECTORGROUP GroupSrc, GroupDst;
VECTORGROUPDESC GroupDesc;
L_INT nRet;
/* Get the group with the given name */
nRet = L_VecGetGroupByName( pVectorSrc, pszName, &GroupSrc );
if( nRet == SUCCESS )
{
/* get the group properties */
nRet = L_VecGetGroup( pVectorSrc, &GroupSrc, &GroupDesc );
if(nRet != SUCCESS)
return nRet;
/* add to the destination vector */
nRet = L_VecAddGroup( pVectorDst, &GroupDesc, &GroupDst , VECTOR_FLAGS_RENAME_DUPLICATES);
if(nRet != SUCCESS)
return nRet;
/* no need for the group properties anymore */
nRet = L_VecFreeGroup( &GroupDesc );
if(nRet != SUCCESS)
return nRet;
/* copy content of source group into destination */
nRet = L_VecCopyGroup( pVectorDst, &GroupDst, pVectorSrc, &GroupSrc, 0L );
}
return nRet;
}