LVectorBase::AddObject

Summary

Adds a new vector object to the class object's active vector layer.

This function is available in the LEADTOOLS Vector Imaging Toolkit.

Syntax

#include "ltwrappr.h"

virtual L_INT LVectorBase::AddObject(pVectorObject);

Parameters

LVectorObject * pVectorObject

Pointer to an LVectorObject object that references the vector object to add.

Returns

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

Required DLLs and Libraries

See Also

Functions

Topics

Example

This example will add a new green vertex to the Active Layer LVectorBase object.
Once added, the color will be changed to blue.

L_INT LVectorBase__AddObjectExample(HWND hWnd, LVectorBase *pVector) 
{ 
   UNREFERENCED_PARAMETER(hWnd); 
 
   L_INT          nRet; 
   VECTORVERTEX   Vertex; 
 
   //Create Vertex Object 
   Vertex.Point.x = 50; 
   Vertex.Point.y = 50; 
   Vertex.Point.z = 10; 
   Vertex.Pen.bExtPen = FALSE; 
   Vertex.Pen.nSize = sizeof( VECTORPEN ); 
   Vertex.Pen.NewPen.LogPen.lopnStyle = PS_SOLID; 
   Vertex.Pen.NewPen.LogPen.lopnWidth.x = 10; 
   Vertex.Pen.NewPen.LogPen.lopnWidth.y = 10; 
   Vertex.Pen.NewPen.LogPen.lopnColor = RGB(0,255,0); 
 
   LVectorVertex VectorVertex(&Vertex); 
 
   nRet = pVector->AddObject(&VectorVertex); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   //Now change color to blue 
   MessageBox(NULL, TEXT("Changing color to red"), TEXT(""), MB_OK); 
 
   VECTORVERTEX VertexTemp; 
 
   nRet = VectorVertex.LockObject(&VertexTemp); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   VertexTemp.Pen.bExtPen = FALSE; 
   VertexTemp.Pen.NewPen.LogPen.lopnColor = RGB(255,0,0); 
   nRet = VectorVertex.UnlockObject(&VertexTemp); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   //LVectorVertex destructor called when VectorVertex goes out of scope 
 
   return SUCCESS; 
} 

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++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.