/// <summary> /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="brush">The brush.</param> /// <param name="thickness">The thickness.</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, ShapeGraphicsOptions options, IBrush brush, float thickness, params PointF[] points) => source.DrawPolygon(options, new Pen(brush, thickness), points);
/// <summary> /// Draws the outline of the polygon with the provided brush at the provided thickness. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="color">The color.</param> /// <param name="thickness">The thickness.</param> /// <param name="path">The path.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext Draw( this IImageProcessingContext source, ShapeGraphicsOptions options, Color color, float thickness, IPath path) => source.Draw(options, new SolidBrush(color), thickness, path);
/// <summary> /// Draws the outline of the rectangle with the provided brush at the provided thickness. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="brush">The brush.</param> /// <param name="thickness">The thickness.</param> /// <param name="shape">The shape.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext Draw( this IImageProcessingContext source, ShapeGraphicsOptions options, IBrush brush, float thickness, RectangleF shape) => source.Draw(options, new Pen(brush, thickness), shape);
/// <summary> /// Draws the outline of the rectangle with the provided brush at the provided thickness. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="color">The color.</param> /// <param name="thickness">The thickness.</param> /// <param name="shape">The shape.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext Draw( this IImageProcessingContext source, ShapeGraphicsOptions options, Color color, float thickness, RectangleF shape) => source.Draw(options, new SolidBrush(color), thickness, shape);
/// <summary> /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="brush">The brush.</param> /// <param name="thickness">The thickness.</param> /// <param name="points">The points.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext DrawLines( this IImageProcessingContext source, ShapeGraphicsOptions options, IBrush brush, float thickness, params PointF[] points) => source.Draw(options, new Pen(brush, thickness), new Path(new LinearLineSegment(points)));
/// <summary> /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="color">The color.</param> /// <param name="thickness">The thickness.</param> /// <param name="points">The points.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns>> public static IImageProcessingContext DrawLines( this IImageProcessingContext source, ShapeGraphicsOptions options, Color color, float thickness, params PointF[] points) => source.DrawLines(options, new SolidBrush(color), thickness, points);
/// <summary> /// Draws the outline of the polygon with the provided brush at the provided thickness. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="brush">The brush.</param> /// <param name="thickness">The thickness.</param> /// <param name="path">The shape.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext Draw( this IImageProcessingContext source, ShapeGraphicsOptions options, IBrush brush, float thickness, IPath path) => source.Draw(options, new Pen(brush, thickness), path);
/// <summary> /// Clones the shape graphic options and applies changes required to force clearing. /// </summary> /// <param name="shapeOptions">The options to clone</param> /// <returns>A clone of shapeOptions with ColorBlendingMode, AlphaCompositionMode, and BlendPercentage set</returns> internal static ShapeGraphicsOptions CloneForClearOperation(this ShapeGraphicsOptions shapeOptions) { var options = shapeOptions.GraphicsOptions.DeepClone(); options.ColorBlendingMode = PixelFormats.PixelColorBlendingMode.Normal; options.AlphaCompositionMode = PixelFormats.PixelAlphaCompositionMode.Src; options.BlendPercentage = 1; return(new ShapeGraphicsOptions(options, shapeOptions.ShapeOptions)); }
/// <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="options">The graphics options.</param> /// <param name="brush">The brush.</param> /// <param name="path">The shape.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext Fill( this IImageProcessingContext source, ShapeGraphicsOptions options, IBrush brush, Action <PathBuilder> path) { var pb = new PathBuilder(); path(pb); return(source.Fill(options, brush, pb.Build())); }
/// <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="options">The graphics options.</param> /// <param name="brush">The brush.</param> /// <param name="paths">The shapes.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext Fill( this IImageProcessingContext source, ShapeGraphicsOptions options, IBrush brush, IPathCollection paths) { foreach (IPath s in paths) { source.Fill(options, brush, s); } return(source); }
/// <summary> /// Draws the outline of the polygon with the provided pen. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="pen">The pen.</param> /// <param name="paths">The paths.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext Draw( this IImageProcessingContext source, ShapeGraphicsOptions options, IPen pen, IPathCollection paths) { foreach (IPath path in paths) { source.Draw(options, pen, path); } return(source); }
/// <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="options">The options.</param> /// <param name="color">The color.</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, ShapeGraphicsOptions options, Color color, IPath path) => source.Clear(options, new SolidBrush(color), 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="options">The graphics options.</param> /// <param name="brush">The brush.</param> /// <param name="path">The shape.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext Fill( this IImageProcessingContext source, ShapeGraphicsOptions options, IBrush brush, IPath path) => source.ApplyProcessor(new FillPathProcessor(options, brush, path));
/// <summary> /// Draws the outline of the polygon with the provided pen. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</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, ShapeGraphicsOptions options, IPen pen, IPath path) => source.Fill(options, pen.StrokeFill, new ShapePath(path, pen));
/// <summary> /// Flood fills the image in the shape of a Linear polygon described by the points /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="color">The color.</param> /// <param name="points">The points.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext FillPolygon( this IImageProcessingContext source, ShapeGraphicsOptions options, Color color, params PointF[] points) => source.Fill(options, new SolidBrush(color), new Polygon(new LinearLineSegment(points)));
/// <summary> /// Flood fills the image in the shape of a Linear polygon described by the points /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="brush">The brush.</param> /// <param name="points">The points.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext FillPolygon( this IImageProcessingContext source, ShapeGraphicsOptions options, IBrush brush, params PointF[] points) => source.Fill(options, brush, new Polygon(new LinearLineSegment(points)));
/// <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="options">The graphics options.</param> /// <param name="brush">The brush.</param> /// <param name="path">The shape.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext Fill( this IImageProcessingContext source, ShapeGraphicsOptions options, IBrush brush, IPath path) => source.Fill(options, brush, new ShapeRegion(path));
/// <summary> /// Draws the provided Points as an open Linear path with the supplied pen /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="pen">The pen.</param> /// <param name="points">The points.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext DrawLines( this IImageProcessingContext source, ShapeGraphicsOptions options, IPen pen, params PointF[] points) => source.Draw(options, pen, new Path(new LinearLineSegment(points)));
/// <summary> /// Draws the outline of the rectangle with the provided pen. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</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, ShapeGraphicsOptions options, IPen pen, RectangleF shape) => source.Draw(options, pen, new RectangularPolygon(shape.X, shape.Y, shape.Width, shape.Height));
/// <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="options">The graphics options.</param> /// <param name="brush">The brush.</param> /// <param name="path">The shape.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext Clear( this IImageProcessingContext source, ShapeGraphicsOptions options, IBrush brush, IPath path) => source.Fill(options.CloneForClearOperation(), brush, path);
/// <summary> /// Draws the outline of the polygon with the provided pen. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</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, ShapeGraphicsOptions options, IPen pen, IPath path) => source.ApplyProcessor(new DrawPathProcessor(options, pen, path));
/// <summary> /// Flood fills the image in the shape of the provided rectangle with the specified brush without any blending. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="brush">The brush.</param> /// <param name="shape">The shape.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext Clear( this IImageProcessingContext source, ShapeGraphicsOptions options, IBrush brush, RectangleF shape) => source.Clear(options, brush, new RectangularPolygon(shape.X, shape.Y, shape.Width, shape.Height));
/// <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="options">The options.</param> /// <param name="color">The color.</param> /// <param name="path">The path.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext Fill( this IImageProcessingContext source, ShapeGraphicsOptions options, Color color, Action <PathBuilder> path) => source.Fill(options, new SolidBrush(color), path);
/// <summary> /// Flood fills the image in the shape of the provided rectangle with the specified brush without any blending. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="color">The color.</param> /// <param name="shape">The shape.</param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext Clear( this IImageProcessingContext source, ShapeGraphicsOptions options, Color color, RectangleF shape) => source.Clear(options, new SolidBrush(color), shape);
/// <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="options">The graphics options.</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, ShapeGraphicsOptions options, IBrush brush, Region region) => source.ApplyProcessor(new FillRegionProcessor(options, brush, region));
/// <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="options">The options.</param> /// <param name="color">The color.</param> /// <param name="paths">The paths.</param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext Fill( this IImageProcessingContext source, ShapeGraphicsOptions options, Color color, IPathCollection paths) => source.Fill(options, new SolidBrush(color), paths);
/// <summary> /// Flood fills the image with in the region with the specified color. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="options">The options.</param> /// <param name="color">The color.</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, ShapeGraphicsOptions options, Color color, Region region) => source.Fill(options, new SolidBrush(color), region);