Свойство | Тип | Описание | |
---|---|---|---|
alphamax | double | ||
curveoptimizing | bool | ||
opttolerance | double | ||
turdsize | int |
Метод | Описание | |
---|---|---|
BinaryToBitmap ( bool Matrix, bool IgnoreBorder ) : |
Makes a Black and White Bitmap from the Data of a Binarymatrix. Value with 'true' returns a white Pixel such with 'false' a Black pixel.
|
|
BitMapToBinary ( |
Produces a binary Matrix with Dimensions b.Width+2 and b.Height +2, where the Border ( of width) in the Matrix is filled with 'true' -values. On this way we avoid a lot of boundsinequalities. For the threshold, we take the Maximum of (R,G,B ) of a Pixel at x,y. If this is less then the threshold the resultMatrix at x+1, y+1 is filled with false else with true.
|
|
potrace_trace ( bool bm, |
It is the main function, which yields the curveinformations related to a given binary bitmap. It fills the ArrayList ListOfCurveArrays with curvepathes. Each of this pathes is an list of connecting curves. Example: Call first: ArrayList ListOfCurveArrays = new ArrayList(); potrace_trace(bm, ListOfCurveArrays); Paint the result: GraphicsPath gp = new GraphicsPath(); for (int i = 0; i < ListOfCurveArrays.Count; i++) { ArrayList CurveArray = (ArrayList)ListOfCurveArrays[i]; GraphicsPath Contour=null; GraphicsPath Hole = null; GraphicsPath Current=null; for (int j = 0; j < CurveArray.Count; j++) { if (j == 0) { Contour = new GraphicsPath(); Current = Contour; } else { Hole = new GraphicsPath(); Current = Hole; } Potrace.Curve[] Curves = (Curve[])CurveArray[j]; for (int k = 0; k < Curves.Length; k++) { if (Curves[k].Kind == Potrace.CurveKind.Bezier) Current.AddBezier((float)Curves[k].A.x, (float)Curves[k].A.y, (float)Curves[k].ControlPointA.x, (float)Curves[k].ControlPoint.y, (float)Curves[k].ControlPointB.x, (float)Curves[k].ControlPointB.y, (float)Curves[k].B.x, (float)Curves[k].B.y); else Current.AddLine((float)Curves[k].A.x, (float)Curves[k].A.y, (float)Curves[k].B.x, (float)Curves[k].B.y); } if (j > 0) Contour.AddPath(Hole, false); } gp.AddPath(Contour, false); } // any Graphic g Graphics g = CreateGraphics(); // Paint the fill g.FillPath(Brushes.Black, gp); // Paint the border g.DrawPath(Pens.Red,gp);
|
Метод | Описание | |
---|---|---|
AddCurve ( |
||
FindNext ( bool Matrix, int &x, int &y ) : bool |
Searches a x and a y such that source[x,y] = true and source[x+1,y] false. If this not exists, false will be returned else the result is true.
|
|
FindNext ( bool Matrix, int &x, int &y, |
Searches a x and a y inside the Path P such that source[x,y] = true and source[x+1,y] false. If this not exists, false will be returned else the result is true.
|
|
GetMonotonIntervals ( iPoint Pts ) : |
||
PathList_to_ListOfCurveArrays ( |
||
Xor_Path ( bool Matrix, |
||
abs ( int a ) : int | ||
adjust_vertices ( |
||
bestpolygon ( |
||
bezier ( double t, dPoint p0, dPoint p1, dPoint p2, dPoint p3 ) : dPoint | ||
bm_to_pathlist ( bool bm, |
Decompose the given bitmap into paths. Returns a linked list of Path objects with the fields len, pt, area filled
|
|
calc_lon ( |
||
calc_sums ( |
Preparation: fill in the sum* fields of a path (used for later rapid summing).
|
|
cprod ( dPoint p0, dPoint p1, dPoint p2, dPoint p3 ) : double | ||
cu ( int a ) : int | ||
cyclic ( int a, int b, int c ) : bool | ||
ddenom ( dPoint p0, dPoint p2 ) : double | ||
ddist ( dPoint p, dPoint q ) : double | ||
dorth_infty ( dPoint p0, dPoint p2 ) : iPoint | ||
dpara ( dPoint p0, dPoint p1, dPoint p2 ) : double | ||
findNextTrace ( bool Matrix, int &x, int &y, direction &Dir ) : void | ||
findpath ( bool Matrix, iPoint Start ) : |
Compute a path in the binary matrix. Start path at the point (x0,x1), which must be an upper left corner of the path. Also compute the area enclosed by the path. Return a new path_t object, or NULL on error (note that a legitimate path cannot have length 0). We omit turnpolicies and sign
|
|
floordiv ( int a, int n ) : int | ||
getContur ( bool bm, int x, int y, |
||
i ( ) : void | ||
interval ( double lambda, dPoint a, dPoint b ) : dPoint | ||
iprod ( dPoint p0, dPoint p1, dPoint p2 ) : double | ||
iprod1 ( dPoint p0, dPoint p1, dPoint p2, dPoint p3 ) : double | ||
max ( int a, int b ) : int | ||
min ( int a, int b ) : int | ||
mod ( int a, int n ) : int | ||
opti_penalty ( |
||
opticurve ( |
||
penalty3 ( |
||
pointslope ( |
||
process_path ( |
||
quadform ( double Q, dPoint w ) : double | ||
sign ( double x ) : int | ||
sign ( int x ) : int | ||
smooth ( privcurve curve, int sign, double alphamax ) : void | ||
sq ( int a ) : int | ||
tangent ( dPoint p0, dPoint p1, dPoint p2, dPoint p3, dPoint q0, dPoint q1 ) : double | ||
xprod ( dPoint p1, dPoint p2 ) : double | ||
xprod ( iPoint p1, iPoint p2 ) : int |
public static BinaryToBitmap ( bool Matrix, bool IgnoreBorder ) : |
||
Matrix | bool | A Binary Matrix, which have boolean values |
IgnoreBorder | bool | If this value is set then a Border with 1 Pixel is ignored |
Результат |
public static BitMapToBinary ( |
||
b | A Bitmap, which will be transformed to a binary Matrix | |
_treshold | int | Gives a threshold ( between 1 and 254 ) for Converting |
Результат | ].bool[ |
public static potrace_trace ( bool bm, |
||
bm | bool | A binary bitmap, which holds the pixelinformation about the image. |
ListOfCurveArrays | A list in which the curveinformations will be stored. | |
Результат | void |