public static PDFGraphicsPath Parse(string value) { PDFGraphicsPath path = new PDFGraphicsPath(); if (string.IsNullOrEmpty(value)) { return(path); } PDFSVGPathDataParser parser = new PDFSVGPathDataParser(true, null); parser.ParseSVG(path, value); return(path); }
public void DrawPath(PDFPen pen, PDFPoint location, PDFGraphicsPath path) { if (null == path) { throw new ArgumentNullException("path"); } if (null == pen) { throw new ArgumentNullException("pen"); } this.SaveGraphicsState(); this.OutputPath(null, pen, location, path); this.RestoreGraphicsState(); }
public void FillPath(PDFBrush brush, PDFPoint location, PDFGraphicsPath path) { if (null == path) { throw new ArgumentNullException("path"); } if (null == brush) { throw new ArgumentNullException("brush"); } this.SaveGraphicsState(); this.OutputPath(brush, null, location, path); this.RestoreGraphicsState(); }
private void OutputPath(PDFBrush brush, PDFPen pen, PDFPoint location, PDFGraphicsPath path) { PDFRect bounds = new PDFRect(path.Bounds.X + location.X, path.Bounds.Y + location.Y, path.Bounds.Width, path.Bounds.Height); if (null != brush) { brush.SetUpGraphics(this, bounds); } if (null != pen) { pen.SetUpGraphics(this, bounds); } PDFPoint cursor = PDFPoint.Empty; foreach (Path p in path.SubPaths) { RenderPathData(location, p, ref cursor); } if (null != brush && null != pen) { this.RenderFillAndStrokePathOp(path.Mode == GraphicFillMode.EvenOdd); } else if (null != brush) { this.RenderFillPathOp(path.Mode == GraphicFillMode.EvenOdd); } else if (null != pen) { this.RenderStrokePathOp(); } if (null != brush) { brush.ReleaseGraphics(this, bounds); } if (null != pen) { pen.ReleaseGraphics(this, bounds); } }