22// Licensed under the Apache License, Version 2.0.
33
44using System . Collections . Generic ;
5+ using SixLabors . ImageSharp . Drawing . Processing ;
56using SixLabors . ImageSharp . Drawing . Shapes . PolygonClipper ;
67
78namespace SixLabors . ImageSharp . Drawing
@@ -25,17 +26,15 @@ public static IPath Clip(this IPath subjectPath, params IPath[] clipPaths)
2526 /// Clips the specified subject path with the provided clipping paths.
2627 /// </summary>
2728 /// <param name="subjectPath">The subject path.</param>
28- /// <param name="operation">The clipping operation.</param>
29- /// <param name="rule">The intersection rule.</param>
29+ /// <param name="options">The shape options.</param>
3030 /// <param name="clipPaths">The clipping paths.</param>
3131 /// <returns>The clipped <see cref="IPath"/>.</returns>
3232 /// <exception cref="ClipperException">Thrown when an error occured while attempting to clip the polygon.</exception>
3333 public static IPath Clip (
3434 this IPath subjectPath ,
35- ClippingOperation operation ,
36- IntersectionRule rule ,
35+ ShapeOptions options ,
3736 params IPath [ ] clipPaths )
38- => subjectPath . Clip ( operation , rule , ( IEnumerable < IPath > ) clipPaths ) ;
37+ => subjectPath . Clip ( options , ( IEnumerable < IPath > ) clipPaths ) ;
3938
4039 /// <summary>
4140 /// Clips the specified subject path with the provided clipping paths.
@@ -45,29 +44,27 @@ public static IPath Clip(
4544 /// <returns>The clipped <see cref="IPath"/>.</returns>
4645 /// <exception cref="ClipperException">Thrown when an error occured while attempting to clip the polygon.</exception>
4746 public static IPath Clip ( this IPath subjectPath , IEnumerable < IPath > clipPaths )
48- => subjectPath . Clip ( ClippingOperation . Difference , IntersectionRule . EvenOdd , clipPaths ) ;
47+ => subjectPath . Clip ( new ( ) , clipPaths ) ;
4948
5049 /// <summary>
5150 /// Clips the specified subject path with the provided clipping paths.
5251 /// </summary>
5352 /// <param name="subjectPath">The subject path.</param>
54- /// <param name="operation">The clipping operation.</param>
55- /// <param name="rule">The intersection rule.</param>
53+ /// <param name="options">The shape options.</param>
5654 /// <param name="clipPaths">The clipping paths.</param>
5755 /// <returns>The clipped <see cref="IPath"/>.</returns>
5856 /// <exception cref="ClipperException">Thrown when an error occured while attempting to clip the polygon.</exception>
5957 public static IPath Clip (
6058 this IPath subjectPath ,
61- ClippingOperation operation ,
62- IntersectionRule rule ,
59+ ShapeOptions options ,
6360 IEnumerable < IPath > clipPaths )
6461 {
6562 Clipper clipper = new ( ) ;
6663
6764 clipper . AddPath ( subjectPath , ClippingType . Subject ) ;
6865 clipper . AddPaths ( clipPaths , ClippingType . Clip ) ;
6966
70- IPath [ ] result = clipper . GenerateClippedShapes ( operation , rule ) ;
67+ IPath [ ] result = clipper . GenerateClippedShapes ( options . ClippingOperation , options . IntersectionRule ) ;
7168
7269 return new ComplexPolygon ( result ) ;
7370 }
0 commit comments