diff --git a/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs b/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs
index 6727542a..dbc27329 100644
--- a/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs
+++ b/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs
@@ -4,7 +4,6 @@ namespace UglyToad.PdfPig.Graphics
{
using System;
using System.Collections.Generic;
- using Colors;
using Content;
using Filters;
using Geometry;
@@ -212,7 +211,7 @@ namespace UglyToad.PdfPig.Graphics
return point;
}
- public void AddCurrentSubpath() // Not an override
+ private void AddCurrentSubpath()
{
if (CurrentSubpath is null)
{
@@ -385,16 +384,12 @@ namespace UglyToad.PdfPig.Graphics
var currentState = GetCurrentState();
if (CurrentPath.IsStroked)
{
- CurrentPath.LineDashPattern = currentState.LineDashPattern;
- CurrentPath.StrokeColor = currentState.CurrentStrokingColor;
- CurrentPath.LineWidth = currentState.LineWidth;
- CurrentPath.LineCapStyle = currentState.CapStyle;
- CurrentPath.LineJoinStyle = currentState.JoinStyle;
+ CurrentPath.SetStrokeDetails(currentState);
}
if (CurrentPath.IsFilled)
{
- CurrentPath.FillColor = currentState.CurrentNonStrokingColor;
+ CurrentPath.SetFillDetails(currentState);
}
if (ParsingOptions.ClipPaths)
diff --git a/src/UglyToad.PdfPig/Graphics/PdfPath.cs b/src/UglyToad.PdfPig/Graphics/PdfPath.cs
index 7d9aa8f5..e202627f 100644
--- a/src/UglyToad.PdfPig/Graphics/PdfPath.cs
+++ b/src/UglyToad.PdfPig/Graphics/PdfPath.cs
@@ -6,7 +6,9 @@
using UglyToad.PdfPig.Graphics.Core;
///
- /// A path is made up of one or more disconnected subpaths, each comprising a sequence of connected segments. The topology of the path is unrestricted: it may be concave or convex, may contain multiple subpaths representing disjoint areas, and may intersect itself in arbitrary ways.
+ /// A path is made up of one or more disconnected subpaths, each comprising a sequence of connected segments.
+ /// The topology of the path is unrestricted: it may be concave or convex, may contain multiple subpaths representing
+ /// disjoint areas, and may intersect itself in arbitrary ways.
/// A path shall be composed of straight and curved line segments, which may connect to one another or may be disconnected.
///
public class PdfPath : List
@@ -29,7 +31,7 @@
///
/// The fill color.
///
- public IColor? FillColor { get; internal set; }
+ public IColor? FillColor { get; private set; }
///
/// Returns true if the path is stroked.
@@ -39,31 +41,31 @@
///
/// The stroke color.
///
- public IColor? StrokeColor { get; internal set; }
+ public IColor? StrokeColor { get; private set; }
///
/// Thickness in user space units of path to be stroked.
///
- public double LineWidth { get; internal set; }
+ public double LineWidth { get; private set; }
///
/// The pattern to be used for stroked lines.
///
- public LineDashPattern? LineDashPattern { get; internal set; }
+ public LineDashPattern? LineDashPattern { get; private set; }
///
/// The cap style to be used for stroked lines.
///
- public LineCapStyle LineCapStyle { get; internal set; }
+ public LineCapStyle LineCapStyle { get; private set; }
///
/// The join style to be used for stroked lines.
///
- public LineJoinStyle LineJoinStyle { get; internal set; }
+ public LineJoinStyle LineJoinStyle { get; private set; }
///
- /// Set the clipping mode for this path and IsClipping to true.
- /// IsFilled and IsStroked flags will be set to false.
+ /// Set the clipping mode for this path and IsClipping to true.
+ /// IsFilled and IsStroked flags will be set to false.
///
public void SetClipping(FillingRule fillingRule)
{
@@ -74,7 +76,7 @@
}
///
- /// Set the filling rule for this path and IsFilled to true.
+ /// Set the filling rule for this path and IsFilled to true.
///
public void SetFilled(FillingRule fillingRule)
{
@@ -83,13 +85,35 @@
}
///
- /// Set IsStroked to true.
+ /// Set IsStroked to true.
///
public void SetStroked()
{
IsStroked = true;
}
+ ///
+ /// Set the path stroke details, i.e. LineDashPattern, StrokeColor, LineWidth, LineCapStyle and LineJoinStyle.
+ ///
+ /// The current graphics state.
+ public void SetStrokeDetails(CurrentGraphicsState graphicsState)
+ {
+ LineDashPattern = graphicsState.LineDashPattern;
+ StrokeColor = graphicsState.CurrentStrokingColor;
+ LineWidth = graphicsState.LineWidth;
+ LineCapStyle = graphicsState.CapStyle;
+ LineJoinStyle = graphicsState.JoinStyle;
+ }
+
+ ///
+ /// Set the path fill details, i.e. FillColor.
+ ///
+ /// The current graphics state.
+ public void SetFillDetails(CurrentGraphicsState graphicsState)
+ {
+ FillColor = graphicsState.CurrentNonStrokingColor;
+ }
+
///
/// Create a clone with no Subpaths.
///