mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-14 19:05:01 +08:00
add color information to the operation context. create color classes for letters and paths to use
This commit is contained in:
@@ -35,6 +35,20 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
switch (Operands.Count)
|
||||
{
|
||||
case 1:
|
||||
operationContext.ColorSpaceContext.SetNonStrokingColorGray(Operands[0]);
|
||||
break;
|
||||
case 3:
|
||||
operationContext.ColorSpaceContext.SetNonStrokingColorRgb(Operands[0], Operands[1], Operands[2]);
|
||||
break;
|
||||
case 4:
|
||||
operationContext.ColorSpaceContext.SetNonStrokingColorCmyk(Operands[0], Operands[1], Operands[2], Operands[3]);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -3,6 +3,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Colors;
|
||||
using Tokens;
|
||||
using Writer;
|
||||
|
||||
@@ -53,6 +54,25 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
if (operationContext.ColorSpaceContext.CurrentNonStrokingColorSpace.GetFamily() != ColorSpaceFamily.Device)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (Operands.Count)
|
||||
{
|
||||
case 1:
|
||||
operationContext.ColorSpaceContext.SetNonStrokingColorGray(Operands[0]);
|
||||
break;
|
||||
case 3:
|
||||
operationContext.ColorSpaceContext.SetNonStrokingColorRgb(Operands[0], Operands[1], Operands[2]);
|
||||
break;
|
||||
case 4:
|
||||
operationContext.ColorSpaceContext.SetNonStrokingColorCmyk(Operands[0], Operands[1], Operands[2], Operands[3]);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -54,7 +54,7 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.ColorspaceContext.SetNonStrokingColorCmyk(C, M, Y, K);
|
||||
operationContext.ColorSpaceContext.SetNonStrokingColorCmyk(C, M, Y, K);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -33,7 +33,7 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.ColorspaceContext.SetNonStrokingColorGray(Gray);
|
||||
operationContext.ColorSpaceContext.SetNonStrokingColorGray(Gray);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -47,7 +47,7 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.ColorspaceContext.SetNonStrokingColorRgb(R, G, B);
|
||||
operationContext.ColorSpaceContext.SetNonStrokingColorRgb(R, G, B);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -36,7 +36,7 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.ColorspaceContext.SetNonStrokingColorspace(Name);
|
||||
operationContext.ColorSpaceContext.SetNonStrokingColorspace(Name);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -38,13 +38,13 @@
|
||||
switch (Operands.Count)
|
||||
{
|
||||
case 1:
|
||||
operationContext.ColorspaceContext.SetStrokingColorGray(Operands[0]);
|
||||
operationContext.ColorSpaceContext.SetStrokingColorGray(Operands[0]);
|
||||
break;
|
||||
case 3:
|
||||
operationContext.ColorspaceContext.SetStrokingColorRgb(Operands[0], Operands[1], Operands[2]);
|
||||
operationContext.ColorSpaceContext.SetStrokingColorRgb(Operands[0], Operands[1], Operands[2]);
|
||||
break;
|
||||
case 4:
|
||||
operationContext.ColorspaceContext.SetStrokingColorCmyk(Operands[0], Operands[1], Operands[2], Operands[3]);
|
||||
operationContext.ColorSpaceContext.SetStrokingColorCmyk(Operands[0], Operands[1], Operands[2], Operands[3]);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@@ -3,6 +3,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Colors;
|
||||
using Tokens;
|
||||
using Writer;
|
||||
|
||||
@@ -40,7 +41,7 @@
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="SetStrokeColor"/>.
|
||||
/// Create a new <see cref="SetStrokeColorAdvanced"/>.
|
||||
/// </summary>
|
||||
/// <param name="operands">The color operands.</param>
|
||||
/// <param name="patternName">The pattern name.</param>
|
||||
@@ -53,6 +54,25 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
if (operationContext.ColorSpaceContext.CurrentStrokingColorSpace.GetFamily() != ColorSpaceFamily.Device)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (Operands.Count)
|
||||
{
|
||||
case 1:
|
||||
operationContext.ColorSpaceContext.SetStrokingColorGray(Operands[0]);
|
||||
break;
|
||||
case 3:
|
||||
operationContext.ColorSpaceContext.SetStrokingColorRgb(Operands[0], Operands[1], Operands[2]);
|
||||
break;
|
||||
case 4:
|
||||
operationContext.ColorSpaceContext.SetStrokingColorCmyk(Operands[0], Operands[1], Operands[2], Operands[3]);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -54,7 +54,7 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.ColorspaceContext.SetStrokingColorCmyk(C, M, Y, K);
|
||||
operationContext.ColorSpaceContext.SetStrokingColorCmyk(C, M, Y, K);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -33,7 +33,7 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.ColorspaceContext.SetStrokingColorGray(Gray);
|
||||
operationContext.ColorSpaceContext.SetStrokingColorGray(Gray);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -47,7 +47,7 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.ColorspaceContext.SetStrokingColorRgb(R, G, B);
|
||||
operationContext.ColorSpaceContext.SetStrokingColorRgb(R, G, B);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@@ -36,7 +36,7 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.ColorspaceContext.SetStrokingColorspace(Name);
|
||||
operationContext.ColorSpaceContext.SetStrokingColorspace(Name);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
Reference in New Issue
Block a user