Raster to Vector SDK (DLL) version 1.2

Content

Brief

New Features in 1.2

New features in 1.1

 

The detail of functions 

Main function

Converting raster into vector file

Convert color raster image to black/white image

 

Setting parameters about filling patterns

1. Set pattern type

2. Set space of filling lines

Setting parameters about tracing center lines

1. The parameters of connecting adjacent vectors

2. The parameters of deleting fixed-up vectors

 

Setting parameters about calculating width

1.Set width calculating parameter

2.Clear the values of width series
3.Add one value of width series
4.Set the mode of processing more width

5.Set the values of width series into default values

6.Set the units of width series value

 

setting the parameters about adjusting angle

1. Set angle adjusting parameter

2. Clear all the values of angle series

3. Add one value of angle series

4.Set default angle series

5. Set ortho angle series

 

How to purchase the Raster to Vector Converter SDK (DLL)   

 

Brief
-------

Raster to Vector Converter SDK is developed by DWG Tool Software (Freefire studio). It can convert raster image into vector image, and output into dxf or text file. The format of raster image include bmp, jpg, tiff, pcx and tga.

It provides one main function and 15 parameter setting functions to complete the task. Please refer to the VB & VC sample to get the more detail of using method.

New Features in 1.2

1. Can convert color raster image to black/white raster image, and save to bitmap file(*.bmp). You can adjust the threshold before trace it now.

New Features in 1.1

1. Support multi-page raster image file, such as multi-page tiff file. So change the meaning of the value that is returned by function "TraceRasterFile".

2. Can fill pattern when trace outline. Add a extra parameter "Fill" into the function "TraceRasterFile" to support filling pattern. And add two functions to support filling pattern, they are "SetFillType" and "SetFillSpace".

3. Can set the units of width series value. You can call function "SetWidthUnit" to set the units of width series value into inch, cm, mm and pixel.

 

 

The detail of the functions

----------------------------------------------

 

1. Main function, convert raster file into vector file

 

long TraceRasterFile(

    HWND OwnerWindow,      // handle of owner window

    LPCTSTR Source,         // source raster file name

    LPCTSTR Dest,             // vector file name

    long DestType,            // vector file type

    long TraceType,          // tracing method

    long Threshold,          // threshold of 1-bit image

    double Straighten,  // straighten pixels into beelines

    long bRecCircle ,       // recognise the circle and arc

    long  Fill                    // fill pattern if none zero

);

Return Value

 

If the function succeeds, the return value is number of output files.

 

When the raster file have only one page image, such bmp, jpg, and one-page tiff file, the return value is 1. And the output filename is Dest parameter.

But when the raster file have multi-pages image, such as multi-page tiff file, the return value is page number. And the output filename will be changed, eg: if the Dest parameter is demo.dxf, then the output filename will be as follow: demo_0.dxf, demo_1.dxf, demo_2.dxf, and etc.

If the function fails, the return value is less than or equal to zero. If the return value is less than zero, it shows that the function has converted the number of pages successfully.

 

Parameters

OwnerHanlde

indicate the window which will receive the messages sent by DLL,and the messages can be the follow values:

 

#define WM_USER_TRACE_FINISHED (WM_APP+100)

Shows that the converting process is completed,if successfully, the WPARAM parameter is 0,otherwise the WPARAM parameter is none 0

#define WM_USER_TRACE_PROGRESS_BEGIN (WM_APP+101)
Shows begin a progress, and the LPARAM parameter is the LPCTSTR type, shows the progress name

#define WM_USER_TRACE_PROGRESS (WM_APP+102)
Shows the position of current progress, the WPARAM parameter is the current position of current progress, the max value is 100

#define WM_USER_TRACE_PROGRESS_END (WM_APP+103)
Shows the current progress is completed

 

source

Raster image file name, can be the .bmp, .jpeg, .tiff, .pcx, .tga formats raster file.

Dest 

Vector file name, the extension can be .dxf, .txt, .plt, .svg, .eps. But the output file type is decided by the below paramter DestType. 


DestType 

The format of output vector file, can be the follow values:

0-Dxf, 1-text, 2-HP/GL, 3-Svg, 4-EPS


 TraceType 

Trace method: 0 - Trace Outline, 1 - Trace Center line

 Threshold 

the threshold converting into 1-bit image, not greater than 255, If this value is negative, DLL will calculate one good threshold auto.

Straighten 

Straighten indicates when curve is pulled into beeline,the dot in the curve is the maximum distance from the beeline.

RecCircle 

if 0, don't recognise circle or arc, if none 0, recognise the circle and arc.

 

Fill

fill pattern if none zero. It has meaning only when TraceType is 0 - trace outline.

Remarks

The output file formats of .DXF, .SVG, .HP/GL,and .EPS are standard formats, but the text format is defined by us self. The follow is the format of text file:

Format of the text file

One text line is one line, or one circle, or one arc.and their formats are described as follow:

Line format

The format of one line like this:

lX start point, Y start point, X end point, Y end point

The leader character is lower-case letter "l", eg:

l3.0,2.0,10.0,11.0

Shows a line start from (3.0,2.0) to (10.0,11.0)

Circle format

The format of one circle like this:

cX center point,Y center point,Radius

The leader character is lower-case letter "c",eg:

c5.0,6.0,10.0

Show a circle, its center point is (5.0,6.0),and radius is 10.0

Arc format

The format of one arc like this:

aX center point,Y center point,Radius,Start angle,End angle

The leader character is lower-case letter "a", the angle units is radians, and arc must be counter-clockwise,eg:

a5.0,6.0,10.0,0.0,3.14159265

Shows a arc, its center point is (5.0,6.0),radius is 10.0, start angle is 0 degrees, and end angle is 180 degrees(PI radians), and this is a half circle.

And there is a lisp named "LoadText.lsp" in the package, which can read the text file into AutoCAD. Please load the lisp into AutoCAD first and then type the command "RTT" to read the text file.

 

Convert color raster image to black/white image

long ThresholdFun(

  HWND OwnerWindow,  // handle of owner window
  LPCTSTR Source,   // the source color raster image
  LPCTSTR Dest,     // the destination raster image, which is black/white image
  long Threshold    // conversion threshold, the range is from -1 to 255. -1 means auto search threshold.
);

 

Return Value

 

if successfully, the return valuse is 1, the followings are all the return values:

1  success
0  The parameters are error
-1 The source image already is black/white image
-2 There is a error in converting process
-3 It is failure to save result image to bitmap file

Parameters

 

OwnerHanlde

indicate the window which will receive the messages sent by DLL. Please refer to TraceRasterFile for detail.

Source

color raster image file name, can be the .bmp, .jpeg, .tiff, .pcx, .tga formats raster file.

Dest

the destination raster image file name, which is black/white image. The file format is Windows bitmap file(*.bmp).

Threshold    

conversion threshold, the range is from -1 to 255. -1 means auto search threshold.

Remarks

  Convert color raster image to black/white raster image (1-bit image), and save to Windows bitmap file. You may call this function to search the best threshold value.

 

Setting parameters about filling patterns 

The follow functions are used to setting parameters of filling patterns. You can fill the patterns only when the TraceType parameter is 0 (Tracing outline). And you must call these functions to set filling parameters befor call function "TraceRasterFile" if you want to fill patterns.

 

1. Set pattern type

void SetFillType(

  long type    // pattern type

);

 

Parameters

 

type

The type of filling pattern, and it can be he follow values:

0

fill horizontal lines

1

fill vertical lines

2

fill cross line (horizontal and vertical lines)

Remarks

Set filling pattern type.

2. Set space of filling lines

void SetFillSpace(

  double Space    // the space of filling lines

);

 

Parameters

 

Space

The space of filling lines, it must be greater than zero.

 

 

Setting parameters of tracing center lines functions

The follow functions are used to setting parameters of tracing center lines. But these parameters haven't any meanings to tracing outline.

 

1.Set connecting parameter 

 

void SetConnectDistance(

    int Connect,     // If connect adjacent vectors

    int Distance     //  the maximum distance between adjacent vectors

);

 

Parameters

Connect

if Connect is 0, DLl don't connect the adjacent line, if Connect isn't 0, DLl will connect the adjacent line.

Distance

Connection distance is that when connect two beeline segments, the distance is the maximum value from one beeline segment dot to another beeline segment dot.

 

2. Set deleting parameter

 

void SetDeleteLength(

    int Delete,    // if delete the fixed-up vectors

    int Length     // the maximum length of fixed-up vectors

);

 

Parameters

 

Delete

If delete is 0, don't delete any vectors, if delete isn't 0, DLL will delete the lines which length is smaller than the parameter Length

Length

The maximum length of fixed-up vectors.

 

The follow functions set the parameters about calculating the width of vectors.

 

1.Set width calculating parameter

 

void SetCalcWidth(

    int Calc    // If calculating width of vectors

);

Parameters

 

Calc

if Calc is 0, DLL don't calculate the width of vectors, if Calc isn't 0, DLl will calculate the width of vectors.

 

2.Clear the values of width series

void DeleteAllWidthSeries(void);

 

Remarks

Clear all the values of width series.If you don't need any width series, you must call this function. Otherwise, if there are some values which you have added, them will still have effect to the tracing progress.

 

3. Add one value of width series

void AddWidthSeriesValueFun(

    double Width    // the width value that will be added

);

 

Parameters

 

Width

The width value that will be add into current width series.

Remarks

 Call this function continually to add all the values of width series. Before add the first value, you must call the function "DeleteAllWidthSeries"  to clear all the values of width series.

 

The width of vector will be rounded into the width series, For example, the values of width sereies are 0.0, 0.5, 1.0, and 1.5 mm,  if the width of a vector is 0.8mm, according to this width series, the width of this vector will be rounded to 1.0mm, but if the width of this vector is 0.7mm, it will be rounded to 0.5mm.

 

4.Set the mode of processing more width

 

void SetMoreWidthMode(

    int Mode    // the mode of processing more width

);

 

Parameters

 

Mode

The mode of processing more width, see remarks for details.

Remarks

 

Set the method of process the width which is greater than the maximun width in the current width series. It can be the follow values:

 

0 

all the width that is greater than the max width in the width series will be shrink to the max width., eg:
 if the width series is 1mm, 2mm, 3mm, the width of a vector is 5.8mm, it will be shrink into 3mm.

 

1

the width that is greater than the max width will not be changed,, eg:
 if the width series is 1mm, 2mm, 3mm, the width of a line is 5.8mm, it will not be changed, and it still is 5.8mm.


2

the width that is greater than the max width will be rounded into the width by the equal space method, eg:
 if the width series is 1mm, 2mm, 3mm, the width of a line is 5.8mm, it will be rounded into 6mm.


5. Set the values of width series into default values

void SetDefaultWidthSeries(void);

 

Remarks

 set the values of width series into default values, and the default values is: 0.5mm, 1.0mm, 2.0mm, the units is mm, the mode of processing more width is 1, means no changing.

 

 

6.Set the units of width series value

 

void SetWidthUnit(

  long units   //the units of width series value

);

 

Parameter

units

set width units, the default value is 2(mm), it can be the follow values:

0

Set units into inch

1

Set units into cm

2

Set units into mm

3

Set units into pixel

 

The follow functions set the parameters about adjusting the angle of vectors.

 

1. Set angle adjusting parameter

 

void SetAdjustAngle(

    int Adjust

);

 

Parameter
 

Adjust

If adjust is 0, DLL don't adjust the angle of vectors, and if adjust isn't 0, DLL will adjust the angle of vectors.

 

2. Clear all the values of angle series

 

void DeleteAllAngleSeries(void);

 

Remarks


if you clear all the values of angle series, you must add the new values of angle series, or call the functions "SetDefaultAngleSeries" or "SetOrthoAngleSeries" to add predefined values, otherwise, DLL can't adjust the angle, because there is no adjusting basis.



3. Add one value of angle series

int AddAngleSeriesValue(

    double MinAngle,    // minimum angle of angle series, the units is radians

    double MaxAngle,    // maximum angle of angle series, the units is radians

    double MainAngle    // main angle of angle series, the units is radians

);

 

Return Value

 

if successfully, the return valuse is none zero, otherwise is 0.

 

Parameters

 

MinAngle

Min angle of angle series, the units is radians. Please see remarks for details.

MaxAngle

Max angle of angle series, the units is radians. Please see remarks for details.

MainAngle

Main angle of angle series, the units is radians. Please see remarks for details.

Remarks

 

 Call this function continually to add all the values of angle series, before add the first value, you should call the function "DeleteAllAngleSeries".

 

The rule of angle adjusting is : when the angle of vector is greater than the min angle and is smaller than the max angle, it will be adjusted to main angle.eg:

 

if the angle series like this:

 

Main angle(Degrees)

Min angle(Degrees) 

Max angle(Degrees)

0.0

0.0  

1.0

90.0

91.0 

89.0

180.0

179.0

180.0

 

So, if one vector's angle is 89.5 degrees, its angle will be adjusted to 90.0 degrees. If another vector's angle is 88.5 degrees, its angle will not be adjusted, and still maintain 88.5 degrees.

     

Note

 

MinAngle isn't greater than MainAngle, and MaxAngle isn't smaller than MainAngle.

 

All the angle must be greater or equal to 0 degrees(0 radians), and must be smaller or equal to 180 degrees(PI radians).

4.Set default angle series

 

void SetDefaultAngleSeriesFun(void);

 

Remarks

Set the values of angle series into default values, and the default values is:
 

Main angle(degree)

Max angle(degrees)

Min angle(degrees)

 0.0

1.0

0.0

 30.0

31.0

29.0

 45.0

46.0

44.0

 60.0

61.0

59.0

 90.0

91.0

89.0

 120.0

121.0

119.0

 135.0

136.0

134.0

 150.0

151.0

149.0

 180.0

180.0

179.0



5. Set ortho angle series

void SetOrthoAngleSeries(void);

 

Remarks

 

Set the values of angle series into ortho values, and the ortho values is:

 Main angle(degrees)

 Max angle(degrees)

 Min angle(degrees)

 0.0

  1.0

  0.0

 90.0

  91.0

  89.0

 180.0

  180.0

  179.0



How to purchase Raster to Vector Converter SDK (DLL)
----------------------------------------

Recommend you to try out our software before you decide to buy our software. In the demo version, we will add a TraceART icon into the vector file. Of course, it will be deleted in the full version.

 

If you decide to purchase our Raster to Vector converter SDK, you can contact us directly at this e_mail address: sale@dwgtool.com or support@dwgtool.com. And the price is US$800.00.

Raster to Vector Converter SDK Homepage: http:www.dwgtool.com

 

DWG Tool software

2017.05.7