diff --git a/src/UglyToad.PdfPig.Core/PdfPath.cs b/src/UglyToad.PdfPig.Core/PdfSubpath.cs similarity index 96% rename from src/UglyToad.PdfPig.Core/PdfPath.cs rename to src/UglyToad.PdfPig.Core/PdfSubpath.cs index a62b363f..faf65ad9 100644 --- a/src/UglyToad.PdfPig.Core/PdfPath.cs +++ b/src/UglyToad.PdfPig.Core/PdfSubpath.cs @@ -8,17 +8,17 @@ /// /// A path in a PDF document, used by glyphs and page content. Can contain multiple sub-paths. /// - public class PdfPath + public class PdfSubpath { private readonly List commands = new List(); /// - /// The sequence of sub-paths which form this . + /// The sequence of sub-paths which form this . /// public IReadOnlyList Commands => commands; /// - /// True if the was originaly draw as a rectangle. + /// True if the was originaly draw as a rectangle. /// public bool IsDrawnAsRectangle { get; internal set; } @@ -63,7 +63,7 @@ } /// - /// Get the 's centroid point. + /// Get the 's centroid point. /// public PdfPoint GetCentroid() { @@ -124,12 +124,12 @@ } /// - /// Simplify this by converting everything to s. + /// Simplify this by converting everything to s. /// /// Number of lines required (minimum is 1). - internal PdfPath Simplify(int n = 4) + internal PdfSubpath Simplify(int n = 4) { - PdfPath simplifiedPath = new PdfPath(); + PdfSubpath simplifiedPath = new PdfSubpath(); var startPoint = GetStartPoint(Commands.First()); simplifiedPath.MoveTo(startPoint.X, startPoint.Y); @@ -315,7 +315,7 @@ } /// - /// A command in a . + /// A command in a . /// public interface IPathCommand { @@ -332,7 +332,7 @@ } /// - /// Close the current . + /// Close the current . /// public class Close : IPathCommand { @@ -363,7 +363,7 @@ } /// - /// Move drawing of the current to the specified location. + /// Move drawing of the current to the specified location. /// public class Move : IPathCommand { @@ -707,11 +707,11 @@ } /// - /// Compares two s for equality. Paths will only be considered equal if the commands which construct the paths are in the same order. + /// Compares two s for equality. Paths will only be considered equal if the commands which construct the paths are in the same order. /// public override bool Equals(object obj) { - if (obj is PdfPath path) + if (obj is PdfSubpath path) { if (Commands.Count != path.Commands.Count) return false; diff --git a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/AltoXmlTextExporter.cs b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/AltoXmlTextExporter.cs index d7010045..46939fa5 100644 --- a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/AltoXmlTextExporter.cs +++ b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/AltoXmlTextExporter.cs @@ -54,7 +54,7 @@ /// Get the Alto (XML) string of the pages layout. /// /// The document to extract page layouts from. - /// Draw s present in the page. + /// Draw PdfPaths present in the page. public string Get(PdfDocument document, bool includePaths = false) { var altoDocument = CreateAltoDocument("unknown"); @@ -67,7 +67,7 @@ /// /// - /// Get the Alto (XML) string of the page layout. Excludes s. + /// Get the Alto (XML) string of the page layout. Excludes s. /// /// The page to export the XML layout for. public string Get(Page page) => Get(page, false); @@ -76,7 +76,7 @@ /// Get the Alto (XML) string of the page layout. /// /// The page to export the XML layout for. - /// Whether the output should include the s present in the page. + /// Whether the output should include the PdfPaths present in the page. public string Get(Page page, bool includePaths) { var document = CreateAltoDocument("unknown"); @@ -159,7 +159,7 @@ return altoPage; } - private AltoDocument.AltoGraphicalElement ToAltoGraphicalElement(PdfPath pdfPath, double height) + private AltoDocument.AltoGraphicalElement ToAltoGraphicalElement(PdfSubpath pdfPath, double height) { graphicalElementCount++; diff --git a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/HOcrTextExporter.cs b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/HOcrTextExporter.cs index 1b0a40f0..fca4b720 100644 --- a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/HOcrTextExporter.cs +++ b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/HOcrTextExporter.cs @@ -47,7 +47,7 @@ /// Get the hOCR (HTML) string of the page layout. /// /// The document. - /// Draw s present in the page. + /// Draw PdfPaths present in the page. /// Will add a reference to the 'hocrjs' script just before the closing 'body' tag, adding the /// interface to a plain hOCR file.See https://github.com/kba/hocrjs for more information. public string Get(PdfDocument document, bool includePaths = false, bool useHocrjs = false) @@ -67,7 +67,7 @@ } /// - /// Get the hOCR (HTML) string of the page layout. Excludes s. + /// Get the hOCR (HTML) string of the page layout. Excludes PdfPaths. /// /// The page. public string Get(Page page) @@ -80,7 +80,7 @@ /// /// The page. /// The image name, if any. - /// Draw s present in the page. + /// Draw PdfPaths present in the page. /// Will add a reference to the 'hocrjs' script just before the closing 'body' tag, adding the interface to a plain hOCR file.See https://github.com/kba/hocrjs for more information. public string Get(Page page, bool includePaths = false, string imageName = "unknown", bool useHocrjs = false) { @@ -129,7 +129,7 @@ /// /// /// - /// Draw s present in the page. + /// Draw PdfPaths present in the page. private string GetCode(Page page, bool includePaths, string imageName = "unknown") { pageCount++; @@ -176,7 +176,7 @@ /// /// /// The indent level. - private string GetCode(PdfPath path, double pageHeight, bool subPaths, int level) + private string GetCode(PdfSubpath path, double pageHeight, bool subPaths, int level) { if (path == null) return string.Empty; diff --git a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/PageXmlTextExporter.cs b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/PageXmlTextExporter.cs index 4358f2b4..52ed18a2 100644 --- a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/PageXmlTextExporter.cs +++ b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/PageXmlTextExporter.cs @@ -57,14 +57,14 @@ /// Get the PAGE-XML (XML) string of the pages layout. /// /// - /// Draw s present in the page. + /// Draw PdfPaths present in the page. public string Get(PdfDocument document, bool includePaths = false) { throw new NotImplementedException(); } /// - /// Get the PAGE-XML (XML) string of the pages layout. Excludes s. + /// Get the PAGE-XML (XML) string of the pages layout. Excludes PdfPaths. /// /// public string Get(Page page) @@ -76,7 +76,7 @@ /// Get the PAGE-XML (XML) string of the pages layout. /// /// - /// Draw s present in the page. + /// Draw PdfPaths present in the page. public string Get(Page page, bool includePaths) { lineCount = 0; @@ -199,7 +199,7 @@ return pageXmlPage; } - private PageXmlDocument.PageXmlLineDrawingRegion ToPageXmlLineDrawingRegion(PdfPath pdfPath, double height) + private PageXmlDocument.PageXmlLineDrawingRegion ToPageXmlLineDrawingRegion(PdfSubpath pdfPath, double height) { var bbox = pdfPath.GetBoundingRectangle(); if (bbox.HasValue) diff --git a/src/UglyToad.PdfPig.Fonts/CompactFontFormat/CharStrings/Type2BuildCharContext.cs b/src/UglyToad.PdfPig.Fonts/CompactFontFormat/CharStrings/Type2BuildCharContext.cs index cac89bc0..d1af650c 100644 --- a/src/UglyToad.PdfPig.Fonts/CompactFontFormat/CharStrings/Type2BuildCharContext.cs +++ b/src/UglyToad.PdfPig.Fonts/CompactFontFormat/CharStrings/Type2BuildCharContext.cs @@ -18,7 +18,7 @@ /// /// The current path. /// - public PdfPath Path { get; } = new PdfPath(); + public PdfSubpath Path { get; } = new PdfSubpath(); /// /// The current location of the active point. diff --git a/src/UglyToad.PdfPig.Fonts/CompactFontFormat/CharStrings/Type2CharStrings.cs b/src/UglyToad.PdfPig.Fonts/CompactFontFormat/CharStrings/Type2CharStrings.cs index 2f650316..78ec81ec 100644 --- a/src/UglyToad.PdfPig.Fonts/CompactFontFormat/CharStrings/Type2CharStrings.cs +++ b/src/UglyToad.PdfPig.Fonts/CompactFontFormat/CharStrings/Type2CharStrings.cs @@ -32,7 +32,7 @@ /// The name of the character to retrieve the CharString for. /// The default width for the glyph from the font's private dictionary. /// The nominal width which individual glyph widths are encoded as the difference from. - /// A for the glyph. + /// A for the glyph. public Type2Glyph Generate(string name, double defaultWidthX, double nominalWidthX) { Type2Glyph glyph; @@ -223,7 +223,7 @@ /// /// The path of the glyph. /// - public PdfPath Path { get; } + public PdfSubpath Path { get; } /// /// The width of the glyph as a difference from the nominal width X for the font. Optional. @@ -233,7 +233,7 @@ /// /// Create a new . /// - public Type2Glyph(PdfPath path, double? width) + public Type2Glyph(PdfSubpath path, double? width) { Path = path ?? throw new ArgumentNullException(nameof(path)); Width = width; diff --git a/src/UglyToad.PdfPig.Fonts/Type1/CharStrings/Commands/Type1BuildCharContext.cs b/src/UglyToad.PdfPig.Fonts/Type1/CharStrings/Commands/Type1BuildCharContext.cs index b66238ff..603a63c9 100644 --- a/src/UglyToad.PdfPig.Fonts/Type1/CharStrings/Commands/Type1BuildCharContext.cs +++ b/src/UglyToad.PdfPig.Fonts/Type1/CharStrings/Commands/Type1BuildCharContext.cs @@ -6,8 +6,8 @@ internal class Type1BuildCharContext { - private readonly Func characterByIndexFactory; - private readonly Func characterByNameFactory; + private readonly Func characterByIndexFactory; + private readonly Func characterByNameFactory; public IReadOnlyDictionary Subroutines { get; } public double WidthX { get; set; } @@ -20,7 +20,7 @@ public bool IsFlexing { get; set; } - public PdfPath Path { get; private set; } = new PdfPath(); + public PdfSubpath Path { get; private set; } = new PdfSubpath(); public PdfPoint CurrentPosition { get; set; } @@ -31,8 +31,8 @@ public IReadOnlyList FlexPoints { get; } public Type1BuildCharContext(IReadOnlyDictionary subroutines, - Func characterByIndexFactory, - Func characterByNameFactory) + Func characterByIndexFactory, + Func characterByNameFactory) { this.characterByIndexFactory = characterByIndexFactory ?? throw new ArgumentNullException(nameof(characterByIndexFactory)); this.characterByNameFactory = characterByNameFactory ?? throw new ArgumentNullException(nameof(characterByNameFactory)); @@ -44,17 +44,17 @@ } - public PdfPath GetCharacter(int characterCode) + public PdfSubpath GetCharacter(int characterCode) { return characterByIndexFactory(characterCode); } - public PdfPath GetCharacter(string characterName) + public PdfSubpath GetCharacter(string characterName) { return characterByNameFactory(characterName); } - public void SetPath(PdfPath path) + public void SetPath(PdfSubpath path) { Path = path ?? throw new ArgumentNullException(nameof(path)); } diff --git a/src/UglyToad.PdfPig.Fonts/Type1/CharStrings/Type1CharStrings.cs b/src/UglyToad.PdfPig.Fonts/Type1/CharStrings/Type1CharStrings.cs index e47fd363..0f989d78 100644 --- a/src/UglyToad.PdfPig.Fonts/Type1/CharStrings/Type1CharStrings.cs +++ b/src/UglyToad.PdfPig.Fonts/Type1/CharStrings/Type1CharStrings.cs @@ -10,7 +10,7 @@ { private readonly IReadOnlyDictionary charStringIndexToName; private readonly object locker = new object(); - private readonly Dictionary glyphs = new Dictionary(); + private readonly Dictionary glyphs = new Dictionary(); public IReadOnlyDictionary CharStrings { get; } @@ -24,9 +24,9 @@ Subroutines = subroutines ?? throw new ArgumentNullException(nameof(subroutines)); } - public bool TryGenerate(string name, out PdfPath path) + public bool TryGenerate(string name, out PdfSubpath path) { - path = default(PdfPath); + path = default(PdfSubpath); lock (locker) { if (glyphs.TryGetValue(name, out path)) @@ -54,7 +54,7 @@ return true; } - private PdfPath Run(CommandSequence sequence) + private PdfSubpath Run(CommandSequence sequence) { var context = new Type1BuildCharContext(Subroutines, i => { diff --git a/src/UglyToad.PdfPig.Tests/Core/PdfPathTests.cs b/src/UglyToad.PdfPig.Tests/Core/PdfPathTests.cs index ab403ea5..83835b1b 100644 --- a/src/UglyToad.PdfPig.Tests/Core/PdfPathTests.cs +++ b/src/UglyToad.PdfPig.Tests/Core/PdfPathTests.cs @@ -372,7 +372,7 @@ [MemberData(nameof(IsCounterClockwiseData))] public void IsCounterClockwise(double[][] source, bool expected) { - PdfPath pdfPath = new PdfPath(); + PdfSubpath pdfPath = new PdfSubpath(); foreach (var point in source) { pdfPath.LineTo(point[0], point[1]); diff --git a/src/UglyToad.PdfPig.Tests/Fonts/CharacterPathTests.cs b/src/UglyToad.PdfPig.Tests/Fonts/CharacterPathTests.cs index 6f689f5b..59d9505d 100644 --- a/src/UglyToad.PdfPig.Tests/Fonts/CharacterPathTests.cs +++ b/src/UglyToad.PdfPig.Tests/Fonts/CharacterPathTests.cs @@ -10,7 +10,7 @@ [Fact] public void BezierCurveGeneratesCorrectBoundingBox() { - var curve = new PdfPath.BezierCurve(new PdfPoint(60, 105), + var curve = new PdfSubpath.BezierCurve(new PdfPoint(60, 105), new PdfPoint(75, 30), new PdfPoint(215, 115), new PdfPoint(140, 160)); @@ -28,7 +28,7 @@ [Fact] public void LoopBezierCurveGeneratesCorrectBoundingBox() { - var curve = new PdfPath.BezierCurve(new PdfPoint(166, 142), + var curve = new PdfSubpath.BezierCurve(new PdfPoint(166, 142), new PdfPoint(75, 30), new PdfPoint(215, 115), new PdfPoint(140, 160)); @@ -47,7 +47,7 @@ [Fact] public void BezierCurveAddsCorrectSvgCommand() { - var curve = new PdfPath.BezierCurve(new PdfPoint(60, 105), + var curve = new PdfSubpath.BezierCurve(new PdfPoint(60, 105), new PdfPoint(75, 30), new PdfPoint(215, 115), new PdfPoint(140, 160)); diff --git a/src/UglyToad.PdfPig.Tests/Geometry/BezierCurveTests.cs b/src/UglyToad.PdfPig.Tests/Geometry/BezierCurveTests.cs index 10fd8486..3fc7ebcb 100644 --- a/src/UglyToad.PdfPig.Tests/Geometry/BezierCurveTests.cs +++ b/src/UglyToad.PdfPig.Tests/Geometry/BezierCurveTests.cs @@ -4,7 +4,7 @@ using UglyToad.PdfPig.Core; using UglyToad.PdfPig.Geometry; using Xunit; - using static UglyToad.PdfPig.Core.PdfPath; + using static UglyToad.PdfPig.Core.PdfSubpath; public class BezierCurveTests { diff --git a/src/UglyToad.PdfPig.Tests/Geometry/PdfPathLineTests.cs b/src/UglyToad.PdfPig.Tests/Geometry/PdfPathLineTests.cs index 767a09cc..28ca3a84 100644 --- a/src/UglyToad.PdfPig.Tests/Geometry/PdfPathLineTests.cs +++ b/src/UglyToad.PdfPig.Tests/Geometry/PdfPathLineTests.cs @@ -4,7 +4,7 @@ using UglyToad.PdfPig.Core; using UglyToad.PdfPig.Geometry; using Xunit; - using static UglyToad.PdfPig.Core.PdfPath; + using static UglyToad.PdfPig.Core.PdfSubpath; public class PdfPathLineTests { diff --git a/src/UglyToad.PdfPig.Tests/Graphics/TestOperationContext.cs b/src/UglyToad.PdfPig.Tests/Graphics/TestOperationContext.cs index f25433dd..bb0284a8 100644 --- a/src/UglyToad.PdfPig.Tests/Graphics/TestOperationContext.cs +++ b/src/UglyToad.PdfPig.Tests/Graphics/TestOperationContext.cs @@ -20,7 +20,7 @@ public TransformationMatrix CurrentTransformationMatrix => GetCurrentState().CurrentTransformationMatrix; - public PdfPath CurrentPath { get; set; } + public PdfSubpath CurrentPath { get; set; } public IColorSpaceContext ColorSpaceContext { get; } @@ -29,7 +29,7 @@ public TestOperationContext() { StateStack.Push(new CurrentGraphicsState()); - CurrentPath = new PdfPath(); + CurrentPath = new PdfSubpath(); ColorSpaceContext = new ColorSpaceContext(GetCurrentState, new ResourceStore(new TestPdfTokenScanner(), new TestFontFactory())); } diff --git a/src/UglyToad.PdfPig/Content/ArtifactMarkedContentElement.cs b/src/UglyToad.PdfPig/Content/ArtifactMarkedContentElement.cs index df035d46..9582c1a9 100644 --- a/src/UglyToad.PdfPig/Content/ArtifactMarkedContentElement.cs +++ b/src/UglyToad.PdfPig/Content/ArtifactMarkedContentElement.cs @@ -73,7 +73,7 @@ IReadOnlyList attached, IReadOnlyList children, IReadOnlyList letters, - IReadOnlyList paths, + IReadOnlyList paths, IReadOnlyList images, int index) : base(markedContentIdentifier, tag, properties, language, diff --git a/src/UglyToad.PdfPig/Content/MarkedContentElement.cs b/src/UglyToad.PdfPig/Content/MarkedContentElement.cs index 8a79968c..f239c812 100644 --- a/src/UglyToad.PdfPig/Content/MarkedContentElement.cs +++ b/src/UglyToad.PdfPig/Content/MarkedContentElement.cs @@ -50,7 +50,7 @@ /// /// Paths contained in this marked content. /// - public IReadOnlyList Paths { get; } + public IReadOnlyList Paths { get; } /// /// Images contained in this marked content. @@ -88,7 +88,7 @@ bool isArtifact, IReadOnlyList children, IReadOnlyList letters, - IReadOnlyList paths, + IReadOnlyList paths, IReadOnlyList images, int index) { diff --git a/src/UglyToad.PdfPig/Content/Page.cs b/src/UglyToad.PdfPig/Content/Page.cs index 35a5a67a..6ce2166d 100644 --- a/src/UglyToad.PdfPig/Content/Page.cs +++ b/src/UglyToad.PdfPig/Content/Page.cs @@ -172,9 +172,9 @@ private readonly AnnotationProvider annotationProvider; /// - /// The set of s drawn by the PDF content. + /// The set of s drawn by the PDF content. /// - public IReadOnlyList Paths => page.Content?.Paths ?? new List(); + public IReadOnlyList Paths => page.Content?.Paths ?? new List(); internal Experimental(Page page, AnnotationProvider annotationProvider) { diff --git a/src/UglyToad.PdfPig/Content/PageContent.cs b/src/UglyToad.PdfPig/Content/PageContent.cs index 55ddad9f..3888ab10 100644 --- a/src/UglyToad.PdfPig/Content/PageContent.cs +++ b/src/UglyToad.PdfPig/Content/PageContent.cs @@ -28,12 +28,12 @@ public IReadOnlyList Letters { get; } - public IReadOnlyList Paths { get; } + public IReadOnlyList Paths { get; } public int NumberOfImages => images.Count; internal PageContent(IReadOnlyList graphicsStateOperations, IReadOnlyList letters, - IReadOnlyList paths, + IReadOnlyList paths, IReadOnlyList> images, IReadOnlyList markedContents, IPdfTokenScanner pdfScanner, diff --git a/src/UglyToad.PdfPig/Geometry/GeometryExtensions.cs b/src/UglyToad.PdfPig/Geometry/GeometryExtensions.cs index 9eb03479..e1147111 100644 --- a/src/UglyToad.PdfPig/Geometry/GeometryExtensions.cs +++ b/src/UglyToad.PdfPig/Geometry/GeometryExtensions.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; + using static UglyToad.PdfPig.Core.PdfSubpath; /// /// Extension class to Geometry. @@ -469,7 +470,7 @@ /// /// Whether two lines intersect. /// - public static bool IntersectsWith(this PdfLine line, PdfPath.Line other) + public static bool IntersectsWith(this PdfLine line, Line other) { return IntersectsWith(line.Point1, line.Point2, other.From, other.To); } @@ -485,7 +486,7 @@ /// /// Get the that is the intersection of two lines. /// - public static PdfPoint? Intersect(this PdfLine line, PdfPath.Line other) + public static PdfPoint? Intersect(this PdfLine line, Line other) { return Intersect(line.Point1, line.Point2, other.From, other.To); } @@ -501,7 +502,7 @@ /// /// Checks if both lines are parallel. /// - public static bool ParallelTo(this PdfLine line, PdfPath.Line other) + public static bool ParallelTo(this PdfLine line, Line other) { return ParallelTo(line.Point1, line.Point2, other.From, other.To); } @@ -511,7 +512,7 @@ /// /// Whether the line segment contains the point. /// - public static bool Contains(this PdfPath.Line line, PdfPoint point) + public static bool Contains(this Line line, PdfPoint point) { return Contains(line.From, line.To, point); } @@ -519,7 +520,7 @@ /// /// Whether two lines intersect. /// - public static bool IntersectsWith(this PdfPath.Line line, PdfPath.Line other) + public static bool IntersectsWith(this Line line, Line other) { return IntersectsWith(line.From, line.To, other.From, other.To); } @@ -527,7 +528,7 @@ /// /// Whether two lines intersect. /// - public static bool IntersectsWith(this PdfPath.Line line, PdfLine other) + public static bool IntersectsWith(this Line line, PdfLine other) { return IntersectsWith(line.From, line.To, other.Point1, other.Point2); } @@ -535,7 +536,7 @@ /// /// Get the that is the intersection of two lines. /// - public static PdfPoint? Intersect(this PdfPath.Line line, PdfPath.Line other) + public static PdfPoint? Intersect(this Line line, Line other) { return Intersect(line.From, line.To, other.From, other.To); } @@ -543,7 +544,7 @@ /// /// Get the that is the intersection of two lines. /// - public static PdfPoint? Intersect(this PdfPath.Line line, PdfLine other) + public static PdfPoint? Intersect(this Line line, PdfLine other) { return Intersect(line.From, line.To, other.Point1, other.Point2); } @@ -551,7 +552,7 @@ /// /// Checks if both lines are parallel. /// - public static bool ParallelTo(this PdfPath.Line line, PdfPath.Line other) + public static bool ParallelTo(this Line line, Line other) { return ParallelTo(line.From, line.To, other.From, other.To); } @@ -559,7 +560,7 @@ /// /// Checks if both lines are parallel. /// - public static bool ParallelTo(this PdfPath.Line line, PdfLine other) + public static bool ParallelTo(this Line line, PdfLine other) { return ParallelTo(line.From, line.To, other.Point1, other.Point2); } @@ -641,7 +642,7 @@ /// /// The original bezier curve. /// The t value were to split the curve, usually between 0 and 1, but not necessary. - public static (PdfPath.BezierCurve, PdfPath.BezierCurve) Split(this PdfPath.BezierCurve bezierCurve, double tau) + public static (BezierCurve, BezierCurve) Split(this BezierCurve bezierCurve, double tau) { // De Casteljau Algorithm PdfPoint[][] points = new PdfPoint[4][]; @@ -668,29 +669,29 @@ } } - return (new PdfPath.BezierCurve(points[0][0], points[1][0], points[2][0], points[3][0]), - new PdfPath.BezierCurve(points[3][0], points[2][1], points[1][2], points[0][3])); + return (new BezierCurve(points[0][0], points[1][0], points[2][0], points[3][0]), + new BezierCurve(points[3][0], points[2][1], points[1][2], points[0][3])); } /// /// Checks if the curve and the line are intersecting. - /// Avoid using this method as it is not optimised. Use instead. + /// Avoid using this method as it is not optimised. Use instead. /// - public static bool IntersectsWith(this PdfPath.BezierCurve bezierCurve, PdfLine line) + public static bool IntersectsWith(this BezierCurve bezierCurve, PdfLine line) { return IntersectsWith(bezierCurve, line.Point1, line.Point2); } /// /// Checks if the curve and the line are intersecting. - /// Avoid using this method as it is not optimised. Use instead. + /// Avoid using this method as it is not optimised. Use instead. /// - public static bool IntersectsWith(this PdfPath.BezierCurve bezierCurve, PdfPath.Line line) + public static bool IntersectsWith(this BezierCurve bezierCurve, Line line) { return IntersectsWith(bezierCurve, line.From, line.To); } - private static bool IntersectsWith(PdfPath.BezierCurve bezierCurve, PdfPoint p1, PdfPoint p2) + private static bool IntersectsWith(BezierCurve bezierCurve, PdfPoint p1, PdfPoint p2) { return Intersect(bezierCurve, p1, p2).Length > 0; } @@ -698,7 +699,7 @@ /// /// Get the s that are the intersections of the line and the curve. /// - public static PdfPoint[] Intersect(this PdfPath.BezierCurve bezierCurve, PdfLine line) + public static PdfPoint[] Intersect(this BezierCurve bezierCurve, PdfLine line) { return Intersect(bezierCurve, line.Point1, line.Point2); } @@ -706,12 +707,12 @@ /// /// Get the s that are the intersections of the line and the curve. /// - public static PdfPoint[] Intersect(this PdfPath.BezierCurve bezierCurve, PdfPath.Line line) + public static PdfPoint[] Intersect(this BezierCurve bezierCurve, Line line) { return Intersect(bezierCurve, line.From, line.To); } - private static PdfPoint[] Intersect(PdfPath.BezierCurve bezierCurve, PdfPoint p1, PdfPoint p2) + private static PdfPoint[] Intersect(BezierCurve bezierCurve, PdfPoint p1, PdfPoint p2) { var ts = IntersectT(bezierCurve, p1, p2); if (ts == null || ts.Length == 0) return EmptyArray.Instance; @@ -720,12 +721,12 @@ foreach (var t in ts) { PdfPoint point = new PdfPoint( - PdfPath.BezierCurve.ValueWithT(bezierCurve.StartPoint.X, + BezierCurve.ValueWithT(bezierCurve.StartPoint.X, bezierCurve.FirstControlPoint.X, bezierCurve.SecondControlPoint.X, bezierCurve.EndPoint.X, t), - PdfPath.BezierCurve.ValueWithT(bezierCurve.StartPoint.Y, + BezierCurve.ValueWithT(bezierCurve.StartPoint.Y, bezierCurve.FirstControlPoint.Y, bezierCurve.SecondControlPoint.Y, bezierCurve.EndPoint.Y, @@ -738,8 +739,8 @@ /// /// Get the t values that are the intersections of the line and the curve. /// - /// List of t values where the and the intersect. - public static double[] IntersectT(this PdfPath.BezierCurve bezierCurve, PdfLine line) + /// List of t values where the and the intersect. + public static double[] IntersectT(this BezierCurve bezierCurve, PdfLine line) { return IntersectT(bezierCurve, line.Point1, line.Point2); } @@ -747,13 +748,13 @@ /// /// Get the t values that are the intersections of the line and the curve. /// - /// List of t values where the and the intersect. - public static double[] IntersectT(this PdfPath.BezierCurve bezierCurve, PdfPath.Line line) + /// List of t values where the and the intersect. + public static double[] IntersectT(this BezierCurve bezierCurve, Line line) { return IntersectT(bezierCurve, line.From, line.To); } - private static double[] IntersectT(PdfPath.BezierCurve bezierCurve, PdfPoint p1, PdfPoint p2) + private static double[] IntersectT(BezierCurve bezierCurve, PdfPoint p1, PdfPoint p2) { // if the bounding boxes do not intersect, they cannot intersect var bezierBbox = bezierCurve.GetBoundingRectangle(); @@ -887,7 +888,7 @@ return new[] {x1, x2, x3}; } - internal static string ToSvg(this PdfPath p) + internal static string ToSvg(this PdfSubpath p) { var builder = new StringBuilder(); foreach (var pathCommand in p.Commands) @@ -908,7 +909,7 @@ return builder.ToString(); } - internal static string ToFullSvg(this PdfPath p) + internal static string ToFullSvg(this PdfSubpath p) { string BboxToRect(PdfRectangle box, string stroke) { diff --git a/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs b/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs index 56803231..d8eed465 100644 --- a/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs +++ b/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs @@ -28,7 +28,7 @@ /// /// Stores each path as it is encountered in the content stream. /// - private readonly List paths = new List(); + private readonly List paths = new List(); /// /// Stores a link to each image (either inline or XObject) as it is encountered in the content stream. @@ -66,7 +66,7 @@ public TransformationMatrix CurrentTransformationMatrix => GetCurrentState().CurrentTransformationMatrix; - public PdfPath CurrentPath { get; private set; } + public PdfSubpath CurrentPath { get; private set; } public IColorSpaceContext ColorSpaceContext { get; } @@ -404,7 +404,7 @@ markedContentStack.AddPath(CurrentPath); } - CurrentPath = new PdfPath(); + CurrentPath = new PdfSubpath(); currentPathAdded = false; } diff --git a/src/UglyToad.PdfPig/Graphics/IOperationContext.cs b/src/UglyToad.PdfPig/Graphics/IOperationContext.cs index 740c3a0f..a710b864 100644 --- a/src/UglyToad.PdfPig/Graphics/IOperationContext.cs +++ b/src/UglyToad.PdfPig/Graphics/IOperationContext.cs @@ -14,7 +14,7 @@ /// The current path being drawn if applicable. /// [CanBeNull] - PdfPath CurrentPath { get; } + PdfSubpath CurrentPath { get; } /// /// The active colorspaces for this content stream. diff --git a/src/UglyToad.PdfPig/Graphics/MarkedContentStack.cs b/src/UglyToad.PdfPig/Graphics/MarkedContentStack.cs index bef8b3ed..ba941eb1 100644 --- a/src/UglyToad.PdfPig/Graphics/MarkedContentStack.cs +++ b/src/UglyToad.PdfPig/Graphics/MarkedContentStack.cs @@ -57,7 +57,7 @@ top?.AddLetter(letter); } - public void AddPath(PdfPath path) + public void AddPath(PdfSubpath path) { top?.AddPath(path); } @@ -86,7 +86,7 @@ private readonly DictionaryToken properties; private readonly List letters = new List(); - private readonly List paths = new List(); + private readonly List paths = new List(); private readonly List images = new List(); public List Children { get; } = new List(); @@ -108,7 +108,7 @@ images.Add(image); } - public void AddPath(PdfPath path) + public void AddPath(PdfSubpath path) { paths.Add(path); }