Skip to content

Commit 1c9f579

Browse files
Revert extension return type changes
1 parent 457b1fa commit 1c9f579

8 files changed

Lines changed: 20 additions & 20 deletions

File tree

src/ImageSharp.Drawing/Shapes/ClipPathExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static class ClipPathExtensions
1717
/// <param name="shape">The shape.</param>
1818
/// <param name="holes">The holes.</param>
1919
/// <returns>Returns a new shape with the holes clipped out of the shape.</returns>
20-
public static ComplexPolygon Clip(this IPath shape, IEnumerable<IPath> holes)
20+
public static IPath Clip(this IPath shape, IEnumerable<IPath> holes)
2121
{
2222
var clipper = new Clipper();
2323

@@ -35,7 +35,7 @@ public static ComplexPolygon Clip(this IPath shape, IEnumerable<IPath> holes)
3535
/// <param name="shape">The shape.</param>
3636
/// <param name="holes">The holes.</param>
3737
/// <returns>Returns a new shape with the holes clipped out of the shape.</returns>
38-
public static ComplexPolygon Clip(this IPath shape, params IPath[] holes)
38+
public static IPath Clip(this IPath shape, params IPath[] holes)
3939
=> shape.Clip((IEnumerable<IPath>)holes);
4040
}
4141
}

src/ImageSharp.Drawing/Shapes/OutlinePathExtensions.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static class OutlinePathExtensions
2525
/// <param name="width">The final width outline</param>
2626
/// <param name="pattern">The pattern made of multiples of the width.</param>
2727
/// <returns>A new path representing the outline.</returns>
28-
public static ComplexPolygon GenerateOutline(this IPath path, float width, float[] pattern)
28+
public static IPath GenerateOutline(this IPath path, float width, float[] pattern)
2929
=> path.GenerateOutline(width, new ReadOnlySpan<float>(pattern));
3030

3131
/// <summary>
@@ -35,7 +35,7 @@ public static ComplexPolygon GenerateOutline(this IPath path, float width, float
3535
/// <param name="width">The final width outline</param>
3636
/// <param name="pattern">The pattern made of multiples of the width.</param>
3737
/// <returns>A new path representing the outline.</returns>
38-
public static ComplexPolygon GenerateOutline(this IPath path, float width, ReadOnlySpan<float> pattern)
38+
public static IPath GenerateOutline(this IPath path, float width, ReadOnlySpan<float> pattern)
3939
=> path.GenerateOutline(width, pattern, false);
4040

4141
/// <summary>
@@ -46,7 +46,7 @@ public static ComplexPolygon GenerateOutline(this IPath path, float width, ReadO
4646
/// <param name="pattern">The pattern made of multiples of the width.</param>
4747
/// <param name="startOff">Weather the first item in the pattern is on or off.</param>
4848
/// <returns>A new path representing the outline.</returns>
49-
public static ComplexPolygon GenerateOutline(this IPath path, float width, float[] pattern, bool startOff)
49+
public static IPath GenerateOutline(this IPath path, float width, float[] pattern, bool startOff)
5050
=> path.GenerateOutline(width, new ReadOnlySpan<float>(pattern), startOff);
5151

5252
/// <summary>
@@ -57,7 +57,7 @@ public static ComplexPolygon GenerateOutline(this IPath path, float width, float
5757
/// <param name="pattern">The pattern made of multiples of the width.</param>
5858
/// <param name="startOff">Weather the first item in the pattern is on or off.</param>
5959
/// <returns>A new path representing the outline.</returns>
60-
public static ComplexPolygon GenerateOutline(this IPath path, float width, ReadOnlySpan<float> pattern, bool startOff)
60+
public static IPath GenerateOutline(this IPath path, float width, ReadOnlySpan<float> pattern, bool startOff)
6161
=> GenerateOutline(path, width, pattern, startOff, JointStyle.Square, EndCapStyle.Butt);
6262

6363
/// <summary>
@@ -70,7 +70,7 @@ public static ComplexPolygon GenerateOutline(this IPath path, float width, ReadO
7070
/// <param name="jointStyle">The style to render the joints.</param>
7171
/// <param name="patternSectionCapStyle">The style to render between sections of the specified pattern.</param>
7272
/// <returns>A new path representing the outline.</returns>
73-
public static ComplexPolygon GenerateOutline(this IPath path, float width, ReadOnlySpan<float> pattern, bool startOff, JointStyle jointStyle = JointStyle.Square, EndCapStyle patternSectionCapStyle = EndCapStyle.Butt)
73+
public static IPath GenerateOutline(this IPath path, float width, ReadOnlySpan<float> pattern, bool startOff, JointStyle jointStyle = JointStyle.Square, EndCapStyle patternSectionCapStyle = EndCapStyle.Butt)
7474
{
7575
if (pattern.Length < 2)
7676
{
@@ -177,7 +177,7 @@ public static ComplexPolygon GenerateOutline(this IPath path, float width, ReadO
177177
/// <param name="path">the path to outline</param>
178178
/// <param name="width">The final width outline</param>
179179
/// <returns>A new path representing the outline.</returns>
180-
public static ComplexPolygon GenerateOutline(this IPath path, float width) => GenerateOutline(path, width, JointStyle.Square, EndCapStyle.Butt);
180+
public static IPath GenerateOutline(this IPath path, float width) => GenerateOutline(path, width, JointStyle.Square, EndCapStyle.Butt);
181181

182182
/// <summary>
183183
/// Generates a solid outline of the path.
@@ -187,7 +187,7 @@ public static ComplexPolygon GenerateOutline(this IPath path, float width, ReadO
187187
/// <param name="jointStyle">The style to render the joints.</param>
188188
/// <param name="endCapStyle">The style to render the end caps of open paths (ignored on closed paths).</param>
189189
/// <returns>A new path representing the outline.</returns>
190-
public static ComplexPolygon GenerateOutline(this IPath path, float width, JointStyle jointStyle = JointStyle.Square, EndCapStyle endCapStyle = EndCapStyle.Square)
190+
public static IPath GenerateOutline(this IPath path, float width, JointStyle jointStyle = JointStyle.Square, EndCapStyle endCapStyle = EndCapStyle.Square)
191191
{
192192
var offset = new ClipperOffset()
193193
{

tests/ImageSharp.Drawing.Tests/Drawing/DrawComplexPolygonTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void DrawComplexPolygon<TPixel>(TestImageProvider<TPixel> provider, bool
3030
overlap ? new Vector2(130, 40) : new Vector2(93, 85),
3131
new Vector2(65, 137)));
3232

33-
ComplexPolygon clipped = simplePath.Clip(hole1);
33+
IPath clipped = simplePath.Clip(hole1);
3434

3535
Rgba32 colorRgba = Color.White;
3636
if (transparent)

tests/ImageSharp.Drawing.Tests/Drawing/DrawingRobustnessTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void CompareToSkiaResults_StarCircle(TestImageProvider<Rgba32> provider)
3636
{
3737
var circle = new EllipsePolygon(32, 32, 30);
3838
var star = new Star(32, 32, 7, 10, 27);
39-
ComplexPolygon shape = circle.Clip(star);
39+
IPath shape = circle.Clip(star);
4040

4141
CompareToSkiaResultsImpl(provider, shape);
4242
}

tests/ImageSharp.Drawing.Tests/Drawing/FillComplexPolygonTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void ComplexPolygon_SolidFill<TPixel>(TestImageProvider<TPixel> provider,
2929
overlap ? new Vector2(130, 40) : new Vector2(93, 85),
3030
new Vector2(65, 137)));
3131

32-
ComplexPolygon clipped = simplePath.Clip(hole1);
32+
IPath clipped = simplePath.Clip(hole1);
3333

3434
Rgba32 colorRgba = Color.HotPink;
3535
if (transparent)

tests/ImageSharp.Drawing.Tests/Drawing/FillPolygonTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ public void FillPolygon_Complex<TPixel>(TestImageProvider<TPixel> provider, bool
135135
},
136136
testOutputDetails: $"Reverse({reverse})_IntersectionRule({intersectionRule})",
137137
comparer: ImageComparer.TolerantPercentage(0.01f),
138-
appendSourceFileOrDescription: false,
139-
appendPixelTypeToFileName: false);
138+
appendPixelTypeToFileName: false,
139+
appendSourceFileOrDescription: false);
140140
}
141141

142142
[Theory]
@@ -165,8 +165,8 @@ public void FillPolygon_Concave<TPixel>(TestImageProvider<TPixel> provider, bool
165165
c => c.FillPolygon(color, points),
166166
testOutputDetails: $"Reverse({reverse})",
167167
comparer: ImageComparer.TolerantPercentage(0.01f),
168-
appendSourceFileOrDescription: false,
169-
appendPixelTypeToFileName: false);
168+
appendPixelTypeToFileName: false,
169+
appendSourceFileOrDescription: false);
170170
}
171171

172172
[Theory]
@@ -175,7 +175,7 @@ public void FillPolygon_StarCircle(TestImageProvider<Rgba32> provider)
175175
{
176176
var circle = new EllipsePolygon(32, 32, 30);
177177
var star = new Star(32, 32, 7, 10, 27);
178-
ComplexPolygon shape = circle.Clip(star);
178+
IPath shape = circle.Clip(star);
179179

180180
provider.RunValidatingProcessorTest(
181181
c => c.Fill(Color.White, shape),

tests/ImageSharp.Drawing.Tests/Shapes/Issues/Issue_ClippedPaths.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public void ClippedTriangle()
2020
new PointF(93, 85),
2121
new PointF(65, 137)));
2222

23-
ComplexPolygon clippedPath = simplePath.Clip(hole1);
24-
ComplexPolygon outline = clippedPath.GenerateOutline(5, new[] { 1f });
23+
IPath clippedPath = simplePath.Clip(hole1);
24+
IPath outline = clippedPath.GenerateOutline(5, new[] { 1f });
2525

2626
Assert.False(outline.Contains(new PointF(74, 97)));
2727
}

tests/ImageSharp.Drawing.Tests/Shapes/Scan/ScanEdgeCollectionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void ComplexPolygon()
111111
Polygon hole = PolygonFactory.CreatePolygon(
112112
(2, 2), (2, 3), (3, 3), (3, 4), (4, 4), (4, 3), (3, 2));
113113

114-
ComplexPolygon polygon = contour.Clip(hole);
114+
IPath polygon = contour.Clip(hole);
115115
DebugDraw.Polygon(polygon, 1, 100);
116116

117117
this.edges = ScanEdgeCollection.Create(polygon, MemoryAllocator, 16);

0 commit comments

Comments
 (0)