namespace UglyToad.PdfPig.Graphics.Operations.PathConstruction { using System.IO; using Geometry; /// /// /// Append a straight line segment from the current point to the point (x, y). /// public class AppendStraightLineSegment : IGraphicsStateOperation { /// /// The symbol for this operation in a stream. /// public const string Symbol = "l"; /// public string Operator => Symbol; /// /// The end point of the line. /// public PdfPoint End { get; } /// /// Create a new . /// /// The x coordinate of the line's end point. /// The y coordinate of the line's end point. public AppendStraightLineSegment(decimal x, decimal y) { End = new PdfPoint(x, y); } /// public void Run(IOperationContext operationContext) { operationContext.CurrentPath.LineTo(End.X, End.Y); operationContext.CurrentPosition = End; } /// public void Write(Stream stream) { stream.WriteDecimal(End.X); stream.WriteWhiteSpace(); stream.WriteDecimal(End.Y); stream.WriteWhiteSpace(); stream.WriteText(Symbol); stream.WriteWhiteSpace(); } /// public override string ToString() { return $"{End.X} {End.Y} {Symbol}"; } } }