L_LVKRN_API L_INT L_VecAddLayer(pVector, pLayerDesc, pLayer, dwFlags)
Adds a new empty layer to a vector handle.
This function is available in the LEADTOOLS Vector Imaging Pro Toolkit.
Pointer to the vector handle.
Pointer to a VECTORLAYERDESC structure that contains the new layer settings.
Pointer to a VECTORLAYER structure to be updated with the handle of the new layer.
Flag that indicates whether or not to rename duplicate layer names. Possible values are:
Value | Meaning |
---|---|
0 | Don't rename duplicate layer names, if found. |
VECTOR_FLAGS_RENAME_DUPLICATES | Renames duplicate layer names if found. The toolkit will add a suffix (0, 1, 2, etc) to the layer name if duplicated. Checking will be aborted when the suffix value reaches 999 and no unique name can be created. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
For more information on the layer settings, refer to the VECTORLAYERDESC structure.
To change layer settings, get the current layer settings by calling L_VecGetLayer, set the new settings in the VECTORLAYERDESC structure pointed to by pLayerDesc and then set the new layer settings by calling L_VecSetLayer.
Required DLLs and Libraries
This example will add a new layer to a vector handle.
L_LTVKRNTEX_API L_INT VecAddLayerExample(pVECTORHANDLE pVector)
{
L_INT nRet;
VECTORLAYERDESC LayerDesc;
VECTORLAYER Layer;
LayerDesc.nSize = sizeof( VECTORLAYERDESC );
lstrcpy( LayerDesc.szName, TEXT("My Layer"));
LayerDesc.bVisible = TRUE;
LayerDesc.bLocked = FALSE;
LayerDesc.dwTag = 0L;
nRet = L_VecAddLayer( pVector, &LayerDesc, &Layer, VECTOR_FLAGS_RENAME_DUPLICATES );
if( nRet != SUCCESS)
MessageBox( NULL, TEXT("Could not add layer!"), NULL, MB_OK );
return nRet;
}