public void MoveTo(double x, double y) { BeginSubpath(); var point = CurrentTransformationMatrix.Transform(new PdfPoint(x, y)); CurrentPosition = point; CurrentSubpath.MoveTo(point.X, point.Y); }
public void Rectangle(double x, double y, double width, double height) { BeginSubpath(); var lowerLeft = CurrentTransformationMatrix.Transform(new PdfPoint(x, y)); var upperRight = CurrentTransformationMatrix.Transform(new PdfPoint(x + width, y + height)); CurrentSubpath.Rectangle(lowerLeft.X, lowerLeft.Y, upperRight.X - lowerLeft.X, upperRight.Y - lowerLeft.Y); AddCurrentSubpath(); }
public void LineTo(double x, double y) { if (CurrentSubpath == null) { return; } var endPoint = CurrentTransformationMatrix.Transform(new PdfPoint(x, y)); CurrentSubpath.LineTo(endPoint.X, endPoint.Y); CurrentPosition = endPoint; }
public void BezierCurveTo(double x2, double y2, double x3, double y3) { if (CurrentSubpath == null) { return; } var controlPoint2 = CurrentTransformationMatrix.Transform(new PdfPoint(x2, y2)); var end = CurrentTransformationMatrix.Transform(new PdfPoint(x3, y3)); CurrentSubpath.BezierCurveTo(CurrentPosition.X, CurrentPosition.Y, controlPoint2.X, controlPoint2.Y, end.X, end.Y); CurrentPosition = end; }
public void FillPath(FillingRule fillingRule, bool close) { if (CurrentPath == null) { return; } CurrentPath.SetFilled(fillingRule); if (close) { CurrentSubpath?.CloseSubpath(); } ClosePath(); }
public void StrokePath(bool close) { if (CurrentPath == null) { return; } CurrentPath.SetStroked(); if (close) { CurrentSubpath?.CloseSubpath(); } ClosePath(); }
public PdfPoint?CloseSubpath() { if (CurrentSubpath == null) { return(null); } PdfPoint point; if (CurrentSubpath.Commands[0] is Move move) { point = move.Location; } else { throw new ArgumentException("CloseSubpath(): first command not Move."); } CurrentSubpath.CloseSubpath(); AddCurrentSubpath(); return(point); }