mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-14 02:44:58 +08:00
#26 make almost all operators public
This commit is contained in:
@@ -1,28 +1,45 @@
|
||||
namespace UglyToad.PdfPig.Graphics.Operations.PathConstruction
|
||||
{
|
||||
using System.IO;
|
||||
using Content;
|
||||
using Geometry;
|
||||
|
||||
internal class AppendStraightLineSegment : IGraphicsStateOperation
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Append a straight line segment from the current point to the point (x, y).
|
||||
/// </summary>
|
||||
public class AppendStraightLineSegment : IGraphicsStateOperation
|
||||
{
|
||||
/// <summary>
|
||||
/// The symbol for this operation in a stream.
|
||||
/// </summary>
|
||||
public const string Symbol = "l";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Operator => Symbol;
|
||||
|
||||
/// <summary>
|
||||
/// The end point of the line.
|
||||
/// </summary>
|
||||
public PdfPoint End { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="AppendStraightLineSegment"/>.
|
||||
/// </summary>
|
||||
/// <param name="x">The x coordinate of the line's end point.</param>
|
||||
/// <param name="y">The y coordinate of the line's end point.</param>
|
||||
public AppendStraightLineSegment(decimal x, decimal y)
|
||||
{
|
||||
End = new PdfPoint(x, y);
|
||||
}
|
||||
|
||||
public void Run(IOperationContext operationContext, IResourceStore resourceStore)
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.CurrentPath.LineTo(End.X, End.Y);
|
||||
operationContext.CurrentPosition = End;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Write(Stream stream)
|
||||
{
|
||||
stream.WriteDecimal(End.X);
|
||||
@@ -33,6 +50,7 @@
|
||||
stream.WriteWhiteSpace();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{End.X} {End.Y} {Symbol}";
|
||||
|
Reference in New Issue
Block a user