VSGraphX DLL Application Programming Interface

 

 


Overview

VSGraphX DLL API allows you to use the VSGraphX DLL to:
          Open and save vector drawing files.
          Display vector drawings.
          Get information for vector drawings and their graphics entities.
          Create new vector drawings.
          Add graphics entities to vector drawings.

Features:
          Fast file loading and saving.
          Fast and precise drawing.
          Accurate information for drawings and graphics entities.
          Comprehensive and easy to use API.
          Quick and easy integration into C, C++ projects.

Supported file formats:
          Open:
                    Adobe® AI (up to version 10).
                    AutoCAD® DXF (up to version 2002).
                    Windows® EMF.
                    Windows® WMF.
                    HPGL® Plotter (PLT).
          Save:
                    Adobe® AI (version 7).
                    AutoCAD® DXF (version 2002).
                    Windows® EMF.
                    HPGL® Plotter (PLT).

*All Trademarks belong to their respective owners

Supported graphics entities:
          PolyBezier path.
          Text.
          Bitmap.

API supported languages:
          C, C++.

 

 

 

 


VSGraphX DLL C / C++ API

VSGraphX DLL C / C++ API allows you to use the VSGraphX DLL in your C / C++ projects.

For an Object Oriented approach, C++ programmers have the option to use the CVSGraphX wrapper class.

Functions:

Open vector drawing files
VSGRAPHXOpen VSGRAPHXOpenEMF
VSGRAPHXOpenAI VSGRAPHXOpenWMF
VSGRAPHXOpenDXF VSGRAPHXOpenPLT
 
Save vector drawing files
VSGRAPHXSave VSGRAPHXSaveEMF
VSGRAPHXSaveAI VSGRAPHXSavePLT
VSGRAPHXSaveDXF  
 
Display vector drawings
VSGRAPHXDraw VSGRAPHXDrawArea
 
Create vector drawings
VSGRAPHXCreate  
 
Close vector drawings
VSGRAPHXClose  
 
Get information for vector drawings and their graphics entities
VSGRAPHXGetBounds VSGRAPHXGetEntityWidth
VSGRAPHXGetLeft VSGRAPHXGetEntityHeight
VSGRAPHXGetTop VSGRAPHXGetNumOfEntities
VSGRAPHXGetRight VSGRAPHXGetEntityType
VSGRAPHXGetBottom VSGRAPHXGetPolyBezierPathInfo
VSGRAPHXGetWidth VSGRAPHXGetPolyBezierPathSize
VSGRAPHXGetHeight VSGRAPHXGetBezierPathSize
VSGRAPHXGetEntityBounds VSGRAPHXGetBezierPathTriplet
VSGRAPHXGetEntityLeft VSGRAPHXGetTextInfo
VSGRAPHXGetEntityTop VSGRAPHXGetFontName
VSGRAPHXGetEntityRight VSGRAPHXGetText
VSGRAPHXGetEntityBottom VSGRAPHXGetBitmap
 
Add graphics entities to vector drawings
VSGRAPHXBeginPolyBezierPath VSGRAPHXAddPolyBezierPath
VSGRAPHXAddBezierPathTriplet VSGRAPHXAddText
VSGRAPHXAddBezierPath VSGRAPHXAddBitmap
 
Units handling
VSGRAPHXGetUnits VSGRAPHXSetUnits
 
Other
VSGRAPHXCreateIcon VSGRAPHXCreateBitmap24

 

 


int VSGRAPHXOpen(LPCTSTR filepath)

input:    
  filepath: The filepath of the drawing file to be opened.
returns:  
  The vsgraphx handle to the drawing opened, or VSGRAPHX_ERROR in case of failure.
remarks:  
  Opens a drawing file. The drawing file type is obtained from the file extension.



int VSGRAPHXOpenAI(LPCTSTR filepath)

input:    
  filepath: The filepath of the drawing file to be opened.
returns:  
  The vsgraphx handle to the drawing opened, or VSGRAPHX_ERROR in case of failure.
remarks:  
  Opens an AI drawing file, regardless of the file extension.



int VSGRAPHXOpenDXF(LPCTSTR filepath)

input:    
  filepath: The filepath of the drawing file to be opened.
returns:  
  The vsgraphx handle to the drawing opened, or VSGRAPHX_ERROR in case of failure.
remarks:  
  Opens a DXF drawing file, regardless of the file extension.



int VSGRAPHXOpenEMF(LPCTSTR filepath)

input:    
  filepath: The filepath of the drawing file to be opened.
returns:  
  The vsgraphx handle to the drawing opened, or VSGRAPHX_ERROR in case of failure.
remarks:  
  Opens an EMF drawing file, regardless of the file extension.



int VSGRAPHXOpenWMF(LPCTSTR filepath)

input:    
  filepath: The filepath of the drawing file to be opened.
returns:  
  The vsgraphx handle to the drawing opened, or VSGRAPHX_ERROR in case of failure.
remarks:  
  Opens a WMF drawing file, regardless of the file extension.



int VSGRAPHXOpenPLT(LPCTSTR filepath)

input:    
  filepath: The filepath of the drawing file to be opened.
returns:  
  The vsgraphx handle to the drawing opened, or VSGRAPHX_ERROR in case of failure.
remarks:  
  Opens a PLT drawing file, regardless of the file extension.



int VSGRAPHXSave(int vsgraphx, LPCTSTR filepath)

input:    
  vsgraphx: The vsgraphx handle to the drawing to be saved.
  filepath: The filepath of the drawing file to be saved.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Saves a drawing file. The drawing file type is obtained by the file extension.



int VSGRAPHXSaveAI(int vsgraphx, LPCTSTR filepath)

input:    
  vsgraphx: The vsgraphx handle to the drawing to be saved.
  filepath: The filepath of the drawing file to be saved.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Saves an AI drawing file, regardless of the file extension.



int VSGRAPHXSaveDXF(int vsgraphx, LPCTSTR filepath)

input:    
  vsgraphx: The vsgraphx handle to the drawing to be saved.
  filepath: The filepath of the drawing file to be saved.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Saves a DXF drawing file, regardless of the file extension.



int VSGRAPHXSaveEMF(int vsgraphx, LPCTSTR filepath)

input:    
  vsgraphx: The vsgraphx handle to the drawing to be saved.
  filepath: The filepath of the drawing file to be saved.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Saves an EMF drawing file, regardless of the file extension.



int VSGRAPHXSavePLT(int vsgraphx, LPCTSTR filepath)

input:    
  vsgraphx: The vsgraphx handle to the drawing to be saved.
  filepath: The filepath of the drawing file to be saved.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Saves a PLT drawing file, regardless of the file extension.



void VSGRAPHXDraw(int vsgraphx, HDC hDC, LPCRECT drawRect)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  hDC: The HDC that will be used.
  drawRect: The rectangle (in hDC logical units) where the drawing will fit.
remarks:  
  Draws a drawing to the argument HDC, and fits it into the rectangle specified by the drawRect argument.
 


void VSGRAPHXDrawArea(int vsgraphx, HDC hDC, LPCRECT drawRect,
                                                double areaLeft, double areaTop, double areaRight, double areaBottom)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  hDC: The HDC that will be used.
  drawRect: The rectangle (in hDC logical units) where the drawing's area will fit.
  areaLeft: The left position (in drawing's units) of the drawing's area.
  areaTop: The top position (in drawing's units) of the drawing's area.
  areaRight: The right position (in drawing's units) of the drawing's area.
  areaBottom: The bottom position (in drawing's units) of the drawing's area..
remarks:  
  Draws a rectangle area of a drawing to the argument HDC, and fits this area into the rectangle specified by the drawRect argument.
 


int VSGRAPHXCreate()

returns:  
  The vsgraphx handle to the new drawing. In case of failure returns VSGRAPHX_ERROR.
remarks:  
  Creates a new drawing.



void VSGRAPHXClose(int vsgraphx)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
remarks:  
 

Closes the vsgraphx handle to a drawing and releases all associated resources. Should be called for every vsgraphx handle opened or created.




BOOL VSGRAPHXGetBounds(int vsgraphx, double *left, double *top, double *right, double *bottom)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
output:    
  left: The left position of the drawing (in drawing's units).
  top: The top position of the drawing (in drawing's units).
  right: The right position of the drawing (in drawing's units).
  bottom: The bottom position of the drawing (in drawing's units).
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Gets the boundaries of a drawing (in drawing's units).



double VSGRAPHXGetLeft(int vsgraphx)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
returns:  
  The left position of the drawing (in drawing's units).



double VSGRAPHXGetTop(int vsgraphx)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
returns:  
  The top position of the drawing (in drawing's units).



double VSGRAPHXGetRight(int vsgraphx)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
returns:  
  The right position of the drawing (in drawing's units).



double VSGRAPHXGetBottom(int vsgraphx)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
returns:  
  The bottom position of the drawing (in drawing's units).



double VSGRAPHXGetWidth(int vsgraphx)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
returns:  
  The width of the drawing (in drawing's units).



double VSGRAPHXGetHeight(int vsgraphx)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
returns:  
  The height of the drawing (in drawing's units).



BOOL VSGRAPHXGetEntityBounds(int vsgraphx, int index,
                                                            double *left, double *top, double *right, double *bottom)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the graphics entity in the drawing.
output:    
  left: The left position of the graphics entity (in drawing's units).
  top: The top position of the graphics entity (in drawing's units).
  right: The right position of the graphics entity (in drawing's units).
  bottom: The bottom position of the graphics entity (in drawing's units).
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Gets the boundaries of a graphics entity (in drawing's units).



double VSGRAPHXGetEntityLeft(int vsgraphx, int index)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the graphics entity in the drawing.
returns:  
  The left position of the graphics entity (in drawing's units).



double VSGRAPHXGetEntityTop(int vsgraphx, int index)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the graphics entity in the drawing.
returns:  
  The top position of the graphics entity (in drawing's units).



double VSGRAPHXGetEntityRight(int vsgraphx, int index)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the graphics entity in the drawing.
returns:  
  The right position of the graphics entity (in drawing's units).



double VSGRAPHXGetEntityBottom(int vsgraphx, int index)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the graphics entity in the drawing.
returns:  
  The bottom position of the graphics entity (in drawing's units).



double VSGRAPHXGetEntityWidth(int vsgraphx, int index)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the graphics entity in the drawing.
returns:  
  The width of the graphics entity (in drawing's units).



double VSGRAPHXGetEntityHeight(int vsgraphx, int index)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the graphics entity in the drawing.
returns:  
  The height of the graphics entity (in drawing's units).



int VSGRAPHXGetNumOfEntities(int vsgraphx)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
returns:  
  The number of graphics entities in the drawing.



int VSGRAPHXGetEntityType(int vsgraphx, int index)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the graphics entity in the drawing.
returns:  
 
The graphics entity's type. It can be one of the following: VSGRAPHX_ENTITY_POLYBEZIER, VSGRAPHX_ENTITY_TEXT, VSGRAPHX_ENTITY_BITMAP. In case of failure returns VSGRAPHX_ERROR.



BOOL VSGRAPHXGetPolyBezierPathInfo(int vsgraphx, int index, double *pnWidth, UINT *pnStyle,
                                              COLORREF *pnColor, UINT *brStyle, COLORREF *brColor, LONG *hatch)


input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the PolyBezierPath entity in the drawing.
output:    
  pnWidth: The pen width (in drawing's units) of the PolyBezierPath entity.
  pnStyle: The pen style of the PolyBezierPath entity.
  pnColor: The pen color of the PolyBezierPath entity.
  brStyle: The brush style of the PolyBezierPath entity.
  brColor: The brush color of the PolyBezierPath entity.
  hatch: The hatch style of the PolyBezierPath entity.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Gets the info about the pen and brush that are used for drawing a PolyBezierPath entity.



int VSGRAPHXGetPolyBezierPathSize(int vsgraphx, int index)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the PolyBezierPath entity in the drawing.
returns:  
  The number of Bezier paths that a PolyBezier path has.



int VSGRAPHXGetBezierPathSize(int vsgraphx, int index, int path)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the PolyBezierPath entity in the drawing.
  path: The index of the Bezier path in the PolyBezierPath entity.
returns:  
  The number of triplets that a Bezier path has.



BOOL VSGRAPHXGetBezierPathTriplet(int vsgraphx, int index, int path, int trIndex,
                                                                       double *preDirPoX, double *preDirPoY,
                                                                       double *anchPoX, double *anchPoY,
                                                                       double *postDirPoX, double *postDirPoY)


input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the PolyBezierPath entity in the drawing.
  path: The index of the Bezier path in the PolyBezierPath entity.
  trIndex: The index of the triplet in the Bezier path.
output:    
  preDirPoX: The x coordinate (in drawing's units) of the triplet's pre-direction point.
  preDirPoY: The y coordinate (in drawing's units) of the triplet's pre-direction point.
  anchPoX: The x coordinate (in drawing's units) of the triplet's anchor point.
  anchPoY: The y coordinate (in drawing's units) of the triplet's anchor point.
  postDirPoX: The x coordinate (in drawing's units) of the triplet's post-direction point.
  postDirPoY: The y coordinate (in drawing's units) of the triplet's post-direction point.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Gets the coordinates (in drawing's units) of a Bezier path triplet.



BOOL VSGRAPHXGetTextInfo(int vsgraphx, int index, double *poX, double *poY, BYTE *style,
                                                        double *height, double *angle, COLORREF *color)


input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the Text entity in the drawing.
output:    
  poX: The x coordinate (in drawing's units) of the Text entity's top left point.
  poY: The y coordinate (in drawing's units) of the Text entity's top left point.
  style: The style of the Text entity. The text style can be a combination of the following: VSGRAPHX_TEXT_STYLE_NORMAL, VSGRAPHX_TEXT_STYLE_ITALIC, VSGRAPHX_TEXT_STYLE_BOLD, VSGRAPHX_TEXT_STYLE_UNDERLINE.
  height: The height (in drawing's units) of the Text entity.
  angle: The angle (in degrees) of the Text entity.
  color: The color of the Text entity.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Gets the coordinates (in drawing's units) of a Text entity's top left point, as well as the style, height (in drawing's units), angle (in degrees) and color of the Text entity.



int VSGRAPHXGetFontName(int vsgraphx, int index, LPTSTR lpFontName, DWORD nSize)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the Text entity in the drawing.
  nSize: Specifies the length of the lpFontName buffer. If the length of the font name exceeds this limit, the string is truncated.
output:    
  lpFontName: A buffer that receives the font name string.
returns:  
 
The length of the string copied to the buffer. If the lpFontName argument is NULL, it returns the actual length of the font name string. In case of failure returns VSGRAPHX_ERROR.



int VSGRAPHXGetText(int vsgraphx, int index, LPTSTR lpText, DWORD nSize)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the Text entity in the drawing.
  nSize: Specifies the length of the lpText buffer. If the length of the font name exceeds this limit, the string is truncated.
output:    
  lpText: A buffer that receives the text string.
returns:  
  The length of the string copied to the buffer. If the lpText argument is NULL, it returns the actual length of the Text entity's string. In case of failure returns VSGRAPHX_ERROR.



HBITMAP VSGRAPHXGetBitmap(int vsgraphx, int index)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  index: The index of the Bitmap entity in the drawing.
returns:  
  The HBITMAP of the Bitmap entity, or NULL in case of failure.
remarks:  
  Do not destroy the returned HBITMAP. It will be destroyed by VSGRAPHXClose().



BOOL VSGRAPHXBeginPolyBezierPath(int vsgraphx, double pnWidth, UINT pnStyle, COLORREF pnColor,
                                                                       UINT brStyle, COLORREF brColor, LONG hatch)


input:    
  vsgraphx: The vsgraphx handle to the drawing.
  pnWidth: The pen width (in drawing's units) of the PolyBezierPath entity.
  pnStyle: The pen style of the PolyBezierPath entity.
  pnColor: The pen color of the PolyBezierPath entity.
  brStyle: The brush style of the PolyBezierPath entity.
  brColor: The brush color of the PolyBezierPath entity.
  hatch: The hatch style of the PolyBezierPath entity.
returns:  
  TRUE if vsgraphx is valid. FALSE otherwise.
remarks:  
 
Begins the creation of a PolyBezierPath entity and sets the info about the pen and brush that are used for drawing this entity. The PolyBezierPath entity must be filled with Bezier path triplets using the VSGRAPHXAddBezierPathTriplet() function. Multiple Bezier paths can be added to the entity using the VSGRAPHXAddBezierPath() function.



BOOL VSGRAPHXAddBezierPathTriplet(int vsgraphx,
                                                                       double preDirPoX, double preDirPoY,
                                                                       double anchPoX, double anchPoY,
                                                                       double postDirPoX, double postDirPoY)


input:    
  vsgraphx: The vsgraphx handle to the drawing.
  preDirPoX: The x coordinate (in drawing's units) of the triplet's pre-direction point.
  preDirPoY: The y coordinate (in drawing's units) of the triplet's pre-direction point.
  anchPoX: The x coordinate (in drawing's units) of the triplet's anchor point.
  anchPoY: The y coordinate (in drawing's units) of the triplet's anchor point.
  postDirPoX: The x coordinate (in drawing's units) of the triplet's post-direction point.
  postDirPoY: The y coordinate (in drawing's units) of the triplet's post-direction point.
returns:  
  TRUE if vsgraphx is valid and VSGRAPHXBeginPolyBezierPath() has been called. FALSE otherwise.
remarks:  
  Adds a Bezier path triplet to the current Bezier path of the PolyBezierPath entity under creation.



BOOL VSGRAPHXAddBezierPath(int vsgraphx)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
returns:  
  TRUE if vsgraphx is valid and VSGRAPHXBeginPolyBezierPath() has been called and the current Bezier path of the PolyBezierPath entity is not empty. FALSE otherwise.
remarks:  
  Adds another Bezier path to the PolyBezierPath entity under creation. It is needed only for PolyBezierPath entities that contain more than one Bezier paths.



BOOL VSGRAPHXAddPolyBezierPath(int vsgraphx)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
returns:  
  TRUE if vsgraphx is valid and a PolyBezierPath entity has been created using the VSGRAPHXBeginPolyBezierPath() and VSGRAPHXAddBezierPathTriplet() functions. FALSE otherwise.
remarks:  
 
Adds a PolyBezier path to the end of a drawing. The PolyBezier path must have been created using the VSGRAPHXBeginPolyBezierPath() and VSGRAPHXAddBezierPathTriplet() functions. For PolyBezierPath entities that have more than one Bezier paths, VSGRAPHXAddBezierPath() must also have been used.



BOOL VSGRAPHXAddText(int vsgraphx, LPCTSTR text, LPCTSTR fontName, double poX, double poY,
                                                  BYTE style, double height, double angle, COLORREF color)


input:    
  vsgraphx: The vsgraphx handle to the drawing.
  text: The text string of the Text entity.
  fontName: The font name string of the Text entity.
  poX: The x coordinate (in drawing's units) of the Text entity's top left point.
  poY: The y coordinate (in drawing's units) of the Text entity's top left point.
  style:
The style of the Text entity.. The text style can be a combination of the following: VSGRAPHX_TEXT_STYLE_NORMAL, VSGRAPHX_TEXT_STYLE_ITALIC, VSGRAPHX_TEXT_STYLE_BOLD, VSGRAPHX_TEXT_STYLE_UNDERLINE.
  height: The height (in drawing's units) of the Text entity.
  angle: The angle (in degrees) of the Text entity.
  color: The color of the Text entity.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Adds a Text entity to the end of a drawing.



BOOL VSGRAPHXAddBitmap(int vsgraphx, HBITMAP hBmp,
                                                      double left, double top, double right, double bottom)


input:    
  vsgraphx: The vsgraphx handle to the drawing.
  hBmp: The HBITMAP of the Bitmap entity. This HBITMAP will be deleted by VSGRAPHXClose().
  left: The left position (in drawing's units) of the bitmap entity.
  top: The top position (in drawing's units) of the bitmap entity.
  right: The right position (in drawing's units) of the bitmap entity.
  bottom: The bottom position (in drawing's units) of the bitmap entity.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Adds a Bitmap entity to the end of a drawing.



int VSGRAPHXGetUnits(int vsgraphx)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
returns:  
  The units that are used in the drawing. Possible values are VSGRAPHX_UNITS_PX, VSGRAPHX_UNITS_MM10, VSGRAPHX_UNITS_MM, VSGRAPHX_UNITS_CM, VSGRAPHX_UNITS_IN and VSGRAPHX_ERROR in case of failure. The default units in a drawing are tenths of millimeters (VSGRAPHX_UNITS_MM10).



void VSGRAPHXSetUnits(int vsgraphx, int units)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  units:
The units to be used in the drawing. Possible values are VSGRAPHX_UNITS_PX, VSGRAPHX_UNITS_MM10,VSGRAPHX_UNITS_MM,VSGRAPHX_UNITS_CM, VSGRAPHX_UNITS_IN.
remarks:  
  Sets the units to be used in a drawing. The default units in a drawing are tenths of millimeters (VSGRAPHX_UNITS_MM10).



HBITMAP VSGRAPHXCreateIcon(int vsgraphx, int width, int height, int first, int last)

input:    
  vsgraphx: The vsgraphx handle to the drawing.
  width: The width of the icon.
  height: The height of the icon.
  first: The index of the first graphics entity to be drawn to the icon.
  last: The index of the last graphics entity to be drawn to the icon.
returns:  
  The HBITMAP of the icon, or NULL in case of failure.
remarks:  
  Creates an icon containing some graphics entities of a drawing. The returned HBITMAP must be deleted when it is no longer needed.



HBITMAP VSGRAPHXCreateBitmap24(HBITMAP hBmp)

input:    
  hBmp: The HBITMAP to be copied.
returns:  
  A new 24-bit device independent HBITMAP with the image of the argument HBITMAP. The returned HBITMAP must be deleted when it is no longer needed.


 

 

 

 


VSGraphXDLL API Class Wrapper for C++

The CVSGraphX class is a wrapper class for the C VSGraphX DLL API. It offers to C++ programmers a more efficient way to use VSGraphX DLL.

Methods:

Open vector drawing files
Open  
 
Save vector drawing files
Save  
 
Display vector drawings
Draw DrawArea
 
Create vector drawings
Create  
 
Close vector drawings
Close  
 
Get information for vector drawings and their graphics entities
GetBounds GetEntityWidth
GetLeft GetEntityHeight
GetTop GetNumOfEntities
GetRight GetEntityType
GetBottom GetPolyBezierPathInfo
GetWidth GetPolyBezierPathSize
GetHeight GetBezierPathSize
GetEntityBounds GetBezierPathTriplet
GetEntityLeft GetTextInfo
GetEntityTop GetFontName
GetEntityRight GetText
GetEntityBottom GetBitmap
 
Add graphics entities to vector drawings
BeginPolyBezierPath AddPolyBezierPath
AddBezierPathTriplet AddText
AddBezierPath AddBitmap
 
Units handling
GetUnits SetUnits
 
Other
CreateIcon CreateBitmap24

 

 


BOOL Open(LPCTSTR filepath, FileType type = ANY)

input:    
  filepath: The filepath of the drawing file to be opened.
  type: The type of the drawing file (ANY, AI, DXF, EMF, WMF, PLT). If it is ANY, the type is obtained from the file extension, otherwise the file extension is ignored.
returns:  
  TRUE if the drawing file is sucsessfully opened, FALSE otherwise.
remarks:  
  Opens a drawing file.



BOOL Save(LPCTSTR filepath, FileType type = ANY)

input:    
  filepath: The filepath of the drawing file to be saved.
  type: The type of the drawing file (ANY, AI, DXF, EMF, WMF, PLT). If it is ANY, the type is obtained from the file extension, otherwise the file extension is ignored.
returns:  
  TRUE if the drawing file is successfully saved, FALSE otherwise.
remarks:  
  Saves a drawing file.



void Draw(HDC hDC, LPCRECT drawRect)

input:    
  hDC: The HDC that will be used.
  drawRect: The rectangle (in hDC logical units) where the drawing will fit.
remarks:  
  Draws a drawing to the argument HDC, and fits it into the rectangle specified by the drawRect argument.
 


void DrawArea(HDC hDC, LPCRECT drawRect, LPCRECT areaRect)
void DrawArea(HDC hDC, LPCRECT drawRect,
                           double areaLeft, double areaTop, double areaRight, double areaBottom)

input:    
  hDC: The HDC that will be used to draw the drawing's graphics entities.
  drawRect: The rectangle (in hDC logical units) where the drawing's area will fit.
  areaRect: The rectangle (in drawing's units) of the drawing's area.
  areaLeft: The left position (in drawing's units) of the drawing's area.
  areaTop: The top position (in drawing's units) of the drawing's area.
  areaRight: The right position (in drawing's units) of the drawing's area.
  areaBottom: The bottom position (in drawing's units) of the drawing's area.
remarks:  
  Draws a rectangle area of a drawing to the argument HDC, and fits this area into the rectangle specified by the drawRect argument.
 


BOOL Create()

returns:  
  TRUE if the new drawing is sucsessfully created.
remarks:  
  Creates a new drawing.



void Close()

remarks:  
 

Closes the vsgraphx handle to a drawing and releases all associated resources. It is automatically called in an object's destruction.




BOOL GetBounds(double *left, double *top, double *right, double *bottom)

output:    
  left: The left position of the drawing (in drawing's units).
  top: The top position of the drawing (in drawing's units).
  right: The right position of the drawing (in drawing's units).
  bottom: The bottom position of the drawing (in drawing's units).
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Gets the boundaries of a drawing (in drawing's units).



double GetLeft()

returns:  
  The left position of the drawing (in drawing's units).



double GetTop()

returns:  
  The top position of the drawing (in drawing's units).



double GetRight()

returns:  
  The right position of the drawing (in drawing's units).



double GetBottom()

returns:  
  The bottom position of the drawing (in drawing's units).



double GetWidth()

returns:  
  The width of the drawing (in drawing's units).



double GetHeight()

returns:  
  The height of the drawing (in drawing's units).



BOOL GetEntityBounds(int index, double *left, double *top, double *right, double *bottom)

input:    
  index: The index of the graphics entity in the drawing.
output:    
  left: The left position of the graphics entity (in drawing's units).
  top: The top position of the graphics entity (in drawing's units).
  right: The right position of the graphics entity (in drawing's units).
  bottom: The bottom position of the graphics entity (in drawing's units).
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Gets the boundaries of a graphics entity (in drawing's units).



double GetEntityLeft(int index)

input:    
  index: The index of the graphics entity in the drawing.
returns:  
  The left position of the graphics entity (in drawing's units).



double GetEntityTop(int index)

input:    
  index: The index of the graphics entity in the drawing.
returns:  
  The top position of the graphics entity (in drawing's units).



double GetEntityRight(int index)

input:    
  index: The index of the graphics entity in the drawing.
returns:  
  The right position of the graphics entity (in drawing's units).



double GetEntityBottom(int index)

input:    
  index: The index of the graphics entity in the drawing.
returns:  
  The bottom position of the graphics entity (in drawing's units).



double GetEntityWidth(int index)

input:    
  index: The index of the graphics entity in the drawing.
returns:  
  The width of the graphics entity (in drawing's units).



double GetEntityHeight(int index)

input:    
  index: The index of the graphics entity in the drawing.
returns:  
  The height of the graphics entity (in drawing's units).



int GetNumOfEntities()

returns:  
  The number of graphics entities in the drawing.



int GetEntityType(int index)

input:    
  index: The index of the graphics entity in the drawing.
returns:  
 
The graphics entity's type. It can be one of the following: VSGRAPHX_ENTITY_POLYBEZIER, VSGRAPHX_ENTITY_TEXT, VSGRAPHX_ENTITY_BITMAP. In case of failure returns VSGRAPHX_ERROR.



BOOL GetPolyBezierPathInfo(int index, double *pnWidth, UINT *pnStyle, COLORREF *pnColor,
                                                    UINT *brStyle, COLORREF *brColor, LONG *hatch)


input:    
  index: The index of the PolyBezierPath entity in the drawing.
output:    
  pnWidth: The pen width (in drawing's units) of the PolyBezierPath entity.
  pnStyle: The pen style of the PolyBezierPath entity.
  pnColor: The pen color of the PolyBezierPath entity.
  brStyle: The brush style of the PolyBezierPath entity.
  brColor: The brush color of the PolyBezierPath entity.
  hatch: The hatch style of the PolyBezierPath entity.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Gets the info about the pen and brush that are used for drawing a PolyBezierPath entity.



int GetPolyBezierPathSize(int index)

input:    
  index: The index of the PolyBezierPath entity in the drawing.
returns:  
  The number of Bezier paths that a PolyBezier path has.



int GetBezierPathSize(int index, int path)

input:    
  index: The index of the PolyBezierPath entity in the drawing.
  path: The index of the Bezier path in the PolyBezierPath entity.
returns:  
  The number of triplets that a Bezier path has.



BOOL GetBezierPathTriplet(int index, int path, int trIndex,
                                                 double *preDirPoX, double *preDirPoY,
                                                 double *anchPoX, double *anchPoY,
                                                 double *postDirPoX, double *postDirPoY)


input:    
  index: The index of the PolyBezierPath entity in the drawing.
  path: The index of the Bezier path in the PolyBezierPath entity.
  trIndex: The index of the triplet in the Bezier path.
output:    
  preDirPoX: The x coordinate (in drawing's units) of the triplet's pre-direction point.
  preDirPoY: The y coordinate (in drawing's units) of the triplet's pre-direction point.
  anchPoX: The x coordinate (in drawing's units) of the triplet's anchor point.
  anchPoY: The y coordinate (in drawing's units) of the triplet's anchor point.
  postDirPoX: The x coordinate (in drawing's units) of the triplet's post-direction point.
  postDirPoY: The y coordinate (in drawing's units) of the triplet's post-direction point.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Gets the coordinates (in drawing's units) of a Bezier path triplet.



BOOL GetTextInfo(int index, double *poX, double *poY, BYTE *style,
                                  double *height, double *angle, COLORREF *color)


input:    
  index: The index of the Text entity in the drawing.
output:    
  poX: The x coordinate (in drawing's units) of the Text entity's top left point.
  poY: The y coordinate (in drawing's units) of the Text entity's top left point.
  style: The style of the Text entity. The text style can be a combination of the following: VSGRAPHX_TEXT_STYLE_NORMAL, VSGRAPHX_TEXT_STYLE_ITALIC, VSGRAPHX_TEXT_STYLE_BOLD, VSGRAPHX_TEXT_STYLE_UNDERLINE.
  height: The height (in drawing's units) of the Text entity.
  angle: The angle (in degrees) of the Text entity.
  color: The color of the Text entity.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Gets the coordinates (in drawing's units) of a Text entity's top left point, as well as the style, height (in drawing's units), angle (in degrees) and color of the Text entity.



int GetFontName(int index, LPTSTR lpFontName, DWORD nSize)

input:    
  index: The index of the Text entity in the drawing.
  nSize: Specifies the length of the lpFontName buffer. If the length of the font name exceeds this limit, the string is truncated.
output:    
  lpFontName: A buffer that receives the font name string.
returns:  
 
The length of the string copied to the buffer. If the lpFontName argument is NULL, it returns the actual length of the font name string. In case of failure returns VSGRAPHX_ERROR.



int GetText(int index, LPTSTR lpText, DWORD nSize)

input:    
  index: The index of the Text entity in the drawing.
  nSize: Specifies the length of the lpText buffer. If the length of the font name exceeds this limit, the string is truncated.
output:    
  lpText: A buffer that receives the text string.
returns:  
  The length of the string copied to the buffer. If the lpText argument is NULL, it returns the actual length of the Text entity's string. In case of failure returns VSGRAPHX_ERROR.



HBITMAP GetBitmap(int index)

input:    
  index: The index of the Bitmap entity in the drawing.
returns:  
  The HBITMAP of the Bitmap entity, or NULL in case of failure.
remarks:  
  Do not destroy the returned HBITMAP. It will be destroyed by Close().



BOOL BeginPolyBezierPath(double pnWidth, UINT pnStyle, COLORREF pnColor,
                                                 UINT brStyle, COLORREF brColor, LONG hatch)


input:    
  pnWidth: The pen width (in drawing's units) of the PolyBezierPath entity.
  pnStyle: The pen style of the PolyBezierPath entity.
  pnColor: The pen color of the PolyBezierPath entity.
  brStyle: The brush style of the PolyBezierPath entity.
  brColor: The brush color of the PolyBezierPath entity.
  hatch: The hatch style of the PolyBezierPath entity.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
 
Begins the creation of a PolyBezierPath entity and sets the info about the pen and brush that are used for drawing this entity. The PolyBezierPath entity must be filled with Bezier path triplets using the AddBezierPathTriplet() method. Multiple Bezier paths can be added to the entity using the AddBezierPath() method.



BOOL AddBezierPathTriplet(double preDirPoX, double preDirPoY,
                                                  double anchPoX, double anchPoY,
                                                  double postDirPoX, double postDirPoY)


input:    
  preDirPoX: The x coordinate (in drawing's units) of the triplet's pre-direction point.
  preDirPoY: The y coordinate (in drawing's units) of the triplet's pre-direction point.
  anchPoX: The x coordinate (in drawing's units) of the triplet's anchor point.
  anchPoY: The y coordinate (in drawing's units) of the triplet's anchor point.
  postDirPoX: The x coordinate (in drawing's units) of the triplet's post-direction point.
  postDirPoY: The y coordinate (in drawing's units) of the triplet's post-direction point.
returns:  
  TRUE if BeginPolyBezierPath() has been called. FALSE otherwise.
remarks:  
  Adds a Bezier path triplet to the current Bezier path of the PolyBezierPath entity under creation.



BOOL AddBezierPath()

returns:  
  TRUE if BeginPolyBezierPath() has been called and the current Bezier path of the PolyBezierPath entity is not empty. FALSE otherwise.
remarks:  
  Adds another Bezier path to the PolyBezierPath entity under creation. It is needed only for PolyBezierPath entities that contain more than one Bezier paths.



BOOL AddPolyBezierPath()

returns:  
  TRUE if a PolyBezierPath entity has been created using the BeginPolyBezierPath() and AddBezierPathTriplet() methods. FALSE otherwise.
remarks:  
 
Adds a PolyBezier path to the end of a drawing. The PolyBezier path must have been created using the BeginPolyBezierPath() and AddBezierPathTriplet() methods. For PolyBezierPath entities that have more than one Bezier paths, AddBezierPath() must also have been used.



BOOL AddText(LPCTSTR text, LPCTSTR fontName, double poX, double poY,
                            BYTE style, double height, double angle, COLORREF color)


input:    
  text: The text string of the Text entity.
  fontName: The font name string of the Text entity.
  poX: The x coordinate (in drawing's units) of the Text entity's top left point.
  poY: The y coordinate (in drawing's units) of the Text entity's top left point.
  style: The style of the Text entity.. The text style can be a combination of the following: VSGRAPHX_TEXT_STYLE_NORMAL, VSGRAPHX_TEXT_STYLE_ITALIC, VSGRAPHX_TEXT_STYLE_BOLD, VSGRAPHX_TEXT_STYLE_UNDERLINE.
  height: The height (in drawing's units) of the Text entity.
  angle: The angle (in degrees) of the Text entity.
  color: The color of the Text entity.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Adds a Text entity to the end of a drawing.



BOOL AddBitmap(HBITMAP hBmp, double left, double top, double right, double bottom)

input:    
  hBmp: The HBITMAP of the Bitmap entity. This HBITMAP will be deleted by Close().
  left: The left position (in drawing's units) of the Bitmap entity.
  top: The top position (in drawing's units) of the Bitmap entity.
  right: The right position (in drawing's units) of the Bitmap entity.
  bottom: The bottom position (in drawing's units) of the Bitmap entity.
returns:  
  TRUE for success, FALSE for failure.
remarks:  
  Adds a Bitmap entity to the end of a drawing.



int GetUnits()

returns:  
  The units that are used in the drawing. Possible values are VSGRAPHX_UNITS_PX, VSGRAPHX_UNITS_MM10, VSGRAPHX_UNITS_MM, VSGRAPHX_UNITS_CM, VSGRAPHX_UNITS_IN and VSGRAPHX_ERROR in case of failure. The default units in a drawing are tenths of millimeters (VSGRAPHX_UNITS_MM10).



void SetUnits(int units)

input:    
  units: The units to be used in the drawing. Possible values are VSGRAPHX_UNITS_PX, VSGRAPHX_UNITS_MM10,VSGRAPHX_UNITS_MM,VSGRAPHX_UNITS_CM, VSGRAPHX_UNITS_IN.
remarks:  
  Sets the units to be used in a drawing. The default units in a drawing are tenths of millimeters (VSGRAPHX_UNITS_MM10).



HBITMAP CreateIcon(int width, int height, int first, int last)

input:    
  width: The width of the icon.
  height: The height of the icon.
  first: The index of the first graphics entity to be drawn to the icon.
  last: The index of the last graphics entity to be drawn to the icon.
returns:  
  The HBITMAP of the icon, or NULL in case of failure.
remarks:  
  Creates an icon containing some graphics entities of a drawing. The returned HBITMAP must be deleted when it is no longer needed.



HBITMAP CreateBitmap24(HBITMAP hBmp)

input:    
  hBmp: The HBITMAP to be copied.
returns:  
  A new 24-bit device independent HBITMAP with the image of the argument HBITMAP. The returned HBITMAP must be deleted when it is no longer needed.


 

 

 

 

info: info@vectorsoft.gr


Overview               VSGraphX DLL C / C++ API               VSGraphX DLL API Class Wrapper for C++

Vectorsoft VSGraphX DLL ©2002-2005 Vectorsoft - www.vectorsoft.gr. All rights reserved