diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawBezierExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/DrawBezierExtensions.cs index 8f075d5c2..72bd76fa6 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawBezierExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/DrawBezierExtensions.cs @@ -19,14 +19,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The brush. /// The thickness. /// The points. - /// The options. /// The . - public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, float thickness, params PointF[] points) where TPixel : struct, IPixel - => source.Draw(new Pen(brush, thickness), new Path(new CubicBezierLineSegment(points)), options); + => source.Draw(options, new Pen(brush, thickness), new Path(new CubicBezierLineSegment(points))); /// /// Draws the provided points as an open Bezier path at the provided thickness with the supplied brush @@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The thickness. /// The points. /// The . - public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points) + public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IBrush brush, float thickness, params PointF[] points) where TPixel : struct, IPixel => source.Draw(new Pen(brush, thickness), new Path(new CubicBezierLineSegment(points))); @@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The thickness. /// The points. /// The . - public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points) + public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, TPixel color, float thickness, params PointF[] points) where TPixel : struct, IPixel => source.DrawBeziers(new SolidBrush(color), thickness, points); @@ -59,27 +59,27 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The color. /// The thickness. /// The points. - /// The options. /// The . - public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, GraphicsOptions options, TPixel color, float thickness, params PointF[] points) where TPixel : struct, IPixel - => source.DrawBeziers(new SolidBrush(color), thickness, points, options); + => source.DrawBeziers(options, new SolidBrush(color), thickness, points); /// /// Draws the provided points as an open Bezier path with the supplied pen /// /// The type of the color. /// The image this method extends. + /// The options. /// The pen. /// The points. - /// The options. /// The . - public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IPen pen, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, GraphicsOptions options, IPen pen, params PointF[] points) where TPixel : struct, IPixel - => source.Draw(pen, new Path(new CubicBezierLineSegment(points)), options); + => source.Draw(options, pen, new Path(new CubicBezierLineSegment(points))); /// /// Draws the provided points as an open Bezier path with the supplied pen @@ -89,7 +89,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The pen. /// The points. /// The . - public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IPen pen, PointF[] points) + public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IPen pen, params PointF[] points) where TPixel : struct, IPixel => source.Draw(pen, new Path(new CubicBezierLineSegment(points))); } diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs index 618768206..83e1b90f5 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs @@ -20,7 +20,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The image to blend with the currently processing image. /// The opacity of the image to blend. Must be between 0 and 1. /// The . - public static IImageProcessingContext Blend(this IImageProcessingContext source, Image image, float opacity) + public static IImageProcessingContext DrawImage(this IImageProcessingContext source, Image image, float opacity) where TPixel : struct, IPixel => source.ApplyProcessor(new DrawImageProcessor(image, opacity)); @@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The blending mode. /// The opacity of the image to blend. Must be between 0 and 1. /// The . - public static IImageProcessingContext Blend(this IImageProcessingContext source, Image image, PixelBlenderMode blender, float opacity) + public static IImageProcessingContext DrawImage(this IImageProcessingContext source, Image image, PixelBlenderMode blender, float opacity) where TPixel : struct, IPixel => source.ApplyProcessor(new DrawImageProcessor(image, opacity, blender)); @@ -42,14 +42,12 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The pixel format. /// The image this method extends. - /// The image to blend with the currently processing image. /// The options, including the blending type and blending amount. + /// The image to blend with the currently processing image. /// The . - public static IImageProcessingContext Blend(this IImageProcessingContext source, Image image, GraphicsOptions options) + public static IImageProcessingContext DrawImage(this IImageProcessingContext source, GraphicsOptions options, Image image) where TPixel : struct, IPixel - { - return source.ApplyProcessor(new DrawImageProcessor(image, options)); - } + => source.ApplyProcessor(new DrawImageProcessor(image, options)); /// /// Draws the given image together with the current one by blending their pixels. @@ -82,12 +80,12 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// Draws the given image together with the current one by blending their pixels. /// /// The image this method extends. + /// The options containing the blend mode and opacity. /// The image to blend with the currently processing image. /// The pixel format. /// The location to draw the blended image. - /// The options containing the blend mode and opacity. /// The . - public static IImageProcessingContext DrawImage(this IImageProcessingContext source, Image image, Point location, GraphicsOptions options) + public static IImageProcessingContext DrawImage(this IImageProcessingContext source, GraphicsOptions options, Image image, Point location) where TPixel : struct, IPixel => source.ApplyProcessor(new DrawImageProcessor(image, location, options)); } diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawLineExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/DrawLineExtensions.cs index 9d2ea0c1d..981a07e13 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawLineExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/DrawLineExtensions.cs @@ -19,14 +19,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The brush. /// The thickness. /// The points. - /// The options. /// The . - public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawLines(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, float thickness, params PointF[] points) where TPixel : struct, IPixel - => source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points)), options); + => source.Draw(options, new Pen(brush, thickness), new Path(new LinearLineSegment(points))); /// /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush @@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The thickness. /// The points. /// The . - public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points) + public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IBrush brush, float thickness, params PointF[] points) where TPixel : struct, IPixel => source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points))); @@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The thickness. /// The points. /// The . - public static IImageProcessingContext DrawLines(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points) + public static IImageProcessingContext DrawLines(this IImageProcessingContext source, TPixel color, float thickness, params PointF[] points) where TPixel : struct, IPixel => source.DrawLines(new SolidBrush(color), thickness, points); @@ -59,27 +59,27 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The color. /// The thickness. /// The points. - /// The options. /// The .> - public static IImageProcessingContext DrawLines(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawLines(this IImageProcessingContext source, GraphicsOptions options, TPixel color, float thickness, params PointF[] points) where TPixel : struct, IPixel - => source.DrawLines(new SolidBrush(color), thickness, points, options); + => source.DrawLines(options, new SolidBrush(color), thickness, points); /// /// Draws the provided Points as an open Linear path with the supplied pen /// /// The type of the color. /// The image this method extends. + /// The options. /// The pen. /// The points. - /// The options. /// The . - public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IPen pen, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawLines(this IImageProcessingContext source, GraphicsOptions options, IPen pen, params PointF[] points) where TPixel : struct, IPixel - => source.Draw(pen, new Path(new LinearLineSegment(points)), options); + => source.Draw(options, pen, new Path(new LinearLineSegment(points))); /// /// Draws the provided Points as an open Linear path with the supplied pen @@ -89,8 +89,8 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The pen. /// The points. /// The . - public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IPen pen, PointF[] points) + public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IPen pen, params PointF[] points) where TPixel : struct, IPixel => source.Draw(pen, new Path(new LinearLineSegment(points))); } -} +} \ No newline at end of file diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawPathCollectionExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/DrawPathCollectionExtensions.cs index d148638ae..eca3805bd 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawPathCollectionExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/DrawPathCollectionExtensions.cs @@ -18,16 +18,16 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The pen. /// The paths. - /// The options. /// The . - public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPathCollection paths, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, GraphicsOptions options, IPen pen, IPathCollection paths) where TPixel : struct, IPixel { foreach (IPath path in paths) { - source.Draw(pen, path, options); + source.Draw(options, pen, path); } return source; @@ -43,21 +43,21 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The . public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPathCollection paths) where TPixel : struct, IPixel - => source.Draw(pen, paths, GraphicsOptions.Default); + => source.Draw(GraphicsOptions.Default, pen, paths); /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// /// The type of the color. /// The image this method extends. + /// The options. /// The brush. /// The thickness. /// The shapes. - /// The options. /// The . - public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, IPathCollection paths, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, float thickness, IPathCollection paths) where TPixel : struct, IPixel - => source.Draw(new Pen(brush, thickness), paths, options); + => source.Draw(options, new Pen(brush, thickness), paths); /// /// Draws the outline of the polygon with the provided brush at the provided thickness. @@ -77,14 +77,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The color. /// The thickness. /// The paths. - /// The options. /// The . - public static IImageProcessingContext Draw(this IImageProcessingContext source, TPixel color, float thickness, IPathCollection paths, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, GraphicsOptions options, TPixel color, float thickness, IPathCollection paths) where TPixel : struct, IPixel - => source.Draw(new SolidBrush(color), thickness, paths, options); + => source.Draw(options, new SolidBrush(color), thickness, paths); /// /// Draws the outline of the polygon with the provided brush at the provided thickness. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawPathExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/DrawPathExtensions.cs index a795ee295..a15412a45 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawPathExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/DrawPathExtensions.cs @@ -19,13 +19,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The pen. /// The path. - /// The options. /// The . - public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPath path, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, GraphicsOptions options, IPen pen, IPath path) where TPixel : struct, IPixel - => source.Fill(pen.StrokeFill, new ShapePath(path, pen), options); + => source.Fill(options, pen.StrokeFill, new ShapePath(path, pen)); /// /// Draws the outline of the polygon with the provided pen. @@ -37,21 +37,21 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The . public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPath path) where TPixel : struct, IPixel - => source.Draw(pen, path, GraphicsOptions.Default); + => source.Draw(GraphicsOptions.Default, pen, path); /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// /// The type of the color. /// The image this method extends. + /// The options. /// The brush. /// The thickness. /// The shape. - /// The options. /// The . - public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, IPath path, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, float thickness, IPath path) where TPixel : struct, IPixel - => source.Draw(new Pen(brush, thickness), path, options); + => source.Draw(options, new Pen(brush, thickness), path); /// /// Draws the outline of the polygon with the provided brush at the provided thickness. @@ -71,14 +71,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The color. /// The thickness. /// The path. - /// The options. /// The . - public static IImageProcessingContext Draw(this IImageProcessingContext source, TPixel color, float thickness, IPath path, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, GraphicsOptions options, TPixel color, float thickness, IPath path) where TPixel : struct, IPixel - => source.Draw(new SolidBrush(color), thickness, path, options); + => source.Draw(options, new SolidBrush(color), thickness, path); /// /// Draws the outline of the polygon with the provided brush at the provided thickness. @@ -93,4 +93,4 @@ namespace SixLabors.ImageSharp.Processing.Drawing where TPixel : struct, IPixel => source.Draw(new SolidBrush(color), thickness, path); } -} +} \ No newline at end of file diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawPolygonExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/DrawPolygonExtensions.cs index 833b616f8..9f8d74f00 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawPolygonExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/DrawPolygonExtensions.cs @@ -19,14 +19,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The brush. /// The thickness. /// The points. - /// The options. /// The . - public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, float thickness, params PointF[] points) where TPixel : struct, IPixel - => source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points)), options); + => source.Draw(options, new Pen(brush, thickness), new Polygon(new LinearLineSegment(points))); /// /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness. @@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The thickness. /// The points. /// The . - public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points) + public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, IBrush brush, float thickness, params PointF[] points) where TPixel : struct, IPixel => source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points))); @@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The thickness. /// The points. /// The . - public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points) + public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, TPixel color, float thickness, params PointF[] points) where TPixel : struct, IPixel => source.DrawPolygon(new SolidBrush(color), thickness, points); @@ -59,14 +59,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The color. /// The thickness. /// The points. - /// The options. /// The . - public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, GraphicsOptions options, TPixel color, float thickness, params PointF[] points) where TPixel : struct, IPixel - => source.DrawPolygon(new SolidBrush(color), thickness, points, options); + => source.DrawPolygon(options, new SolidBrush(color), thickness, points); /// /// Draws the provided Points as a closed Linear Polygon with the provided Pen. @@ -76,21 +76,21 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The pen. /// The points. /// The . - public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, IPen pen, PointF[] points) + public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, IPen pen, params PointF[] points) where TPixel : struct, IPixel - => source.Draw(pen, new Polygon(new LinearLineSegment(points)), GraphicsOptions.Default); + => source.Draw(GraphicsOptions.Default, pen, new Polygon(new LinearLineSegment(points))); /// /// Draws the provided Points as a closed Linear Polygon with the provided Pen. /// /// The type of the color. /// The image this method extends. + /// The options. /// The pen. /// The points. - /// The options. /// The . - public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, IPen pen, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, GraphicsOptions options, IPen pen, params PointF[] points) where TPixel : struct, IPixel - => source.Draw(pen, new Polygon(new LinearLineSegment(points)), options); + => source.Draw(options, pen, new Polygon(new LinearLineSegment(points))); } } \ No newline at end of file diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawRectangleExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/DrawRectangleExtensions.cs index 3d6702be9..03be4de47 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawRectangleExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/DrawRectangleExtensions.cs @@ -19,13 +19,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The pen. /// The shape. - /// The options. /// The . - public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, RectangleF shape, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, GraphicsOptions options, IPen pen, RectangleF shape) where TPixel : struct, IPixel - => source.Draw(pen, new RectangularePolygon(shape.X, shape.Y, shape.Width, shape.Height), options); + => source.Draw(options, pen, new RectangularePolygon(shape.X, shape.Y, shape.Width, shape.Height)); /// /// Draws the outline of the rectangle with the provided pen. @@ -37,21 +37,21 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The . public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, RectangleF shape) where TPixel : struct, IPixel - => source.Draw(pen, shape, GraphicsOptions.Default); + => source.Draw(GraphicsOptions.Default, pen, shape); /// /// Draws the outline of the rectangle with the provided brush at the provided thickness. /// /// The type of the color. /// The image this method extends. + /// The options. /// The brush. /// The thickness. /// The shape. - /// The options. /// The . - public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, RectangleF shape, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, float thickness, RectangleF shape) where TPixel : struct, IPixel - => source.Draw(new Pen(brush, thickness), shape, options); + => source.Draw(options, new Pen(brush, thickness), shape); /// /// Draws the outline of the rectangle with the provided brush at the provided thickness. @@ -71,14 +71,14 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The color. /// The thickness. /// The shape. - /// The options. /// The . - public static IImageProcessingContext Draw(this IImageProcessingContext source, TPixel color, float thickness, RectangleF shape, GraphicsOptions options) + public static IImageProcessingContext Draw(this IImageProcessingContext source, GraphicsOptions options, TPixel color, float thickness, RectangleF shape) where TPixel : struct, IPixel - => source.Draw(new SolidBrush(color), thickness, shape, options); + => source.Draw(options, new SolidBrush(color), thickness, shape); /// /// Draws the outline of the rectangle with the provided brush at the provided thickness. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/FillPathBuilderExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/FillPathBuilderExtensions.cs index 975b5db4c..921209d2e 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/FillPathBuilderExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/FillPathBuilderExtensions.cs @@ -18,17 +18,17 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The graphics options. /// The brush. /// The shape. - /// The graphics options. /// The . - public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, Action path, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, Action path) where TPixel : struct, IPixel { var pb = new PathBuilder(); path(pb); - return source.Fill(brush, pb.Build(), options); + return source.Fill(options, brush, pb.Build()); } /// @@ -41,20 +41,20 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The . public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, Action path) where TPixel : struct, IPixel - => source.Fill(brush, path, GraphicsOptions.Default); + => source.Fill(GraphicsOptions.Default, brush, path); /// /// Flood fills the image in the shape of the provided polygon with the specified brush. /// /// The type of the color. /// The image this method extends. + /// The options. /// The color. /// The path. - /// The options. /// The . - public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, Action path, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, TPixel color, Action path) where TPixel : struct, IPixel - => source.Fill(new SolidBrush(color), path, options); + => source.Fill(options, new SolidBrush(color), path); /// /// Flood fills the image in the shape of the provided polygon with the specified brush. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/FillPathCollectionExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/FillPathCollectionExtensions.cs index be472d373..71474dceb 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/FillPathCollectionExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/FillPathCollectionExtensions.cs @@ -17,16 +17,16 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The graphics options. /// The brush. /// The shapes. - /// The graphics options. /// The . - public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, IPathCollection paths, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, IPathCollection paths) where TPixel : struct, IPixel { foreach (IPath s in paths) { - source.Fill(brush, s, options); + source.Fill(options, brush, s); } return source; @@ -42,20 +42,20 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The . public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, IPathCollection paths) where TPixel : struct, IPixel - => source.Fill(brush, paths, GraphicsOptions.Default); + => source.Fill(GraphicsOptions.Default, brush, paths); /// /// Flood fills the image in the shape of the provided polygon with the specified brush. /// /// The type of the color. /// The image this method extends. + /// The options. /// The color. /// The paths. - /// The options. /// The . - public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, IPathCollection paths, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, TPixel color, IPathCollection paths) where TPixel : struct, IPixel - => source.Fill(new SolidBrush(color), paths, options); + => source.Fill(options, new SolidBrush(color), paths); /// /// Flood fills the image in the shape of the provided polygon with the specified brush. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/FillPathExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/FillPathExtensions.cs index 9b288c8be..36eef8d63 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/FillPathExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/FillPathExtensions.cs @@ -18,13 +18,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The graphics options. /// The brush. /// The shape. - /// The graphics options. /// The . - public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, IPath path, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, IPath path) where TPixel : struct, IPixel - => source.Fill(brush, new ShapeRegion(path), options); + => source.Fill(options, brush, new ShapeRegion(path)); /// /// Flood fills the image in the shape of the provided polygon with the specified brush. @@ -36,20 +36,20 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The . public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, IPath path) where TPixel : struct, IPixel - => source.Fill(brush, new ShapeRegion(path), GraphicsOptions.Default); + => source.Fill(GraphicsOptions.Default, brush, new ShapeRegion(path)); /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// /// The type of the color. /// The image this method extends. + /// The options. /// The color. /// The path. - /// The options. /// The . - public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, IPath path, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, TPixel color, IPath path) where TPixel : struct, IPixel - => source.Fill(new SolidBrush(color), path, options); + => source.Fill(options, new SolidBrush(color), path); /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/FillPolygonExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/FillPolygonExtensions.cs index 692f88337..3b80dd0f4 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/FillPolygonExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/FillPolygonExtensions.cs @@ -18,13 +18,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The brush. /// The points. - /// The options. /// The . - public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, IBrush brush, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, params PointF[] points) where TPixel : struct, IPixel - => source.Fill(brush, new Polygon(new LinearLineSegment(points)), options); + => source.Fill(options, brush, new Polygon(new LinearLineSegment(points))); /// /// Flood fills the image in the shape of a Linear polygon described by the points @@ -34,7 +34,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The brush. /// The points. /// The . - public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, IBrush brush, PointF[] points) + public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, IBrush brush, params PointF[] points) where TPixel : struct, IPixel => source.Fill(brush, new Polygon(new LinearLineSegment(points))); @@ -43,13 +43,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The color. /// The points. - /// The options. /// The . - public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, TPixel color, PointF[] points, GraphicsOptions options) + public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, GraphicsOptions options, TPixel color, params PointF[] points) where TPixel : struct, IPixel - => source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points)), options); + => source.Fill(options, new SolidBrush(color), new Polygon(new LinearLineSegment(points))); /// /// Flood fills the image in the shape of a Linear polygon described by the points @@ -59,7 +59,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The color. /// The points. /// The . - public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, TPixel color, PointF[] points) + public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, TPixel color, params PointF[] points) where TPixel : struct, IPixel => source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points))); } diff --git a/src/ImageSharp.Drawing/Processing/Drawing/FillRectangleExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/FillRectangleExtensions.cs index eff333a4f..234b94df5 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/FillRectangleExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/FillRectangleExtensions.cs @@ -18,13 +18,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The brush. /// The shape. - /// The options. /// The . - public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, RectangleF shape, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, RectangleF shape) where TPixel : struct, IPixel - => source.Fill(brush, new RectangularePolygon(shape.X, shape.Y, shape.Width, shape.Height), options); + => source.Fill(options, brush, new RectangularePolygon(shape.X, shape.Y, shape.Width, shape.Height)); /// /// Flood fills the image in the shape of the provided rectangle with the specified brush. @@ -43,13 +43,13 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The options. /// The color. /// The shape. - /// The options. /// The . - public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, RectangleF shape, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, TPixel color, RectangleF shape) where TPixel : struct, IPixel - => source.Fill(new SolidBrush(color), shape, options); + => source.Fill(options, new SolidBrush(color), shape); /// /// Flood fills the image in the shape of the provided rectangle with the specified brush. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/FillRegionExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/FillRegionExtensions.cs index d3e223222..997dba22e 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/FillRegionExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/FillRegionExtensions.cs @@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The . public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush) where TPixel : struct, IPixel - => source.Fill(brush, GraphicsOptions.Default); + => source.Fill(GraphicsOptions.Default, brush); /// /// Flood fills the image with the specified color. @@ -45,20 +45,20 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The . public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, Region region) where TPixel : struct, IPixel - => source.Fill(brush, region, GraphicsOptions.Default); + => source.Fill(GraphicsOptions.Default, brush, region); /// /// Flood fills the image with in the region with the specified color. /// /// The type of the color. /// The image this method extends. + /// The options. /// The color. /// The region. - /// The options. /// The . - public static IImageProcessingContext Fill(this IImageProcessingContext source, TPixel color, Region region, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, TPixel color, Region region) where TPixel : struct, IPixel - => source.Fill(new SolidBrush(color), region, options); + => source.Fill(options, new SolidBrush(color), region); /// /// Flood fills the image with in the region with the specified color. @@ -77,11 +77,11 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. + /// The graphics options. /// The brush. /// The region. - /// The graphics options. /// The . - public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, Region region, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, Region region) where TPixel : struct, IPixel => source.ApplyProcessor(new FillRegionProcessor(brush, region, options)); @@ -90,10 +90,10 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// /// The type of the color. /// The image this method extends. - /// The details how to fill the region of interest. /// The graphics options. + /// The details how to fill the region of interest. /// The . - public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, GraphicsOptions options) + public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, IBrush brush) where TPixel : struct, IPixel => source.ApplyProcessor(new FillProcessor(brush, options)); } diff --git a/src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.Path.cs b/src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.Path.cs index 84bf26c51..9de73afcc 100644 --- a/src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.Path.cs +++ b/src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.Path.cs @@ -29,24 +29,24 @@ namespace SixLabors.ImageSharp.Processing.Text /// public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, TPixel color, IPath path) where TPixel : struct, IPixel - => source.DrawText(text, font, color, path, TextGraphicsOptions.Default); + => source.DrawText(TextGraphicsOptions.Default, text, font, color, path); /// /// Draws the text onto the the image filled via the brush. /// /// The type of the color. /// The image this method extends. + /// The options. /// The text. /// The font. /// The color. /// The path. - /// The options. /// /// The . /// - public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, TPixel color, IPath path, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, TextGraphicsOptions options, string text, Font font, TPixel color, IPath path) where TPixel : struct, IPixel - => source.DrawText(text, font, Brushes.Solid(color), null, path, options); + => source.DrawText(options, text, font, Brushes.Solid(color), null, path); /// /// Draws the text onto the the image filled via the brush. @@ -62,24 +62,24 @@ namespace SixLabors.ImageSharp.Processing.Text /// public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, IPath path) where TPixel : struct, IPixel - => source.DrawText(text, font, brush, path, TextGraphicsOptions.Default); + => source.DrawText(TextGraphicsOptions.Default, text, font, brush, path); /// /// Draws the text onto the the image filled via the brush. /// /// The type of the color. /// The image this method extends. + /// The options. /// The text. /// The font. /// The brush. /// The path. - /// The options. /// /// The . /// - public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, IPath path, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, TextGraphicsOptions options, string text, Font font, IBrush brush, IPath path) where TPixel : struct, IPixel - => source.DrawText(text, font, brush, null, path, options); + => source.DrawText(options, text, font, brush, null, path); /// /// Draws the text onto the the image outlined via the pen. @@ -95,24 +95,24 @@ namespace SixLabors.ImageSharp.Processing.Text /// public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IPen pen, IPath path) where TPixel : struct, IPixel - => source.DrawText(text, font, pen, path, TextGraphicsOptions.Default); + => source.DrawText(TextGraphicsOptions.Default, text, font, pen, path); /// /// Draws the text onto the the image outlined via the pen. /// /// The type of the color. /// The image this method extends. + /// The options. /// The text. /// The font. /// The pen. /// The path. - /// The options. /// /// The . /// - public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IPen pen, IPath path, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, TextGraphicsOptions options, string text, Font font, IPen pen, IPath path) where TPixel : struct, IPixel - => source.DrawText(text, font, null, pen, path, options); + => source.DrawText(options, text, font, null, pen, path); /// /// Draws the text onto the the image filled via the brush then outlined via the pen. @@ -129,23 +129,23 @@ namespace SixLabors.ImageSharp.Processing.Text /// public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, IPen pen, IPath path) where TPixel : struct, IPixel - => source.DrawText(text, font, brush, pen, path, TextGraphicsOptions.Default); + => source.DrawText(TextGraphicsOptions.Default, text, font, brush, pen, path); /// /// Draws the text onto the the image filled via the brush then outlined via the pen. /// /// The type of the color. /// The image this method extends. + /// The options. /// The text. /// The font. /// The brush. /// The pen. /// The path. - /// The options. /// /// The . /// - public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, IPen pen, IPath path, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, TextGraphicsOptions options, string text, Font font, IBrush brush, IPen pen, IPath path) where TPixel : struct, IPixel { float dpiX = DefaultTextDpi; @@ -165,12 +165,12 @@ namespace SixLabors.ImageSharp.Processing.Text var pathOptions = (GraphicsOptions)options; if (brush != null) { - source.Fill(brush, glyphs, pathOptions); + source.Fill(pathOptions, brush, glyphs); } if (pen != null) { - source.Draw(pen, glyphs, pathOptions); + source.Draw(pathOptions, pen, glyphs); } return source; diff --git a/src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.cs b/src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.cs index 5731804ac..8fede9693 100644 --- a/src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.cs @@ -32,24 +32,24 @@ namespace SixLabors.ImageSharp.Processing.Text /// public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, TPixel color, PointF location) where TPixel : struct, IPixel - => source.DrawText(text, font, color, location, TextGraphicsOptions.Default); + => source.DrawText(TextGraphicsOptions.Default, text, font, color, location); /// /// Draws the text onto the the image filled via the brush. /// /// The type of the color. /// The image this method extends. + /// The options. /// The text. /// The font. /// The color. /// The location. - /// The options. /// /// The . /// - public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, TPixel color, PointF location, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, TextGraphicsOptions options, string text, Font font, TPixel color, PointF location) where TPixel : struct, IPixel - => source.DrawText(text, font, Brushes.Solid(color), null, location, options); + => source.DrawText(options, text, font, Brushes.Solid(color), null, location); /// /// Draws the text onto the the image filled via the brush. @@ -65,24 +65,24 @@ namespace SixLabors.ImageSharp.Processing.Text /// public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, PointF location) where TPixel : struct, IPixel - => source.DrawText(text, font, brush, location, TextGraphicsOptions.Default); + => source.DrawText(TextGraphicsOptions.Default, text, font, brush, location); /// /// Draws the text onto the the image filled via the brush. /// /// The type of the color. /// The image this method extends. + /// The options. /// The text. /// The font. /// The brush. /// The location. - /// The options. /// /// The . /// - public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, PointF location, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, TextGraphicsOptions options, string text, Font font, IBrush brush, PointF location) where TPixel : struct, IPixel - => source.DrawText(text, font, brush, null, location, options); + => source.DrawText(options, text, font, brush, null, location); /// /// Draws the text onto the the image outlined via the pen. @@ -98,24 +98,24 @@ namespace SixLabors.ImageSharp.Processing.Text /// public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IPen pen, PointF location) where TPixel : struct, IPixel - => source.DrawText(text, font, pen, location, TextGraphicsOptions.Default); + => source.DrawText(TextGraphicsOptions.Default, text, font, pen, location); /// /// Draws the text onto the the image outlined via the pen. /// /// The type of the color. /// The image this method extends. + /// The options. /// The text. /// The font. /// The pen. /// The location. - /// The options. /// /// The . /// - public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IPen pen, PointF location, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, TextGraphicsOptions options, string text, Font font, IPen pen, PointF location) where TPixel : struct, IPixel - => source.DrawText(text, font, null, pen, location, options); + => source.DrawText(options, text, font, null, pen, location); /// /// Draws the text onto the the image filled via the brush then outlined via the pen. @@ -132,23 +132,23 @@ namespace SixLabors.ImageSharp.Processing.Text /// public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, IPen pen, PointF location) where TPixel : struct, IPixel - => source.DrawText(text, font, brush, pen, location, TextGraphicsOptions.Default); + => source.DrawText(TextGraphicsOptions.Default, text, font, brush, pen, location); /// /// Draws the text using the default resolution of 72dpi onto the the image filled via the brush then outlined via the pen. /// /// The type of the color. /// The image this method extends. + /// The options. /// The text. /// The font. /// The brush. /// The pen. /// The location. - /// The options. /// /// The . /// - public static IImageProcessingContext DrawText(this IImageProcessingContext source, string text, Font font, IBrush brush, IPen pen, PointF location, TextGraphicsOptions options) + public static IImageProcessingContext DrawText(this IImageProcessingContext source, TextGraphicsOptions options, string text, Font font, IBrush brush, IPen pen, PointF location) where TPixel : struct, IPixel { float dpiX = DefaultTextDpi; @@ -168,12 +168,12 @@ namespace SixLabors.ImageSharp.Processing.Text var pathOptions = (GraphicsOptions)options; if (brush != null) { - source.Fill(brush, glyphs, pathOptions); + source.Fill(pathOptions, brush, glyphs); } if (pen != null) { - source.Draw(pen, glyphs, pathOptions); + source.Draw(pathOptions, pen, glyphs); } return source; diff --git a/src/ImageSharp/PixelFormats/PixelBlenderMode.cs b/src/ImageSharp/PixelFormats/PixelBlenderMode.cs index 7541be789..4b8f56d76 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenderMode.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenderMode.cs @@ -26,7 +26,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// Blends the 2 values by subtraction. /// - Substract, + Subtract, /// /// Multiplies the complements of the backdrop and source values, then complements the result. diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs index d3c6cf16c..6635a5a2a 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs @@ -141,17 +141,17 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } } - internal class Substract : PixelBlender + internal class Subtract : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Substract Instance { get; } = new Substract(); + public static Subtract Instance { get; } = new Subtract(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Substract(background, source, amount); + return PorterDuffFunctions.Subtract(background, source, amount); } /// @@ -172,7 +172,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Substract(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.Subtract(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt index eebee676f..485bc31ad 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt +++ b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt @@ -42,7 +42,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders "Normal", "Multiply", "Add", - "Substract", + "Subtract", "Screen", "Darken", "Lighten", diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs index 21ae335be..e948c05ca 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs @@ -15,19 +15,19 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders public static Vector4 Src(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); - source.W *= opacity; - Vector4 xform = source; + source.W *= opacity; // calculate weights - float xw = Vector4.Zero.W * source.W; - float bw = Vector4.Zero.W - xw; + float xw = backdrop.W * source.W; + float bw = backdrop.W - xw; float sw = source.W - xw; // calculate final alpha - float a = xw + bw + sw; + float fw = (sw * 1) + (bw * 0) + (xw * 1); // calculate final value - xform = ((xform * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(a, Constants.Epsilon); + Vector4 xform = ((source * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; return Vector4.Lerp(backdrop, xform, opacity); } @@ -36,18 +36,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders public static Vector4 Atop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); - Vector4 xform = source; // calculate weights - float xw = backdrop.W * Vector4.Zero.W; + float xw = backdrop.W * source.W; float bw = backdrop.W - xw; - float sw = Vector4.Zero.W - xw; + float sw = source.W - xw; // calculate final alpha - float a = xw + bw + sw; + float fw = (sw * 0) + (bw * 1) + (xw * 1); // calculate final value - xform = ((xform * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(a, Constants.Epsilon); + Vector4 xform = ((source * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; return Vector4.Lerp(backdrop, xform, opacity); } @@ -56,8 +56,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders public static Vector4 Over(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); - source.W *= opacity; - Vector4 xform = source; + source.W *= opacity; // calculate weights float xw = backdrop.W * source.W; @@ -65,10 +64,11 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders float sw = source.W - xw; // calculate final alpha - float a = xw + bw + sw; + float fw = (sw * 1) + (bw * 1) + (xw * 1); // calculate final value - xform = ((xform * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(a, Constants.Epsilon); + Vector4 xform = ((source * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; return Vector4.Lerp(backdrop, xform, opacity); } @@ -77,18 +77,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders public static Vector4 In(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); - Vector4 xform = source; // calculate weights - float xw = Vector4.Zero.W * Vector4.Zero.W; - float bw = Vector4.Zero.W - xw; - float sw = Vector4.Zero.W - xw; + float xw = backdrop.W * source.W; + float bw = backdrop.W - xw; + float sw = source.W - xw; // calculate final alpha - float a = xw + bw + sw; + float fw = (sw * 0) + (bw * 0) + (xw * 1); // calculate final value - xform = ((xform * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(a, Constants.Epsilon); + Vector4 xform = ((source * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; return Vector4.Lerp(backdrop, xform, opacity); } @@ -97,19 +97,19 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders public static Vector4 Out(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); - source.W *= opacity; - Vector4 xform = Vector4.Zero; + source.W *= opacity; // calculate weights - float xw = Vector4.Zero.W * source.W; - float bw = Vector4.Zero.W - xw; + float xw = backdrop.W * source.W; + float bw = backdrop.W - xw; float sw = source.W - xw; // calculate final alpha - float a = xw + bw + sw; + float fw = (sw * 1) + (bw * 0) + (xw * 0); // calculate final value - xform = ((xform * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(a, Constants.Epsilon); + Vector4 xform = ((Vector4.Zero * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; return Vector4.Lerp(backdrop, xform, opacity); } @@ -118,18 +118,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders public static Vector4 Dest(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); - Vector4 xform = backdrop; // calculate weights - float xw = backdrop.W * Vector4.Zero.W; + float xw = backdrop.W * source.W; float bw = backdrop.W - xw; - float sw = Vector4.Zero.W - xw; + float sw = source.W - xw; // calculate final alpha - float a = xw + bw + sw; + float fw = (sw * 0) + (bw * 1) + (xw * 1); // calculate final value - xform = ((xform * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(a, Constants.Epsilon); + Vector4 xform = ((backdrop * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; return Vector4.Lerp(backdrop, xform, opacity); } @@ -138,19 +138,19 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders public static Vector4 DestAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); - source.W *= opacity; - Vector4 xform = backdrop; + source.W *= opacity; // calculate weights - float xw = Vector4.Zero.W * source.W; - float bw = Vector4.Zero.W - xw; + float xw = backdrop.W * source.W; + float bw = backdrop.W - xw; float sw = source.W - xw; // calculate final alpha - float a = xw + bw + sw; + float fw = (sw * 1) + (bw * 0) + (xw * 1); // calculate final value - xform = ((xform * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(a, Constants.Epsilon); + Vector4 xform = ((backdrop * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; return Vector4.Lerp(backdrop, xform, opacity); } @@ -159,8 +159,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders public static Vector4 DestOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); - source.W *= opacity; - Vector4 xform = backdrop; + source.W *= opacity; // calculate weights float xw = backdrop.W * source.W; @@ -168,10 +167,11 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders float sw = source.W - xw; // calculate final alpha - float a = xw + bw + sw; + float fw = (sw * 1) + (bw * 1) + (xw * 1); // calculate final value - xform = ((xform * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(a, Constants.Epsilon); + Vector4 xform = ((backdrop * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; return Vector4.Lerp(backdrop, xform, opacity); } @@ -180,18 +180,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders public static Vector4 DestIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); - Vector4 xform = backdrop; // calculate weights - float xw = Vector4.Zero.W * Vector4.Zero.W; - float bw = Vector4.Zero.W - xw; - float sw = Vector4.Zero.W - xw; + float xw = backdrop.W * source.W; + float bw = backdrop.W - xw; + float sw = source.W - xw; // calculate final alpha - float a = xw + bw + sw; + float fw = (sw * 0) + (bw * 0) + (xw * 1); // calculate final value - xform = ((xform * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(a, Constants.Epsilon); + Vector4 xform = ((backdrop * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; return Vector4.Lerp(backdrop, xform, opacity); } @@ -200,18 +200,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders public static Vector4 DestOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); - Vector4 xform = Vector4.Zero; // calculate weights - float xw = backdrop.W * Vector4.Zero.W; + float xw = backdrop.W * source.W; float bw = backdrop.W - xw; - float sw = Vector4.Zero.W - xw; + float sw = source.W - xw; // calculate final alpha - float a = xw + bw + sw; + float fw = (sw * 0) + (bw * 1) + (xw * 0); // calculate final value - xform = ((xform * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(a, Constants.Epsilon); + Vector4 xform = ((Vector4.Zero * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; return Vector4.Lerp(backdrop, xform, opacity); } @@ -220,18 +220,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders public static Vector4 Clear(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); - Vector4 xform = Vector4.Zero; // calculate weights - float xw = Vector4.Zero.W * Vector4.Zero.W; - float bw = Vector4.Zero.W - xw; - float sw = Vector4.Zero.W - xw; + float xw = backdrop.W * source.W; + float bw = backdrop.W - xw; + float sw = source.W - xw; // calculate final alpha - float a = xw + bw + sw; + float fw = (sw * 0) + (bw * 0) + (xw * 0); // calculate final value - xform = ((xform * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(a, Constants.Epsilon); + Vector4 xform = ((Vector4.Zero * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; return Vector4.Lerp(backdrop, xform, opacity); } @@ -240,8 +240,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders public static Vector4 Xor(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); - source.W *= opacity; - Vector4 xform = Vector4.Zero; + source.W *= opacity; // calculate weights float xw = backdrop.W * source.W; @@ -249,10 +248,11 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders float sw = source.W - xw; // calculate final alpha - float a = xw + bw + sw; + float fw = (sw * 1) + (bw * 1) + (xw * 0); // calculate final value - xform = ((xform * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(a, Constants.Epsilon); + Vector4 xform = ((Vector4.Zero * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; return Vector4.Lerp(backdrop, xform, opacity); } @@ -285,11 +285,11 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Substract(TPixel backdrop, TPixel source, float amount) + public static TPixel Subtract(TPixel backdrop, TPixel source, float amount) where TPixel : struct, IPixel { TPixel dest = default(TPixel); - dest.PackFromVector4(Substract(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(Subtract(backdrop.ToVector4(), source.ToVector4(), amount)); return dest; } diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt index c92ab6dd6..940b585aa 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt @@ -40,26 +40,29 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders void GenerateVectorCompositor(string name, string sourceVar, string destVar, string blendVar) { + int a_s = sourceVar == "Vector4.Zero" ? 0 : 1; + int a_b = destVar == "Vector4.Zero" ? 0 : 1; + int a_x = blendVar == "Vector4.Zero" ? 0 : 1; #> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 <#=name#>(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); <# if(sourceVar != "Vector4.Zero" ) { #> - source.W *= opacity; + source.W *= opacity; <# } #> - Vector4 xform = <#=blendVar#>; // calculate weights - float xw = <#=destVar#>.W * <#=sourceVar#>.W; - float bw = <#=destVar#>.W - xw; - float sw = <#=sourceVar#>.W - xw; + float xw = backdrop.W * source.W; + float bw = backdrop.W - xw; + float sw = source.W - xw; // calculate final alpha - float a = xw + bw + sw; + float fw = (sw * <#=a_s#>) + (bw * <#=a_b#>) + (xw * <#=a_x#>); // calculate final value - xform = ((xform * xw) + (<#=destVar#> * bw) + (<#=sourceVar#> * sw)) / MathF.Max(a, Constants.Epsilon); + Vector4 xform = ((<#=blendVar#> * xw) + (<#=destVar#> * bw) + (<#=sourceVar#> * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; return Vector4.Lerp(backdrop, xform, opacity); } @@ -83,7 +86,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders GeneratePixelBlender("Normal"); GeneratePixelBlender("Multiply"); GeneratePixelBlender("Add"); - GeneratePixelBlender("Substract"); + GeneratePixelBlender("Subtract"); GeneratePixelBlender("Screen"); GeneratePixelBlender("Darken"); GeneratePixelBlender("Lighten"); diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs index f09d6d51c..c47ef35a3 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs @@ -23,7 +23,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders /// /// Source over backdrop /// - /// Backgrop color + /// Backdrop color /// Source color /// Opacity applied to Source Alpha /// Output color @@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders /// /// Source multiplied by backdrop /// - /// Backgrop color + /// Backdrop color /// Source color /// Opacity applied to Source Alpha /// Output color @@ -51,7 +51,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders /// /// Source added to backdrop /// - /// Backgrop color + /// Backdrop color /// Source color /// Opacity applied to Source Alpha /// Output color @@ -63,14 +63,14 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } /// - /// Source substracted from backdrop + /// Source subtracted from backdrop /// - /// Backgrop color + /// Backdrop color /// Source color /// Opacity applied to Source Alpha /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Substract(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Subtract(Vector4 backdrop, Vector4 source, float opacity) { source.W *= opacity; return Compose(backdrop, source, Vector4.Max(Vector4.Zero, backdrop - source)); @@ -79,7 +79,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders /// /// Complement of source multiplied by the complement of backdrop /// - /// Backgrop color + /// Backdrop color /// Source color /// Opacity applied to Source Alpha /// Output color @@ -93,7 +93,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders /// /// Per element, chooses the smallest value of source and backdrop /// - /// Backgrop color + /// Backdrop color /// Source color /// Opacity applied to Source Alpha /// Output color @@ -107,7 +107,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders /// /// Per element, chooses the largest value of source and backdrop /// - /// Backgrop color + /// Backdrop color /// Source color /// Opacity applied to Source Alpha /// Output color @@ -121,7 +121,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders /// /// Overlays source over backdrop /// - /// Backgrop color + /// Backdrop color /// Source color /// Opacity applied to Source Alpha /// Output color @@ -139,7 +139,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders /// /// Hard light effect /// - /// Backgrop color + /// Backdrop color /// Source color /// Opacity applied to Source Alpha /// Output color @@ -169,7 +169,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders /// /// General composition function for all modes, with a general solution for alpha channel /// - /// Original backgrop color + /// Original Backdrop color /// Original source color /// Desired transformed color, without taking Alpha channel in account /// The final color diff --git a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.PixelBenders.cs b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.PixelBenders.cs index 154ec7373..2c225ba4c 100644 --- a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.PixelBenders.cs +++ b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.PixelBenders.cs @@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.PixelFormats { case PixelBlenderMode.Multiply: return DefaultPixelBlenders.Multiply.Instance; case PixelBlenderMode.Add: return DefaultPixelBlenders.Add.Instance; - case PixelBlenderMode.Substract: return DefaultPixelBlenders.Substract.Instance; + case PixelBlenderMode.Subtract: return DefaultPixelBlenders.Subtract.Instance; case PixelBlenderMode.Screen: return DefaultPixelBlenders.Screen.Instance; case PixelBlenderMode.Darken: return DefaultPixelBlenders.Darken.Instance; case PixelBlenderMode.Lighten: return DefaultPixelBlenders.Lighten.Instance; diff --git a/src/ImageSharp/Processing/Overlays/BackgroundColorExtensions.cs b/src/ImageSharp/Processing/Overlays/BackgroundColorExtensions.cs index 72cba78e5..1a8224769 100644 --- a/src/ImageSharp/Processing/Overlays/BackgroundColorExtensions.cs +++ b/src/ImageSharp/Processing/Overlays/BackgroundColorExtensions.cs @@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays /// The . public static IImageProcessingContext BackgroundColor(this IImageProcessingContext source, TPixel color) where TPixel : struct, IPixel - => BackgroundColor(source, color, GraphicsOptions.Default); + => BackgroundColor(source, GraphicsOptions.Default, color); /// /// Replaces the background color of image with the given one. @@ -35,17 +35,17 @@ namespace SixLabors.ImageSharp.Processing.Overlays /// The . public static IImageProcessingContext BackgroundColor(this IImageProcessingContext source, TPixel color, Rectangle rectangle) where TPixel : struct, IPixel - => BackgroundColor(source, color, rectangle, GraphicsOptions.Default); + => BackgroundColor(source, GraphicsOptions.Default, color, rectangle); /// /// Replaces the background color of image with the given one. /// /// The pixel format. /// The image this method extends. - /// The color to set as the background. /// The options effecting pixel blending. + /// The color to set as the background. /// The . - public static IImageProcessingContext BackgroundColor(this IImageProcessingContext source, TPixel color, GraphicsOptions options) + public static IImageProcessingContext BackgroundColor(this IImageProcessingContext source, GraphicsOptions options, TPixel color) where TPixel : struct, IPixel => source.ApplyProcessor(new BackgroundColorProcessor(color, options)); @@ -54,13 +54,13 @@ namespace SixLabors.ImageSharp.Processing.Overlays /// /// The pixel format. /// The image this method extends. + /// The options effecting pixel blending. /// The color to set as the background. /// /// The structure that specifies the portion of the image object to alter. /// - /// The options effecting pixel blending. /// The . - public static IImageProcessingContext BackgroundColor(this IImageProcessingContext source, TPixel color, Rectangle rectangle, GraphicsOptions options) + public static IImageProcessingContext BackgroundColor(this IImageProcessingContext source, GraphicsOptions options, TPixel color, Rectangle rectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new BackgroundColorProcessor(color, options), rectangle); } diff --git a/src/ImageSharp/Processing/Overlays/GlowExtensions.cs b/src/ImageSharp/Processing/Overlays/GlowExtensions.cs index a86128f88..54af9f274 100644 --- a/src/ImageSharp/Processing/Overlays/GlowExtensions.cs +++ b/src/ImageSharp/Processing/Overlays/GlowExtensions.cs @@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays public static IImageProcessingContext Glow(this IImageProcessingContext source, TPixel color) where TPixel : struct, IPixel { - return Glow(source, color, GraphicsOptions.Default); + return Glow(source, GraphicsOptions.Default, color); } /// @@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays /// The . public static IImageProcessingContext Glow(this IImageProcessingContext source, float radius) where TPixel : struct, IPixel - => Glow(source, radius, GraphicsOptions.Default); + => Glow(source, GraphicsOptions.Default, radius); /// /// Applies a radial glow effect to an image. @@ -58,7 +58,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays /// The . public static IImageProcessingContext Glow(this IImageProcessingContext source, Rectangle rectangle) where TPixel : struct, IPixel - => source.Glow(rectangle, GraphicsOptions.Default); + => source.Glow(GraphicsOptions.Default, rectangle); /// /// Applies a radial glow effect to an image. @@ -73,7 +73,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays /// The . public static IImageProcessingContext Glow(this IImageProcessingContext source, TPixel color, float radius, Rectangle rectangle) where TPixel : struct, IPixel - => source.Glow(color, ValueSize.Absolute(radius), rectangle, GraphicsOptions.Default); + => source.Glow(GraphicsOptions.Default, color, ValueSize.Absolute(radius), rectangle); /// /// Applies a radial glow effect to an image. @@ -84,75 +84,75 @@ namespace SixLabors.ImageSharp.Processing.Overlays /// The . public static IImageProcessingContext Glow(this IImageProcessingContext source, GraphicsOptions options) where TPixel : struct, IPixel - => source.Glow(NamedColors.Black, ValueSize.PercentageOfWidth(0.5f), options); + => source.Glow(options, NamedColors.Black, ValueSize.PercentageOfWidth(0.5f)); /// /// Applies a radial glow effect to an image. /// /// The pixel format. /// The image this method extends. - /// The color to set as the glow. /// The options effecting things like blending. + /// The color to set as the glow. /// The . - public static IImageProcessingContext Glow(this IImageProcessingContext source, TPixel color, GraphicsOptions options) + public static IImageProcessingContext Glow(this IImageProcessingContext source, GraphicsOptions options, TPixel color) where TPixel : struct, IPixel - => source.Glow(color, ValueSize.PercentageOfWidth(0.5f), options); + => source.Glow(options, color, ValueSize.PercentageOfWidth(0.5f)); /// /// Applies a radial glow effect to an image. /// /// The pixel format. /// The image this method extends. - /// The the radius. /// The options effecting things like blending. + /// The the radius. /// The . - public static IImageProcessingContext Glow(this IImageProcessingContext source, float radius, GraphicsOptions options) + public static IImageProcessingContext Glow(this IImageProcessingContext source, GraphicsOptions options, float radius) where TPixel : struct, IPixel - => source.Glow(NamedColors.Black, ValueSize.Absolute(radius), options); + => source.Glow(options, NamedColors.Black, ValueSize.Absolute(radius)); /// /// Applies a radial glow effect to an image. /// /// The pixel format. /// The image this method extends. + /// The options effecting things like blending. /// /// The structure that specifies the portion of the image object to alter. /// - /// The options effecting things like blending. /// The . - public static IImageProcessingContext Glow(this IImageProcessingContext source, Rectangle rectangle, GraphicsOptions options) + public static IImageProcessingContext Glow(this IImageProcessingContext source, GraphicsOptions options, Rectangle rectangle) where TPixel : struct, IPixel - => source.Glow(NamedColors.Black, ValueSize.PercentageOfWidth(0.5f), rectangle, options); + => source.Glow(options, NamedColors.Black, ValueSize.PercentageOfWidth(0.5f), rectangle); /// /// Applies a radial glow effect to an image. /// /// The pixel format. /// The image this method extends. + /// The options effecting things like blending. /// The color to set as the glow. /// The the radius. /// /// The structure that specifies the portion of the image object to alter. /// - /// The options effecting things like blending. /// The . - public static IImageProcessingContext Glow(this IImageProcessingContext source, TPixel color, float radius, Rectangle rectangle, GraphicsOptions options) + public static IImageProcessingContext Glow(this IImageProcessingContext source, GraphicsOptions options, TPixel color, float radius, Rectangle rectangle) where TPixel : struct, IPixel - => source.Glow(color, ValueSize.Absolute(radius), rectangle, options); + => source.Glow(options, color, ValueSize.Absolute(radius), rectangle); /// /// Applies a radial glow effect to an image. /// /// The pixel format. /// The image this method extends. + /// The options effecting things like blending. /// The color to set as the glow. /// The the radius. /// /// The structure that specifies the portion of the image object to alter. /// - /// The options effecting things like blending. /// The . - private static IImageProcessingContext Glow(this IImageProcessingContext source, TPixel color, ValueSize radius, Rectangle rectangle, GraphicsOptions options) + private static IImageProcessingContext Glow(this IImageProcessingContext source, GraphicsOptions options, TPixel color, ValueSize radius, Rectangle rectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new GlowProcessor(color, radius, options), rectangle); @@ -161,12 +161,12 @@ namespace SixLabors.ImageSharp.Processing.Overlays /// /// The pixel format. /// The image this method extends. + /// The options effecting things like blending. /// The color to set as the glow. /// The the radius. - /// The options effecting things like blending. /// The . - private static IImageProcessingContext Glow(this IImageProcessingContext source, TPixel color, ValueSize radius, GraphicsOptions options) + private static IImageProcessingContext Glow(this IImageProcessingContext source, GraphicsOptions options, TPixel color, ValueSize radius) where TPixel : struct, IPixel => source.ApplyProcessor(new GlowProcessor(color, radius, options)); } -} +} \ No newline at end of file diff --git a/src/ImageSharp/Processing/Overlays/VignetteExtensions.cs b/src/ImageSharp/Processing/Overlays/VignetteExtensions.cs index e533c914f..25b067d7f 100644 --- a/src/ImageSharp/Processing/Overlays/VignetteExtensions.cs +++ b/src/ImageSharp/Processing/Overlays/VignetteExtensions.cs @@ -32,7 +32,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays /// The . public static IImageProcessingContext Vignette(this IImageProcessingContext source, TPixel color) where TPixel : struct, IPixel - => Vignette(source, color, GraphicsOptions.Default); + => Vignette(source, GraphicsOptions.Default, color); /// /// Applies a radial vignette effect to an image. @@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays /// The . public static IImageProcessingContext Vignette(this IImageProcessingContext source, float radiusX, float radiusY) where TPixel : struct, IPixel - => Vignette(source, radiusX, radiusY, GraphicsOptions.Default); + => Vignette(source, GraphicsOptions.Default, radiusX, radiusY); /// /// Applies a radial vignette effect to an image. @@ -57,7 +57,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays /// The . public static IImageProcessingContext Vignette(this IImageProcessingContext source, Rectangle rectangle) where TPixel : struct, IPixel - => Vignette(source, rectangle, GraphicsOptions.Default); + => Vignette(source, GraphicsOptions.Default, rectangle); /// /// Applies a radial vignette effect to an image. @@ -73,7 +73,7 @@ namespace SixLabors.ImageSharp.Processing.Overlays /// The . public static IImageProcessingContext Vignette(this IImageProcessingContext source, TPixel color, float radiusX, float radiusY, Rectangle rectangle) where TPixel : struct, IPixel - => source.Vignette(color, radiusX, radiusY, rectangle, GraphicsOptions.Default); + => source.Vignette(GraphicsOptions.Default, color, radiusX, radiusY, rectangle); /// /// Applies a radial vignette effect to an image. @@ -84,69 +84,69 @@ namespace SixLabors.ImageSharp.Processing.Overlays /// The . public static IImageProcessingContext Vignette(this IImageProcessingContext source, GraphicsOptions options) where TPixel : struct, IPixel - => source.VignetteInternal(NamedColors.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), options); + => source.VignetteInternal(options, NamedColors.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f)); /// /// Applies a radial vignette effect to an image. /// /// The pixel format. /// The image this method extends. - /// The color to set as the vignette. /// The options effecting pixel blending. + /// The color to set as the vignette. /// The . - public static IImageProcessingContext Vignette(this IImageProcessingContext source, TPixel color, GraphicsOptions options) + public static IImageProcessingContext Vignette(this IImageProcessingContext source, GraphicsOptions options, TPixel color) where TPixel : struct, IPixel - => source.VignetteInternal(color, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), options); + => source.VignetteInternal(options, color, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f)); /// /// Applies a radial vignette effect to an image. /// /// The pixel format. /// The image this method extends. + /// The options effecting pixel blending. /// The the x-radius. /// The the y-radius. - /// The options effecting pixel blending. /// The . - public static IImageProcessingContext Vignette(this IImageProcessingContext source, float radiusX, float radiusY, GraphicsOptions options) + public static IImageProcessingContext Vignette(this IImageProcessingContext source, GraphicsOptions options, float radiusX, float radiusY) where TPixel : struct, IPixel - => source.VignetteInternal(NamedColors.Black, radiusX, radiusY, options); + => source.VignetteInternal(options, NamedColors.Black, radiusX, radiusY); /// /// Applies a radial vignette effect to an image. /// /// The pixel format. /// The image this method extends. + /// The options effecting pixel blending. /// /// The structure that specifies the portion of the image object to alter. /// - /// The options effecting pixel blending. /// The . - public static IImageProcessingContext Vignette(this IImageProcessingContext source, Rectangle rectangle, GraphicsOptions options) + public static IImageProcessingContext Vignette(this IImageProcessingContext source, GraphicsOptions options, Rectangle rectangle) where TPixel : struct, IPixel - => source.VignetteInternal(NamedColors.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), rectangle, options); + => source.VignetteInternal(options, NamedColors.Black, ValueSize.PercentageOfWidth(.5f), ValueSize.PercentageOfHeight(.5f), rectangle); /// /// Applies a radial vignette effect to an image. /// /// The pixel format. /// The image this method extends. + /// The options effecting pixel blending. /// The color to set as the vignette. /// The the x-radius. /// The the y-radius. /// /// The structure that specifies the portion of the image object to alter. /// - /// The options effecting pixel blending. /// The . - public static IImageProcessingContext Vignette(this IImageProcessingContext source, TPixel color, float radiusX, float radiusY, Rectangle rectangle, GraphicsOptions options) + public static IImageProcessingContext Vignette(this IImageProcessingContext source, GraphicsOptions options, TPixel color, float radiusX, float radiusY, Rectangle rectangle) where TPixel : struct, IPixel - => source.VignetteInternal(color, radiusX, radiusY, rectangle, options); + => source.VignetteInternal(options, color, radiusX, radiusY, rectangle); - private static IImageProcessingContext VignetteInternal(this IImageProcessingContext source, TPixel color, ValueSize radiusX, ValueSize radiusY, Rectangle rectangle, GraphicsOptions options) + private static IImageProcessingContext VignetteInternal(this IImageProcessingContext source, GraphicsOptions options, TPixel color, ValueSize radiusX, ValueSize radiusY, Rectangle rectangle) where TPixel : struct, IPixel => source.ApplyProcessor(new VignetteProcessor(color, radiusX, radiusY, options), rectangle); - private static IImageProcessingContext VignetteInternal(this IImageProcessingContext source, TPixel color, ValueSize radiusX, ValueSize radiusY, GraphicsOptions options) + private static IImageProcessingContext VignetteInternal(this IImageProcessingContext source, GraphicsOptions options, TPixel color, ValueSize radiusX, ValueSize radiusY) where TPixel : struct, IPixel => source.ApplyProcessor(new VignetteProcessor(color, radiusX, radiusY, options)); } diff --git a/tests/ImageSharp.Tests/Drawing/BlendedShapes.cs b/tests/ImageSharp.Tests/Drawing/BlendedShapes.cs index 993adb169..c39b5bc34 100644 --- a/tests/ImageSharp.Tests/Drawing/BlendedShapes.cs +++ b/tests/ImageSharp.Tests/Drawing/BlendedShapes.cs @@ -29,10 +29,8 @@ namespace SixLabors.ImageSharp.Tests.Drawing var scaleY = (img.Height / 100); img.Mutate(x => x .Fill(NamedColors.DarkBlue, new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY)) - .Fill(NamedColors.HotPink, new Rectangle(20 * scaleX, 0 * scaleY, 30 * scaleX, 100 * scaleY), new ImageSharp.GraphicsOptions(true) - { - BlenderMode = mode - })); + .Fill(new GraphicsOptions(true) { BlenderMode = mode }, NamedColors.HotPink, new Rectangle(20 * scaleX, 0 * scaleY, 30 * scaleX, 100 * scaleY) + )); img.DebugSave(provider, new { mode }); } } @@ -47,14 +45,8 @@ namespace SixLabors.ImageSharp.Tests.Drawing var scaleX = (img.Width / 100); var scaleY = (img.Height / 100); img.Mutate(x => x.Fill(NamedColors.DarkBlue, new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY))); - img.Mutate(x => x.Fill(NamedColors.HotPink, new Rectangle(20 * scaleX, 0 * scaleY, 30 * scaleX, 100 * scaleY), new ImageSharp.GraphicsOptions(true) - { - BlenderMode = mode - })); - img.Mutate(x => x.Fill(NamedColors.Transparent, new SixLabors.Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY), new ImageSharp.GraphicsOptions(true) - { - BlenderMode = mode - })); + img.Mutate(x => x.Fill(new GraphicsOptions(true) { BlenderMode = mode }, NamedColors.HotPink, new Rectangle(20 * scaleX, 0 * scaleY, 30 * scaleX, 100 * scaleY))); + img.Mutate(x => x.Fill(new GraphicsOptions(true) { BlenderMode = mode }, NamedColors.Transparent, new Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY))); img.DebugSave(provider, new { mode }); } } @@ -69,19 +61,13 @@ namespace SixLabors.ImageSharp.Tests.Drawing var scaleX = (img.Width / 100); var scaleY = (img.Height / 100); img.Mutate(x => x.Fill(NamedColors.DarkBlue, new Rectangle(0 * scaleX, 40, 100 * scaleX, 20 * scaleY))); - img.Mutate(x => x.Fill(NamedColors.HotPink, new Rectangle(20 * scaleX, 0, 30 * scaleX, 100 * scaleY), new ImageSharp.GraphicsOptions(true) - { - BlenderMode = mode - })); + img.Mutate(x => x.Fill(new GraphicsOptions(true) { BlenderMode = mode }, NamedColors.HotPink, new Rectangle(20 * scaleX, 0, 30 * scaleX, 100 * scaleY))); var c = NamedColors.Red.ToVector4(); c.W *= 0.5f; TPixel pixel = default(TPixel); pixel.PackFromVector4(c); - img.Mutate(x => x.Fill(pixel, new SixLabors.Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY), new ImageSharp.GraphicsOptions(true) - { - BlenderMode = mode - })); + img.Mutate(x => x.Fill(new GraphicsOptions(true) { BlenderMode = mode }, pixel, new Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY))); img.DebugSave(provider, new { mode }); } } @@ -98,10 +84,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing var scaleX = (img.Width / 100); var scaleY = (img.Height / 100); img.Mutate(x => x.Fill(NamedColors.DarkBlue, new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY))); - img.Mutate(x => x.Fill(NamedColors.Black, new SixLabors.Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY), new ImageSharp.GraphicsOptions(true) - { - BlenderMode = mode - })); + img.Mutate(x => x.Fill(new GraphicsOptions(true) { BlenderMode = mode }, NamedColors.Black, new Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY))); img.DebugSave(provider, new { mode }); } } diff --git a/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs b/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs index 3e7f3648f..0ff0b8557 100644 --- a/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs +++ b/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs @@ -28,7 +28,7 @@ namespace SixLabors.ImageSharp.Tests [WithFileCollection(nameof(TestFiles), PixelTypes, PixelBlenderMode.Normal)] [WithFileCollection(nameof(TestFiles), PixelTypes, PixelBlenderMode.Multiply)] [WithFileCollection(nameof(TestFiles), PixelTypes, PixelBlenderMode.Add)] - [WithFileCollection(nameof(TestFiles), PixelTypes, PixelBlenderMode.Substract)] + [WithFileCollection(nameof(TestFiles), PixelTypes, PixelBlenderMode.Subtract)] [WithFileCollection(nameof(TestFiles), PixelTypes, PixelBlenderMode.Screen)] [WithFileCollection(nameof(TestFiles), PixelTypes, PixelBlenderMode.Darken)] [WithFileCollection(nameof(TestFiles), PixelTypes, PixelBlenderMode.Lighten)] diff --git a/tests/ImageSharp.Tests/Drawing/LineTests.cs b/tests/ImageSharp.Tests/Drawing/LineTests.cs index d7eb0b657..e23616b1e 100644 --- a/tests/ImageSharp.Tests/Drawing/LineTests.cs +++ b/tests/ImageSharp.Tests/Drawing/LineTests.cs @@ -50,13 +50,15 @@ namespace SixLabors.ImageSharp.Tests.Drawing { image.Mutate(x => x .BackgroundColor(Rgba32.Blue) - .DrawLines(Rgba32.HotPink, 5, - new SixLabors.Primitives.PointF[] { - new Vector2(10, 10), - new Vector2(200, 150), - new Vector2(50, 300) - }, - new GraphicsOptions(false))); + .DrawLines( + new GraphicsOptions(false), + Rgba32.HotPink, + 5, + new SixLabors.Primitives.PointF[] { + new Vector2(10, 10), + new Vector2(200, 150), + new Vector2(50, 300) + })); image.Save($"{path}/Simple_noantialias.png"); using (PixelAccessor sourcePixels = image.Lock()) diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs index 4713e63c2..1a402c5b7 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs @@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths [Fact] public void CorrectlySetsBrushPathOptions() { - this.operations.Fill(this.brush, this.path, this.noneDefault); + this.operations.Fill(this.noneDefault, this.brush, this.path); var processor = this.Verify>(); Assert.Equal(this.noneDefault, processor.Options); @@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths [Fact] public void CorrectlySetsColorPathAndOptions() { - this.operations.Fill(this.color, this.path, this.noneDefault); + this.operations.Fill(this.noneDefault, this.color, this.path); var processor = this.Verify>(); Assert.Equal(this.noneDefault, processor.Options); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs index 526cf1b92..b728ea7bf 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs @@ -31,7 +31,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths })); IPathCollection pathCollection; - + public FillPathCollection() { this.pathCollection = new PathCollection(this.path1, this.path2); @@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths [Fact] public void CorrectlySetsBrushPathOptions() { - this.operations.Fill(this.brush, this.pathCollection, this.noneDefault); + this.operations.Fill(this.noneDefault, this.brush, this.pathCollection); for (int i = 0; i < 2; i++) { @@ -100,7 +100,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths [Fact] public void CorrectlySetsColorPathAndOptions() { - this.operations.Fill(this.color, this.pathCollection, this.noneDefault); + this.operations.Fill(this.noneDefault, this.color, this.pathCollection); for (int i = 0; i < 2; i++) { diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs index a1f083cf4..717feafa8 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs @@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths [Fact] public void CorrectlySetsBrushPathAndOptions() { - this.operations.FillPolygon(this.brush, this.path, this.noneDefault); + this.operations.FillPolygon(this.noneDefault, this.brush, this.path); FillRegionProcessor processor = this.Verify>(); Assert.Equal(this.noneDefault, processor.Options); @@ -76,7 +76,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths [Fact] public void CorrectlySetsColorPathAndOptions() { - this.operations.FillPolygon(this.color, this.path, this.noneDefault); + this.operations.FillPolygon(this.noneDefault, this.color, this.path); FillRegionProcessor processor = this.Verify>(); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs index 263eb9a9c..03a59cc8d 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs @@ -38,7 +38,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths [Fact] public void CorrectlySetsBrushRectangleAndOptions() { - this.operations.Fill(this.brush, this.rectangle, this.noneDefault); + this.operations.Fill(this.noneDefault, this.brush, this.rectangle); FillRegionProcessor processor = this.Verify>(); Assert.Equal(this.noneDefault, processor.Options); @@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths [Fact] public void CorrectlySetsColorRectangleAndOptions() { - this.operations.Fill(this.color, this.rectangle, this.noneDefault); + this.operations.Fill(this.noneDefault, this.color, this.rectangle); FillRegionProcessor processor = this.Verify>(); Assert.Equal(this.noneDefault, processor.Options); diff --git a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs index 6eeed144c..bf1f6d45a 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs @@ -29,7 +29,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing using (var image = new Image(500, 500)) { image.Mutate(x => x - .FillPolygon(Rgba32.HotPink, simplePath, new GraphicsOptions(true))); + .FillPolygon(new GraphicsOptions(true), Rgba32.HotPink, simplePath)); image.Save($"{path}/Simple.png"); using (PixelAccessor sourcePixels = image.Lock()) @@ -52,7 +52,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing using (var image = new Image(500, 500)) { image.Mutate(x => x - .FillPolygon(Brushes.Horizontal(Rgba32.HotPink), simplePath, new GraphicsOptions(true))); + .FillPolygon(new GraphicsOptions(true), Brushes.Horizontal(Rgba32.HotPink), simplePath)); image.Save($"{path}/Pattern.png"); using (PixelAccessor sourcePixels = image.Lock()) @@ -76,7 +76,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing { image.Mutate(x => x .BackgroundColor(Rgba32.Blue) - .FillPolygon(Rgba32.HotPink, simplePath, new GraphicsOptions(false))); + .FillPolygon(new GraphicsOptions(false), Rgba32.HotPink, simplePath)); image.Save($"{path}/Simple_NoAntialias.png"); using (PixelAccessor sourcePixels = image.Lock()) diff --git a/tests/ImageSharp.Tests/Drawing/Text/DrawText.Path.cs b/tests/ImageSharp.Tests/Drawing/Text/DrawText.Path.cs index 85503a552..30d47ab5d 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/DrawText.Path.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/DrawText.Path.cs @@ -37,12 +37,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text public void FillsForEachACharachterWhenBrushSetAndNotPen() { this.operations.DrawText( + new TextGraphicsOptions(true), "123", this.Font, Brushes.Solid(Rgba32.Red), null, - this.path, - new TextGraphicsOptions(true)); + this.path); this.Verify>(0); this.Verify>(1); @@ -62,7 +62,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text [Fact] public void FillsForEachACharachterWhenBrushSet() { - this.operations.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), this.path, new TextGraphicsOptions(true)); + this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Brushes.Solid(Rgba32.Red), this.path); this.Verify>(0); this.Verify>(1); @@ -82,7 +82,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text [Fact] public void FillsForEachACharachterWhenColorSet() { - this.operations.DrawText("123", this.Font, Rgba32.Red, this.path, new TextGraphicsOptions(true)); + this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Rgba32.Red, this.path); var processor = this.Verify>(0); this.Verify>(1); @@ -109,12 +109,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text public void DrawForEachACharachterWhenPenSetAndNotBrush() { this.operations.DrawText( + new TextGraphicsOptions(true), "123", this.Font, null, Pens.Dash(Rgba32.Red, 1), - this.path, - new TextGraphicsOptions(true)); + this.path); var processor = this.Verify>(0); this.Verify>(1); @@ -134,7 +134,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text [Fact] public void DrawForEachACharachterWhenPenSet() { - this.operations.DrawText("123", this.Font, Pens.Dash(Rgba32.Red, 1), this.path, new TextGraphicsOptions(true)); + this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Pens.Dash(Rgba32.Red, 1), this.path); var processor = this.Verify>(0); this.Verify>(1); @@ -155,12 +155,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text public void DrawForEachACharachterWhenPenSetAndFillFroEachWhenBrushSet() { this.operations.DrawText( + new TextGraphicsOptions(true), "123", this.Font, Brushes.Solid(Rgba32.Red), Pens.Dash(Rgba32.Red, 1), - this.path, - new TextGraphicsOptions(true)); + this.path); var processor = this.Verify>(0); this.Verify>(1); @@ -187,12 +187,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text public void BrushAppliesBeforPen() { this.operations.DrawText( + new TextGraphicsOptions(true), "1", this.Font, Brushes.Solid(Rgba32.Red), Pens.Dash(Rgba32.Red, 1), - this.path, - new TextGraphicsOptions(true)); + this.path); var processor = this.Verify>(0); this.Verify>(1); diff --git a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs index 058ce6f95..9c929d1c7 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs @@ -37,12 +37,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text public void FillsForEachACharachterWhenBrushSetAndNotPen() { this.operations.DrawText( + new TextGraphicsOptions(true), "123", this.Font, Brushes.Solid(Rgba32.Red), null, - Vector2.Zero, - new TextGraphicsOptions(true)); + Vector2.Zero); this.Verify>(0); this.Verify>(1); @@ -62,7 +62,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text [Fact] public void FillsForEachACharachterWhenBrushSet() { - this.operations.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero, new TextGraphicsOptions(true)); + this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero); this.Verify>(0); this.Verify>(1); @@ -82,7 +82,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text [Fact] public void FillsForEachACharachterWhenColorSet() { - this.operations.DrawText("123", this.Font, Rgba32.Red, Vector2.Zero, new TextGraphicsOptions(true)); + this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Rgba32.Red, Vector2.Zero); var processor = this.Verify>(0); this.Verify>(1); @@ -109,12 +109,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text public void DrawForEachACharachterWhenPenSetAndNotBrush() { this.operations.DrawText( + new TextGraphicsOptions(true), "123", this.Font, null, Pens.Dash(Rgba32.Red, 1), - Vector2.Zero, - new TextGraphicsOptions(true)); + Vector2.Zero); var processor = this.Verify>(0); this.Verify>(1); @@ -134,7 +134,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text [Fact] public void DrawForEachACharachterWhenPenSet() { - this.operations.DrawText("123", this.Font, Pens.Dash(Rgba32.Red, 1), Vector2.Zero, new TextGraphicsOptions(true)); + this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Pens.Dash(Rgba32.Red, 1), Vector2.Zero); var processor = this.Verify>(0); this.Verify>(1); @@ -155,12 +155,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text public void DrawForEachACharachterWhenPenSetAndFillFroEachWhenBrushSet() { this.operations.DrawText( + new TextGraphicsOptions(true), "123", this.Font, Brushes.Solid(Rgba32.Red), Pens.Dash(Rgba32.Red, 1), - Vector2.Zero, - new TextGraphicsOptions(true)); + Vector2.Zero); var processor = this.Verify>(0); this.Verify>(1); @@ -188,12 +188,12 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text public void BrushAppliesBeforePen() { this.operations.DrawText( + new TextGraphicsOptions(true), "1", this.Font, Brushes.Solid(Rgba32.Red), Pens.Dash(Rgba32.Red, 1), - Vector2.Zero, - new TextGraphicsOptions(true)); + Vector2.Zero); var processor = this.Verify>(0); this.Verify>(1); diff --git a/tests/ImageSharp.Tests/Issues/Issue412.cs b/tests/ImageSharp.Tests/Issues/Issue412.cs index f48696cd9..a1bf7f36a 100644 --- a/tests/ImageSharp.Tests/Issues/Issue412.cs +++ b/tests/ImageSharp.Tests/Issues/Issue412.cs @@ -22,24 +22,24 @@ namespace SixLabors.ImageSharp.Tests.Issues for (var i = 0; i < 40; ++i) { context.DrawLines( + new GraphicsOptions(false), NamedColors.Black, 1, new[] { new PointF(i, 0.1066f), new PointF(i, 10.1066f) - }, - new GraphicsOptions(true)); + }); context.DrawLines( + new GraphicsOptions(false), NamedColors.Red, 1, new[] { new PointF(i, 15.1066f), new PointF(i, 25.1066f) - }, - new GraphicsOptions(false)); + }); } }); diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs new file mode 100644 index 000000000..36473fa56 --- /dev/null +++ b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs @@ -0,0 +1,48 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders +{ + using SixLabors.ImageSharp.PixelFormats; + using SixLabors.ImageSharp.Processing; + using SixLabors.ImageSharp.Processing.Drawing; + + using Xunit; + + public class PorterDuffCompositorTests + { + // TODO: Add other modes to compare. + public static readonly TheoryData CompositingOperators = + new TheoryData + { + PixelBlenderMode.Src, + PixelBlenderMode.Atop, + PixelBlenderMode.Over, + PixelBlenderMode.In, + PixelBlenderMode.Out, + PixelBlenderMode.Dest, + PixelBlenderMode.DestAtop, + PixelBlenderMode.DestOver, + PixelBlenderMode.DestIn, + PixelBlenderMode.DestOut, + PixelBlenderMode.Clear, + PixelBlenderMode.Xor + }; + + [Theory] + [WithFile(TestImages.Png.PDDest, nameof(CompositingOperators), PixelTypes.Rgba32)] + public void PorterDuffOutputIsCorrect(TestImageProvider provider, PixelBlenderMode mode) + { + var srcFile = TestFile.Create(TestImages.Png.PDSrc); + using (Image src = srcFile.CreateImage()) + using (Image dest = provider.GetImage()) + { + using (Image res = dest.Clone(x => x.DrawImage(new GraphicsOptions { BlenderMode = mode }, src))) + { + res.DebugSave(provider, mode.ToString()); + res.CompareToReferenceOutput(provider, mode.ToString()); + } + } + } + } +} \ No newline at end of file diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs index 9aa2e01a6..c5910e13a 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs @@ -79,7 +79,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders [MemberData(nameof(SubstractFunctionData))] public void SubstractFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Substract((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.Subtract((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs index 50babde69..10a34ec31 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs @@ -151,7 +151,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders public void SubstractFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Substract((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.Subtract((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -160,7 +160,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders public void SubstractFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Substract().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.Subtract().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -170,7 +170,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders where TPixel : struct, IPixel { Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Substract().Blend(this.MemoryManager, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + new DefaultPixelBlenders.Subtract().Blend(this.MemoryManager, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.Blender.cs b/tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.Blender.cs index 524747afe..d3956ecd5 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.Blender.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.Blender.cs @@ -16,53 +16,53 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats public static TheoryData BlenderMappings = new TheoryData() - { - { new TestPixel(), typeof(DefaultPixelBlenders.Normal), PixelBlenderMode.Normal }, - { new TestPixel(), typeof(DefaultPixelBlenders.Screen), PixelBlenderMode.Screen }, - { new TestPixel(), typeof(DefaultPixelBlenders.HardLight), PixelBlenderMode.HardLight }, - { new TestPixel(), typeof(DefaultPixelBlenders.Overlay), PixelBlenderMode.Overlay }, - { new TestPixel(), typeof(DefaultPixelBlenders.Darken), PixelBlenderMode.Darken }, - { new TestPixel(), typeof(DefaultPixelBlenders.Lighten), PixelBlenderMode.Lighten }, - { new TestPixel(), typeof(DefaultPixelBlenders.Add), PixelBlenderMode.Add }, - { new TestPixel(), typeof(DefaultPixelBlenders.Substract), PixelBlenderMode.Substract }, - { new TestPixel(), typeof(DefaultPixelBlenders.Multiply), PixelBlenderMode.Multiply }, + { + { new TestPixel(), typeof(DefaultPixelBlenders.Normal), PixelBlenderMode.Normal }, + { new TestPixel(), typeof(DefaultPixelBlenders.Screen), PixelBlenderMode.Screen }, + { new TestPixel(), typeof(DefaultPixelBlenders.HardLight), PixelBlenderMode.HardLight }, + { new TestPixel(), typeof(DefaultPixelBlenders.Overlay), PixelBlenderMode.Overlay }, + { new TestPixel(), typeof(DefaultPixelBlenders.Darken), PixelBlenderMode.Darken }, + { new TestPixel(), typeof(DefaultPixelBlenders.Lighten), PixelBlenderMode.Lighten }, + { new TestPixel(), typeof(DefaultPixelBlenders.Add), PixelBlenderMode.Add }, + { new TestPixel(), typeof(DefaultPixelBlenders.Subtract), PixelBlenderMode.Subtract }, + { new TestPixel(), typeof(DefaultPixelBlenders.Multiply), PixelBlenderMode.Multiply }, - { new TestPixel(), typeof(DefaultPixelBlenders.Src), PixelBlenderMode.Src }, - { new TestPixel(), typeof(DefaultPixelBlenders.Atop), PixelBlenderMode.Atop }, - { new TestPixel(), typeof(DefaultPixelBlenders.Over), PixelBlenderMode.Over }, - { new TestPixel(), typeof(DefaultPixelBlenders.In), PixelBlenderMode.In }, - { new TestPixel(), typeof(DefaultPixelBlenders.Out), PixelBlenderMode.Out }, - { new TestPixel(), typeof(DefaultPixelBlenders.Dest), PixelBlenderMode.Dest }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestAtop), PixelBlenderMode.DestAtop }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestOver), PixelBlenderMode.DestOver }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestIn), PixelBlenderMode.DestIn }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestOut), PixelBlenderMode.DestOut }, - { new TestPixel(), typeof(DefaultPixelBlenders.Clear), PixelBlenderMode.Clear }, - { new TestPixel(), typeof(DefaultPixelBlenders.Xor), PixelBlenderMode.Xor }, + { new TestPixel(), typeof(DefaultPixelBlenders.Src), PixelBlenderMode.Src }, + { new TestPixel(), typeof(DefaultPixelBlenders.Atop), PixelBlenderMode.Atop }, + { new TestPixel(), typeof(DefaultPixelBlenders.Over), PixelBlenderMode.Over }, + { new TestPixel(), typeof(DefaultPixelBlenders.In), PixelBlenderMode.In }, + { new TestPixel(), typeof(DefaultPixelBlenders.Out), PixelBlenderMode.Out }, + { new TestPixel(), typeof(DefaultPixelBlenders.Dest), PixelBlenderMode.Dest }, + { new TestPixel(), typeof(DefaultPixelBlenders.DestAtop), PixelBlenderMode.DestAtop }, + { new TestPixel(), typeof(DefaultPixelBlenders.DestOver), PixelBlenderMode.DestOver }, + { new TestPixel(), typeof(DefaultPixelBlenders.DestIn), PixelBlenderMode.DestIn }, + { new TestPixel(), typeof(DefaultPixelBlenders.DestOut), PixelBlenderMode.DestOut }, + { new TestPixel(), typeof(DefaultPixelBlenders.Clear), PixelBlenderMode.Clear }, + { new TestPixel(), typeof(DefaultPixelBlenders.Xor), PixelBlenderMode.Xor }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal), PixelBlenderMode.Normal }, - { new TestPixel(), typeof(DefaultPixelBlenders.Screen), PixelBlenderMode.Screen }, - { new TestPixel(), typeof(DefaultPixelBlenders.HardLight), PixelBlenderMode.HardLight }, - { new TestPixel(), typeof(DefaultPixelBlenders.Overlay), PixelBlenderMode.Overlay }, - { new TestPixel(), typeof(DefaultPixelBlenders.Darken), PixelBlenderMode.Darken }, - { new TestPixel(), typeof(DefaultPixelBlenders.Lighten), PixelBlenderMode.Lighten }, - { new TestPixel(), typeof(DefaultPixelBlenders.Add), PixelBlenderMode.Add }, - { new TestPixel(), typeof(DefaultPixelBlenders.Substract), PixelBlenderMode.Substract }, - { new TestPixel(), typeof(DefaultPixelBlenders.Multiply), PixelBlenderMode.Multiply }, - { new TestPixel(), typeof(DefaultPixelBlenders.Src), PixelBlenderMode.Src }, - { new TestPixel(), typeof(DefaultPixelBlenders.Atop), PixelBlenderMode.Atop }, - { new TestPixel(), typeof(DefaultPixelBlenders.Over), PixelBlenderMode.Over }, - { new TestPixel(), typeof(DefaultPixelBlenders.In), PixelBlenderMode.In }, - { new TestPixel(), typeof(DefaultPixelBlenders.Out), PixelBlenderMode.Out }, - { new TestPixel(), typeof(DefaultPixelBlenders.Dest), PixelBlenderMode.Dest }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestAtop), PixelBlenderMode.DestAtop }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestOver), PixelBlenderMode.DestOver }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestIn), PixelBlenderMode.DestIn }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestOut), PixelBlenderMode.DestOut }, - { new TestPixel(), typeof(DefaultPixelBlenders.Clear), PixelBlenderMode.Clear }, - { new TestPixel(), typeof(DefaultPixelBlenders.Xor), PixelBlenderMode.Xor }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal), PixelBlenderMode.Normal }, + { new TestPixel(), typeof(DefaultPixelBlenders.Screen), PixelBlenderMode.Screen }, + { new TestPixel(), typeof(DefaultPixelBlenders.HardLight), PixelBlenderMode.HardLight }, + { new TestPixel(), typeof(DefaultPixelBlenders.Overlay), PixelBlenderMode.Overlay }, + { new TestPixel(), typeof(DefaultPixelBlenders.Darken), PixelBlenderMode.Darken }, + { new TestPixel(), typeof(DefaultPixelBlenders.Lighten), PixelBlenderMode.Lighten }, + { new TestPixel(), typeof(DefaultPixelBlenders.Add), PixelBlenderMode.Add }, + { new TestPixel(), typeof(DefaultPixelBlenders.Subtract), PixelBlenderMode.Subtract }, + { new TestPixel(), typeof(DefaultPixelBlenders.Multiply), PixelBlenderMode.Multiply }, + { new TestPixel(), typeof(DefaultPixelBlenders.Src), PixelBlenderMode.Src }, + { new TestPixel(), typeof(DefaultPixelBlenders.Atop), PixelBlenderMode.Atop }, + { new TestPixel(), typeof(DefaultPixelBlenders.Over), PixelBlenderMode.Over }, + { new TestPixel(), typeof(DefaultPixelBlenders.In), PixelBlenderMode.In }, + { new TestPixel(), typeof(DefaultPixelBlenders.Out), PixelBlenderMode.Out }, + { new TestPixel(), typeof(DefaultPixelBlenders.Dest), PixelBlenderMode.Dest }, + { new TestPixel(), typeof(DefaultPixelBlenders.DestAtop), PixelBlenderMode.DestAtop }, + { new TestPixel(), typeof(DefaultPixelBlenders.DestOver), PixelBlenderMode.DestOver }, + { new TestPixel(), typeof(DefaultPixelBlenders.DestIn), PixelBlenderMode.DestIn }, + { new TestPixel(), typeof(DefaultPixelBlenders.DestOut), PixelBlenderMode.DestOut }, + { new TestPixel(), typeof(DefaultPixelBlenders.Clear), PixelBlenderMode.Clear }, + { new TestPixel(), typeof(DefaultPixelBlenders.Xor), PixelBlenderMode.Xor }, - }; + }; [Theory] [MemberData(nameof(BlenderMappings))] diff --git a/tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs b/tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs index d7204d0cf..7aa1720e2 100644 --- a/tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs +++ b/tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs @@ -35,7 +35,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Effects [Fact] public void BackgroundColor_amount_options_BackgroundColorProcessorDefaultsSet() { - this.operations.BackgroundColor(Rgba32.BlanchedAlmond, this.options); + this.operations.BackgroundColor(this.options, Rgba32.BlanchedAlmond); var processor = this.Verify>(); Assert.Equal(this.options, processor.GraphicsOptions); @@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Effects [Fact] public void BackgroundColor_amount_rect_options_BackgroundColorProcessorDefaultsSet() { - this.operations.BackgroundColor(Rgba32.BlanchedAlmond, this.rect, this.options); + this.operations.BackgroundColor(this.options, Rgba32.BlanchedAlmond, this.rect); var processor = this.Verify>(this.rect); Assert.Equal(this.options, processor.GraphicsOptions); diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index db469f87e..4e9c3192d 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -36,6 +36,8 @@ namespace SixLabors.ImageSharp.Tests public const string SnakeGame = "Png/SnakeGame.png"; public const string Icon = "Png/icon.png"; public const string Kaboom = "Png/kaboom.png"; + public const string PDSrc = "Png/pd-source.png"; + public const string PDDest = "Png/pd-dest.png"; // Filtered test images from http://www.schaik.com/pngsuite/pngsuite_fil_png.html public const string Filter0 = "Png/filter0.png"; diff --git a/tests/Images/External b/tests/Images/External index e9f33352b..5a66c9c6d 160000 --- a/tests/Images/External +++ b/tests/Images/External @@ -1 +1 @@ -Subproject commit e9f33352b77a5176508d2d5dcafbd1bd33805530 +Subproject commit 5a66c9c6da02bf27345f90adc05d415c0d0450ea diff --git a/tests/Images/Input/Png/pd-dest.png b/tests/Images/Input/Png/pd-dest.png new file mode 100644 index 000000000..8db8ce173 Binary files /dev/null and b/tests/Images/Input/Png/pd-dest.png differ diff --git a/tests/Images/Input/Png/pd-source.png b/tests/Images/Input/Png/pd-source.png new file mode 100644 index 000000000..aa47f7ea5 Binary files /dev/null and b/tests/Images/Input/Png/pd-source.png differ