/// <summary> /// draw line /// </summary> /// <param name="x1"></param> /// <param name="y1"></param> /// <param name="x2"></param> /// <param name="y2"></param> /// <param name="color"></param> public override void DrawLine(double x1, double y1, double x2, double y2) { //BitmapExt if (this.RenderQuality == RenderQualtity.Fast) { this._bxt.DrawLine( (int)Math.Round(x1), (int)Math.Round(y1), (int)Math.Round(x2), (int)Math.Round(y2), this.strokeColor.ToARGB() ); return; } //---------------------------------------------------------- //Agg if (_orientation == DrawBoardOrientation.LeftBottom) { //as original _lineGen.Clear(); _lineGen.MoveTo(x1, y1); _lineGen.LineTo(x2, y2); var v1 = GetFreeVxs(); _aggsx.Render(stroke.MakeVxs(_lineGen.Vxs, v1), this.strokeColor); ReleaseVxs(ref v1); } else { //left-top int h = this.Height; _lineGen.Clear(); _lineGen.MoveTo(x1, h - y1); _lineGen.LineTo(x2, h - y2); var v1 = GetFreeVxs(); _aggsx.Render(stroke.MakeVxs(_lineGen.Vxs, v1), this.strokeColor); ReleaseVxs(ref v1); } }
public static void Hermite(this PathWriter pw, double[] xyCoords) { Curve4Points curve4_points = pw._c4_points; pw.MoveTo(xyCoords[0], xyCoords[1]); for (int i = 0; i < xyCoords.Length - (4 * 2);) { Curves.HermiteToBezier( xyCoords[i], xyCoords[i + 1], xyCoords[i + 2], xyCoords[i + 3], xyCoords[i + 4], xyCoords[i + 5], xyCoords[i + 6], xyCoords[i + 7], curve4_points ); pw.Curve4(curve4_points.x1, curve4_points.y1, curve4_points.x2, curve4_points.y2, curve4_points.x3, curve4_points.y3 ); i += 2; } }
public static void CatmulRom(this PathWriter pw, double[] xyCoords) { Curve4Points curve4_points = pw._c4_points; pw.MoveTo(xyCoords[2], xyCoords[3]);//*** for (int i = 0; i < xyCoords.Length - (4 * 2);) { Curves.CatromToBezier( xyCoords[i], xyCoords[i + 1], xyCoords[i + 2], xyCoords[i + 3], xyCoords[i + 4], xyCoords[i + 5], xyCoords[i + 6], xyCoords[i + 7], pw._c4_points ); pw.Curve4(curve4_points.x1, curve4_points.y1, curve4_points.x2, curve4_points.y2, curve4_points.x3, curve4_points.y3 ); i += 2; } }