L_VecAddObject

Summary

Adds a new object to a vector layer. This function is available in the LEADTOOLS Vector Imaging Toolkit.

Syntax

#include "ltvkrn.h"

L_LVKRN_API L_INT L_VecAddObject(pVector, pLayer, nType, pObjectDesc, pNewObject)

Parameters

pVECTORHANDLE pVector

Pointer to the destination vector handle.

const pVECTORLAYER pLayer

Pointer to the destination vector layer.

L_INT nType

Type of object to add. Possible values are:

Value Meaning
VECTOR_ARC Arc.
VECTOR_CHORD Chord.
VECTOR_CIRCLE Circle.
VECTOR_CLONE Clone object of a vector group.
VECTOR_ELLIPSE Ellipse.
VECTOR_ELLIPTICALARC Elliptical arc.
VECTOR_LINE Line.
VECTOR_PIE Pie section.
VECTOR_POLYBEZIER Poly Bezier curve.
VECTOR_POLYDRAW Polydraw.
VECTOR_POLYGON Polygon.
VECTOR_POLYLINE Polyline.
VECTOR_RASTER Raster.
VECTOR_RECTANGLE Rectangle.
VECTOR_TEXT Text.
VECTOR_VERTEX 3D vertex in space.

const L_VOID * pObjectDesc

Pointer to a vector object that contains information about the object to add.

pVECTOROBJECT pNewObject

Pointer to a VECTOROBJECT structure that references the newly added object.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

If pLayer is NULL, the object will be added to the current active layer within the vector handle.

If pNewObject is NULL, this pointer will not be updated with the address of the newly added object.

You may need to cast from your given object type (VECTORPOLYGON, VECTORTEXT, etc) when using this function. (See the example below.)

Required DLLs and Libraries

See Also

Functions

Topics

Example

This example will add a new red line from 1.0, 1.0, 0.0 to 2.0, 2.0, 0.0 to the vector handle.

L_INT VecAddObjectExample(pVECTORHANDLE pVector) 
{ 
   L_INT nRet; 
   VECTORLINE Line; 
 
   /* Init the new object */ 
   nRet = L_VecInitObject( &Line.Object ); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   Line.Object.nSize = sizeof( VECTORLINE ); 
   Line.Object.nType = VECTOR_LINE; 
 
   Line.Point[ 0 ].x = 1.0; 
   Line.Point[ 0 ].y = 1.0; 
   Line.Point[ 0 ].z = 0.0; 
   Line.Point[ 1 ].x = 2.0; 
   Line.Point[ 1 ].y = 2.0; 
   Line.Point[ 1 ].z = 0.0; 
 
   Line.Pen.nSize                      = sizeof( VECTORPEN ); 
   Line.Pen.bExtPen                    = FALSE; 
   Line.Pen.NewPen.LogPen.lopnStyle    = PS_SOLID; 
   Line.Pen.NewPen.LogPen.lopnWidth.x  = 1; 
   Line.Pen.NewPen.LogPen.lopnWidth.y  = 0; 
   Line.Pen.NewPen.LogPen.lopnColor    = RGB( 0xFF, 0x00, 0x00 ); 
 
   /* add to current active layer */ 
   nRet = L_VecAddObject ( pVector, NULL, VECTOR_LINE, &Line, NULL ); 
 
   return nRet; 
} 

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Vector C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.