#26 make all operation classes public and test

This commit is contained in:
Eliot Jones
2019-01-04 18:55:36 +00:00
parent 62dc93919c
commit 2a30631ab7
12 changed files with 77 additions and 12 deletions

View File

@@ -6,7 +6,7 @@
/// <summary>
/// Close, fill, and then stroke the path, using the even-odd rule to determine the region to fill.
/// </summary>
internal class CloseFillPathEvenOddRuleAndStroke : IGraphicsStateOperation
public class CloseFillPathEvenOddRuleAndStroke : IGraphicsStateOperation
{
/// <summary>
/// The symbol for this operation in a stream.

View File

@@ -6,7 +6,7 @@
/// <summary>
/// Close, fill, and then stroke the path, using the nonzero winding number rule to determine the region to fill.
/// </summary>
internal class CloseFillPathNonZeroWindingAndStroke : IGraphicsStateOperation
public class CloseFillPathNonZeroWindingAndStroke : IGraphicsStateOperation
{
/// <summary>
/// The symbol for this operation in a stream.

View File

@@ -6,7 +6,7 @@
/// <summary>
/// Fill and then stroke the path, using the even-odd rule to determine the region to fill.
/// </summary>
internal class FillPathEvenOddRuleAndStroke : IGraphicsStateOperation
public class FillPathEvenOddRuleAndStroke : IGraphicsStateOperation
{
/// <summary>
/// The symbol for this operation in a stream.

View File

@@ -6,7 +6,7 @@
/// <summary>
/// Set the gray level for non-stroking operations.
/// </summary>
internal class SetNonStrokeColorDeviceGray : IGraphicsStateOperation
public class SetNonStrokeColorDeviceGray : IGraphicsStateOperation
{
/// <summary>
/// The symbol for this operation in a stream.

View File

@@ -6,7 +6,7 @@
/// <summary>
/// Set the stroking color space to DeviceCMYK and set the color to use for stroking operations.
/// </summary>
internal class SetStrokeColorDeviceCmyk : IGraphicsStateOperation
public class SetStrokeColorDeviceCmyk : IGraphicsStateOperation
{
/// <summary>
/// The symbol for this operation in a stream.

View File

@@ -6,7 +6,7 @@
/// <summary>
/// Set the gray level for stroking operations.
/// </summary>
internal class SetStrokeColorDeviceGray : IGraphicsStateOperation
public class SetStrokeColorDeviceGray : IGraphicsStateOperation
{
/// <summary>
/// The symbol for this operation in a stream.

View File

@@ -13,7 +13,7 @@
/// Tm = Tlm = 0 1 0 * Tlm<br />
/// tx ty 1
/// </remarks>
internal class MoveToNextLineWithOffset : IGraphicsStateOperation
public class MoveToNextLineWithOffset : IGraphicsStateOperation
{
/// <summary>
/// The symbol for this operation in a stream.

View File

@@ -8,7 +8,7 @@
/// Move to the start of the next line, offset from the start of the current line by (tx, ty).
/// This operator also sets the leading parameter in the text state.
/// </summary>
internal class MoveToNextLineWithOffsetSetLeading : IGraphicsStateOperation
public class MoveToNextLineWithOffsetSetLeading : IGraphicsStateOperation
{
/// <summary>
/// The symbol for this operation in a stream.
@@ -18,10 +18,21 @@
/// <inheritdoc />
public string Operator => Symbol;
/// <summary>
/// The x value of the offset.
/// </summary>
public decimal Tx { get; }
/// <summary>
/// The y value of the offset and the inverse of the leading parameter.
/// </summary>
public decimal Ty { get; }
/// <summary>
/// Create a new <see cref="MoveToNextLineWithOffsetSetLeading"/>.
/// </summary>
/// <param name="tx">The x value of the offset.</param>
/// <param name="ty">The y value of the offset and the inverse of the leading parameter.</param>
public MoveToNextLineWithOffsetSetLeading(decimal tx, decimal ty)
{
Tx = tx;

View File

@@ -8,7 +8,7 @@
/// <summary>
/// Set the text matrix and the text line matrix.
/// </summary>
internal class SetTextMatrix : IGraphicsStateOperation
public class SetTextMatrix : IGraphicsStateOperation
{
/// <summary>
/// The symbol for this operation in a stream.
@@ -18,8 +18,15 @@
/// <inheritdoc />
public string Operator => Symbol;
/// <summary>
/// The values of the text matrix.
/// </summary>
public decimal[] Value { get; }
/// <summary>
/// Create a new <see cref="SetTextMatrix"/>.
/// </summary>
/// <param name="value">The values of the text matrix.</param>
public SetTextMatrix(decimal[] value)
{
if (value.Length != 6)

View File

@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.IO;
using Tokens;
using Writer;
/// <inheritdoc />
/// <summary>
@@ -12,7 +13,7 @@
/// If the element is a string, this operator shows the string.
/// If it is a number, the operator adjusts the text position by that amount
/// </summary>
internal class ShowTextsWithPositioning : IGraphicsStateOperation
public class ShowTextsWithPositioning : IGraphicsStateOperation
{
/// <summary>
/// The symbol for this operation in a stream.
@@ -59,7 +60,20 @@
/// <inheritdoc />
public void Write(Stream stream)
{
throw new NotImplementedException();
stream.WriteText("[");
for (var i = 0; i < Array.Count; i++)
{
TokenWriter.WriteToken(Array[i], stream);
if (i < Array.Count - 1)
{
stream.WriteWhiteSpace();
}
}
stream.WriteText("]");
stream.WriteWhiteSpace();
stream.WriteText(Symbol);
stream.WriteNewLine();
}
}
}