L_VecAddObject

#include "lvkrn.h"

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

pVECTORHANDLE pVector;

/* pointer to a vector handle */

const pVECTORLAYER pLayer;

/* pointer to a vector layer */

L_INT nType;

/* object type */

const L_VOID * pObjectDesc;

/* pointer to a vector object */

pVECTOROBJECT pNewObject;

/* pointer to the new vector object */

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

Parameter

Description

pVector

Pointer to the destination vector handle.

pLayer

Pointer to the destination vector layer.

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_STOCK

Stock object from a stock library.

 

VECTOR_TEXT

Text.

 

VECTOR_VERTEX

3D vertex in space.

pObjectDesc

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

pNewObject

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

Returns

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

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_VecInitObject

Topics:

Working with Vector Objects

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