/// <summary> /// Flood fills the image in the shape of the provided polygon with the specified brush. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="brush">The brush.</param> /// <param name="paths">The paths.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext Fill( this IImageProcessingContext source, IBrush brush, IPathCollection paths) => source.Fill(source.GetShapeGraphicsOptions(), brush, paths);
private void SetGraphicsOptions(IImageProcessingContext context) { context.GetGraphicsOptions().Antialias = true; context.GetShapeGraphicsOptions().GraphicsOptions.Antialias = true; }
Draw(this IImageProcessingContext source, IPen pen, IPathCollection paths) => source.Draw(source.GetShapeGraphicsOptions(), pen, paths);
/// <summary> /// Draws the provided Points as a closed Linear Polygon with the provided Pen. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="pen">The pen.</param> /// <param name="points">The points.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext DrawPolygon( this IImageProcessingContext source, IPen pen, params PointF[] points) => source.Draw(source.GetShapeGraphicsOptions(), pen, new Polygon(new LinearLineSegment(points)));
/// <summary> /// Flood fills the image with in the region with the specified brush. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="brush">The brush.</param> /// <param name="region">The region.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, Region region) => source.Fill(source.GetShapeGraphicsOptions(), brush, region);
/// <summary> /// Draws the outline of the rectangle with the provided pen. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="pen">The pen.</param> /// <param name="shape">The shape.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, RectangleF shape) => source.Draw(source.GetShapeGraphicsOptions(), pen, shape);
/// <summary> /// Draws the outline of the polygon with the provided pen. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="pen">The pen.</param> /// <param name="path">The path.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPath path) => source.Draw(source.GetShapeGraphicsOptions(), pen, path);
/// <summary> /// Flood fills the image in the shape of the provided polygon with the specified brush. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="brush">The brush.</param> /// <param name="path">The path.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext Fill( this IImageProcessingContext source, IBrush brush, Action <PathBuilder> path) => source.Fill(source.GetShapeGraphicsOptions(), brush, path);
/// <summary> /// Flood fills the image in the shape of the provided polygon with the specified brush without any blending. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="brush">The brush.</param> /// <param name="path">The path.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext Clear(this IImageProcessingContext source, IBrush brush, IPath path) => source.Clear(source.GetShapeGraphicsOptions(), brush, path);
/// <summary> /// Clones the image then proceeds to apply processors to it before takign the output of that process and filling the vector with the result. /// </summary> /// <param name="path">The target path to fill</param> /// <param name="innerProcessingOperations">the set of procssing operations to apply inside the path</param> /// <returns></returns> public static IImageProcessingContext ProcessInsideShape(this IImageProcessingContext context, IPath path, Action <IImageProcessingContext> innerProcessingOperations) { return(context.ApplyProcessor(new RecursiveImageProcessor(context.GetShapeGraphicsOptions(), path, innerProcessingOperations))); }