// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Drawing.PolygonGeometry; using SixLabors.ImageSharp.Drawing.Processing; using System.Collections.Generic; namespace SixLabors.ImageSharp.Drawing { /// /// Provides extension methods to that allow the clipping of shapes. /// public static class ClipPathExtensions { private static readonly ShapeOptions DefaultOptions = new(); /// /// Clips the specified subject path with the provided clipping paths. /// /// The subject path. /// The clipping paths. /// The clipped . public static IPath Clip(this IPath subjectPath, params IPath[] clipPaths) => subjectPath.Clip(DefaultOptions, clipPaths); /// /// Clips the specified subject path with the provided clipping paths. /// /// The subject path. /// The shape options. /// The clipping paths. /// The clipped . public static IPath Clip( this IPath subjectPath, ShapeOptions options, params IPath[] clipPaths) => ClippedShapeGenerator.GenerateClippedShapes(options.BooleanOperation, subjectPath, clipPaths); /// /// Clips the specified subject path with the provided clipping paths. /// /// The subject path. /// The clipping paths. /// The clipped . public static IPath Clip(this IPath subjectPath, IEnumerable clipPaths) => subjectPath.Clip(DefaultOptions, clipPaths); /// /// Clips the specified subject path with the provided clipping paths. /// /// The subject path. /// The shape options. /// The clipping paths. /// The clipped . public static IPath Clip( this IPath subjectPath, ShapeOptions options, IEnumerable clipPaths) => ClippedShapeGenerator.GenerateClippedShapes(options.BooleanOperation, subjectPath, clipPaths); } }