From bf9b3cfd3ff92080882e56dd5432d58f5dd86ab6 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sun, 18 Mar 2018 22:15:53 +1100 Subject: [PATCH] Move GraphicsOptions parameter --- .../Drawing/DrawBezierExtensions.cs | 18 ++++---- .../Processing/Drawing/DrawImageExtensions.cs | 8 ++-- .../Processing/Drawing/DrawLineExtensions.cs | 20 ++++----- .../Drawing/DrawPathCollectionExtensions.cs | 20 ++++----- .../Processing/Drawing/DrawPathExtensions.cs | 22 +++++----- .../Drawing/DrawPolygonExtensions.cs | 20 ++++----- .../Drawing/DrawRectangleExtensions.cs | 20 ++++----- .../Drawing/FillPathBuilderExtensions.cs | 14 +++--- .../Drawing/FillPathCollectionExtensions.cs | 14 +++--- .../Processing/Drawing/FillPathExtensions.cs | 14 +++--- .../Drawing/FillPolygonExtensions.cs | 12 ++--- .../Drawing/FillRectangleExtensions.cs | 12 ++--- .../Drawing/FillRegionExtensions.cs | 18 ++++---- .../Text/DrawTextExtensions.Path.cs | 34 +++++++------- .../Processing/Text/DrawTextExtensions.cs | 34 +++++++------- .../Overlays/BackgroundColorExtensions.cs | 12 ++--- .../Processing/Overlays/GlowExtensions.cs | 44 +++++++++---------- .../Processing/Overlays/VignetteExtensions.cs | 38 ++++++++-------- .../ImageSharp.Tests/Drawing/BlendedShapes.cs | 31 +++---------- tests/ImageSharp.Tests/Drawing/LineTests.cs | 16 ++++--- .../Drawing/Paths/FillPath.cs | 4 +- .../Drawing/Paths/FillPathCollection.cs | 6 +-- .../Drawing/Paths/FillPolygon.cs | 4 +- .../Drawing/Paths/FillRectangle.cs | 4 +- .../Drawing/SolidPolygonTests.cs | 6 +-- .../Drawing/Text/DrawText.Path.cs | 22 +++++----- .../ImageSharp.Tests/Drawing/Text/DrawText.cs | 22 +++++----- tests/ImageSharp.Tests/Issues/Issue412.cs | 8 ++-- .../Processing/Effects/BackgroundColorTest.cs | 4 +- 29 files changed, 243 insertions(+), 258 deletions(-) diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawBezierExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/DrawBezierExtensions.cs index 8f075d5c2..37fade35e 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, 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 @@ -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, 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, 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 diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs index 618768206..e2951ee2c 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs @@ -42,10 +42,10 @@ 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 Blend(this IImageProcessingContext source, GraphicsOptions options, Image image) where TPixel : struct, IPixel { return source.ApplyProcessor(new DrawImageProcessor(image, options)); @@ -82,12 +82,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..7acbd0e85 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, 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 @@ -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, 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, 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 @@ -93,4 +93,4 @@ namespace SixLabors.ImageSharp.Processing.Drawing 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..504b9cd7e 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, 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. @@ -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, 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. @@ -78,19 +78,19 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The . public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, IPen pen, 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, 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..0b3d493b7 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, 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 @@ -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, 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 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/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/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/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);