diff --git a/icons/shapes-logo.svg b/icons/shapes-logo.svg new file mode 100644 index 0000000..fc0ad9a --- /dev/null +++ b/icons/shapes-logo.svg @@ -0,0 +1,317 @@ + + + + + logo.svg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + logo.svg + + + + + + + + + + + + + + + + + + + + + diff --git a/src/SixLabors.Shapes/ComplexPolygon.cs b/src/SixLabors.Shapes/ComplexPolygon.cs index f31d450..c49caf9 100644 --- a/src/SixLabors.Shapes/ComplexPolygon.cs +++ b/src/SixLabors.Shapes/ComplexPolygon.cs @@ -173,8 +173,7 @@ public int FindIntersections(PointF start, PointF end, PointF[] buffer, int offs int totalAdded = 0; for (int i = 0; i < this.paths.Length; i++) { - offset += totalAdded; - int added = this.paths[i].FindIntersections(start, end, buffer, offset); + int added = this.paths[i].FindIntersections(start, end, buffer, totalAdded + offset); totalAdded += added; } diff --git a/src/SixLabors.Shapes/Outliner.cs b/src/SixLabors.Shapes/Outliner.cs index f3f5120..ed3ffb2 100644 --- a/src/SixLabors.Shapes/Outliner.cs +++ b/src/SixLabors.Shapes/Outliner.cs @@ -148,7 +148,7 @@ public static IPath GenerateOutline(this IPath path, float width) EndType type = p.IsClosed ? EndType.etClosedLine : EndType.etOpenButt; - offset.AddPath(points, JoinType.jtMiter, type); + offset.AddPath(points, JoinType.jtSquare, type); } return ExecuteOutliner(width, offset); diff --git a/tests/SixLabors.Shapes.Tests/Issues/Issue_ClippedPaths.cs b/tests/SixLabors.Shapes.Tests/Issues/Issue_ClippedPaths.cs new file mode 100644 index 0000000..a8aaddb --- /dev/null +++ b/tests/SixLabors.Shapes.Tests/Issues/Issue_ClippedPaths.cs @@ -0,0 +1,30 @@ +using SixLabors.Primitives; +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; + +namespace SixLabors.Shapes.Tests.Issues +{ + public class Issue_ClippedPaths + { + [Fact] + public void ClippedTriangle() + { + Polygon simplePath = new Polygon(new LinearLineSegment( + new PointF(10, 10), + new PointF(200, 150), + new PointF(50, 300))); + + Polygon hole1 = new Polygon(new LinearLineSegment( + new PointF(37, 85), + new PointF(93, 85), + new PointF(65, 137))); + + var clippedPath = simplePath.Clip(hole1); + var outline = clippedPath.GenerateOutline(5, new[] { 1f }); + + Assert.False(outline.Contains(new PointF(74, 97))); + } + } +}