/// <summary> /// /// </summary> /// <param name="doc"></param> /// <param name="bezier"></param> /// <param name="dx"></param> /// <param name="dy"></param> /// <param name="db"></param> /// <param name="r"></param> public void Draw(object doc, Core2D.XBezier bezier, double dx, double dy, ImmutableArray <Core2D.ShapeProperty> db, Core2D.Record r) { if (!bezier.IsStroked && !bezier.IsFilled) { return; } var _doc = doc as DxfDocument; var style = bezier.Style; var dxfSpline = CreateCubicSpline( bezier.Point1.X + dx, bezier.Point1.Y + dy, bezier.Point2.X + dx, bezier.Point2.Y + dy, bezier.Point3.X + dx, bezier.Point3.Y + dy, bezier.Point4.X + dx, bezier.Point4.Y + dy); if (bezier.IsFilled) { var fill = GetColor(style.Fill); var fillTransparency = GetTransparency(style.Fill); var bounds = new List <HatchBoundaryPath> { new HatchBoundaryPath( new List <EntityObject> { (Spline)dxfSpline.Clone() }) }; var hatch = new Hatch(HatchPattern.Solid, bounds, false); hatch.Layer = _currentLayer; hatch.Color = fill; hatch.Transparency.Value = fillTransparency; _doc.AddEntity(hatch); } if (bezier.IsStroked) { var stroke = GetColor(style.Stroke); var strokeTansparency = GetTransparency(style.Stroke); var lineweight = ThicknessToLineweight(style.Thickness); dxfSpline.Layer = _currentLayer; dxfSpline.Color = stroke; dxfSpline.Transparency.Value = strokeTansparency; dxfSpline.Lineweight.Value = lineweight; _doc.AddEntity(dxfSpline); } }
/// <summary> /// /// </summary> /// <param name="gfx"></param> /// <param name="bezier"></param> /// <param name="dx"></param> /// <param name="dy"></param> /// <param name="db"></param> /// <param name="r"></param> public void Draw(object gfx, Core2D.XBezier bezier, double dx, double dy, ImmutableArray <Core2D.ShapeProperty> db, Core2D.Record r) { var _gfx = gfx as XGraphics; if (bezier.IsFilled) { var path = new XGraphicsPath(); path.AddBezier( _scaleToPage(bezier.Point1.X + dx), _scaleToPage(bezier.Point1.Y + dy), _scaleToPage(bezier.Point2.X + dx), _scaleToPage(bezier.Point2.Y + dy), _scaleToPage(bezier.Point3.X + dx), _scaleToPage(bezier.Point3.Y + dy), _scaleToPage(bezier.Point4.X + dx), _scaleToPage(bezier.Point4.Y + dy)); if (bezier.IsStroked) { _gfx.DrawPath( ToXPen(bezier.Style, _scaleToPage), ToXSolidBrush(bezier.Style.Fill), path); } else { _gfx.DrawPath( ToXSolidBrush(bezier.Style.Fill), path); } } else { if (bezier.IsStroked) { _gfx.DrawBezier( ToXPen(bezier.Style, _scaleToPage), _scaleToPage(bezier.Point1.X + dx), _scaleToPage(bezier.Point1.Y + dy), _scaleToPage(bezier.Point2.X + dx), _scaleToPage(bezier.Point2.Y + dy), _scaleToPage(bezier.Point3.X + dx), _scaleToPage(bezier.Point3.Y + dy), _scaleToPage(bezier.Point4.X + dx), _scaleToPage(bezier.Point4.Y + dy)); } } }