/// <summary> /// /// </summary> /// <param name="gfx"></param> /// <param name="path"></param> /// <param name="dx"></param> /// <param name="dy"></param> /// <param name="db"></param> /// <param name="r"></param> public void Draw(object gfx, Core2D.XPath path, double dx, double dy, ImmutableArray <Core2D.ShapeProperty> db, Core2D.Record r) { var _gfx = gfx as XGraphics; var gp = path.Geometry.ToXGraphicsPath(dx, dy, _scaleToPage); if (path.IsFilled && path.IsStroked) { _gfx.DrawPath( ToXPen(path.Style, _scaleToPage), ToXSolidBrush(path.Style.Fill), gp); } else if (path.IsFilled && !path.IsStroked) { _gfx.DrawPath( ToXSolidBrush(path.Style.Fill), gp); } else if (!path.IsFilled && path.IsStroked) { _gfx.DrawPath( ToXPen(path.Style, _scaleToPage), gp); } }
/// <summary> /// /// </summary> /// <param name="doc"></param> /// <param name="path"></param> /// <param name="dx"></param> /// <param name="dy"></param> /// <param name="db"></param> /// <param name="r"></param> public void Draw(object doc, Core2D.XPath path, double dx, double dy, ImmutableArray <Core2D.ShapeProperty> db, Core2D.Record r) { if (!path.IsStroked && !path.IsFilled) { return; } var _doc = doc as DxfDocument; var style = path.Style; ICollection <HatchBoundaryPath> bounds; ICollection <EntityObject> entities; CreateHatchBoundsAndEntitiess(path.Geometry, dx, dy, out bounds, out entities); if (entities == null || bounds == null) { return; } if (path.IsFilled) { var fill = GetColor(style.Fill); var fillTransparency = GetTransparency(style.Fill); var hatch = new Hatch(HatchPattern.Solid, bounds, false); hatch.Layer = _currentLayer; hatch.Color = fill; hatch.Transparency.Value = fillTransparency; _doc.AddEntity(hatch); } if (path.IsStroked) { // TODO: Add support for Closed paths. var stroke = GetColor(style.Stroke); var strokeTansparency = GetTransparency(style.Stroke); var lineweight = ThicknessToLineweight(style.Thickness); foreach (var entity in entities) { entity.Layer = _currentLayer; entity.Color = stroke; entity.Transparency.Value = strokeTansparency; entity.Lineweight.Value = lineweight; _doc.AddEntity(entity); } } }