2018-01-10 19:49:32 +00:00
|
|
|
|
namespace UglyToad.PdfPig.Graphics.Operations.PathConstruction
|
2017-11-22 18:41:34 +00:00
|
|
|
|
{
|
2018-12-02 16:14:55 +00:00
|
|
|
|
using System.IO;
|
2017-11-30 23:47:24 +00:00
|
|
|
|
using Content;
|
2017-11-22 18:41:34 +00:00
|
|
|
|
using Geometry;
|
|
|
|
|
|
|
|
|
|
internal class AppendStraightLineSegment : IGraphicsStateOperation
|
|
|
|
|
{
|
|
|
|
|
public const string Symbol = "l";
|
|
|
|
|
|
|
|
|
|
public string Operator => Symbol;
|
|
|
|
|
|
|
|
|
|
public PdfPoint End { get; }
|
|
|
|
|
|
|
|
|
|
public AppendStraightLineSegment(decimal x, decimal y)
|
|
|
|
|
{
|
|
|
|
|
End = new PdfPoint(x, y);
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-30 23:47:24 +00:00
|
|
|
|
public void Run(IOperationContext operationContext, IResourceStore resourceStore)
|
|
|
|
|
{
|
2018-12-12 00:09:15 +00:00
|
|
|
|
operationContext.CurrentPath.LineTo(End.X, End.Y);
|
|
|
|
|
operationContext.CurrentPosition = End;
|
2017-11-30 23:47:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-12-02 16:14:55 +00:00
|
|
|
|
public void Write(Stream stream)
|
|
|
|
|
{
|
2018-12-12 00:09:15 +00:00
|
|
|
|
stream.WriteDecimal(End.X);
|
|
|
|
|
stream.WriteWhiteSpace();
|
|
|
|
|
stream.WriteDecimal(End.Y);
|
|
|
|
|
stream.WriteWhiteSpace();
|
|
|
|
|
stream.WriteText(Symbol);
|
|
|
|
|
stream.WriteWhiteSpace();
|
2018-12-02 16:14:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-22 18:41:34 +00:00
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return $"{End.X} {End.Y} {Symbol}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|