From 22151ad44accdab6d181ef4254314511be6a32d3 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 11 Nov 2019 12:48:09 +1100 Subject: [PATCH] Normalize GraphicsOptions parameter position --- .../Processing/BrushApplicator.cs | 4 ++-- .../Processing/EllipticGradientBrush.cs | 14 +++++------ .../Extensions/FillRegionExtensions.cs | 8 +++---- .../Processing/GradientBrush.cs | 12 +++++----- src/ImageSharp.Drawing/Processing/IBrush.cs | 6 ++--- .../Processing/ImageBrush.cs | 16 ++++++------- .../Processing/LinearGradientBrush.cs | 24 +++++++++---------- .../Processing/PathGradientBrush.cs | 14 +++++------ .../Processing/PatternBrush.cs | 16 ++++++------- .../Processors/Drawing/FillProcessor.cs | 4 ++-- .../Drawing/FillProcessor{TPixel}.cs | 4 ++-- .../Processors/Drawing/FillRegionProcessor.cs | 4 ++-- .../Drawing/FillRegionProcessor{TPixel}.cs | 2 +- .../Text/DrawTextProcessor{TPixel}.cs | 2 +- .../Processing/RadialGradientBrush.cs | 16 ++++++------- .../Processing/RecolorBrush.cs | 16 ++++++------- .../Processing/SolidBrush.cs | 14 +++++------ .../Extensions/BackgroundColorExtensions.cs | 4 ++-- .../Processing/Extensions/GlowExtensions.cs | 8 +++---- .../Extensions/VignetteExtensions.cs | 8 +++---- .../Overlays/BackgroundColorProcessor.cs | 4 ++-- .../Processors/Overlays/GlowProcessor.cs | 14 +++++------ .../Processors/Overlays/VignetteProcessor.cs | 10 ++++---- .../Drawing/FillRegionProcessorTests.cs | 6 ++--- 24 files changed, 115 insertions(+), 115 deletions(-) diff --git a/src/ImageSharp.Drawing/Processing/BrushApplicator.cs b/src/ImageSharp.Drawing/Processing/BrushApplicator.cs index 2b02c14fe1..a9df07ced3 100644 --- a/src/ImageSharp.Drawing/Processing/BrushApplicator.cs +++ b/src/ImageSharp.Drawing/Processing/BrushApplicator.cs @@ -21,9 +21,9 @@ namespace SixLabors.ImageSharp.Processing /// Initializes a new instance of the class. /// /// The configuration instance to use when performing operations. + /// The graphics options. /// The target. - /// The options. - internal BrushApplicator(Configuration configuration, ImageFrame target, GraphicsOptions options) + internal BrushApplicator(Configuration configuration, GraphicsOptions options, ImageFrame target) { this.Configuration = configuration; this.Target = target; diff --git a/src/ImageSharp.Drawing/Processing/EllipticGradientBrush.cs b/src/ImageSharp.Drawing/Processing/EllipticGradientBrush.cs index 7810c3c6d5..30902e4117 100644 --- a/src/ImageSharp.Drawing/Processing/EllipticGradientBrush.cs +++ b/src/ImageSharp.Drawing/Processing/EllipticGradientBrush.cs @@ -48,18 +48,18 @@ namespace SixLabors.ImageSharp.Processing /// public override BrushApplicator CreateApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, - RectangleF region, - GraphicsOptions options) => + RectangleF region) => new RadialGradientBrushApplicator( configuration, + options, source, this.center, this.referenceAxisEnd, this.axisRatio, this.ColorStops, - this.RepetitionMode, - options); + this.RepetitionMode); /// private sealed class RadialGradientBrushApplicator : GradientBrushApplicator @@ -100,14 +100,14 @@ namespace SixLabors.ImageSharp.Processing /// The graphics options. public RadialGradientBrushApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame target, PointF center, PointF referenceAxisEnd, float axisRatio, ColorStop[] colorStops, - GradientRepetitionMode repetitionMode, - GraphicsOptions options) - : base(configuration, target, colorStops, repetitionMode, options) + GradientRepetitionMode repetitionMode) + : base(configuration, options, target, colorStops, repetitionMode) { this.center = center; this.referenceAxisEnd = referenceAxisEnd; diff --git a/src/ImageSharp.Drawing/Processing/Extensions/FillRegionExtensions.cs b/src/ImageSharp.Drawing/Processing/Extensions/FillRegionExtensions.cs index f5dd76318c..fbb6dbda56 100644 --- a/src/ImageSharp.Drawing/Processing/Extensions/FillRegionExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Extensions/FillRegionExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.Primitives; @@ -77,7 +77,7 @@ namespace SixLabors.ImageSharp.Processing GraphicsOptions options, IBrush brush, Region region) => - source.ApplyProcessor(new FillRegionProcessor(brush, region, options)); + source.ApplyProcessor(new FillRegionProcessor(options, brush, region)); /// /// Flood fills the image with the specified brush. @@ -90,6 +90,6 @@ namespace SixLabors.ImageSharp.Processing this IImageProcessingContext source, GraphicsOptions options, IBrush brush) => - source.ApplyProcessor(new FillProcessor(brush, options)); + source.ApplyProcessor(new FillProcessor(options, brush)); } -} \ No newline at end of file +} diff --git a/src/ImageSharp.Drawing/Processing/GradientBrush.cs b/src/ImageSharp.Drawing/Processing/GradientBrush.cs index f17adf6335..3be56c0424 100644 --- a/src/ImageSharp.Drawing/Processing/GradientBrush.cs +++ b/src/ImageSharp.Drawing/Processing/GradientBrush.cs @@ -37,9 +37,9 @@ namespace SixLabors.ImageSharp.Processing /// public abstract BrushApplicator CreateApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, - RectangleF region, - GraphicsOptions options) + RectangleF region) where TPixel : struct, IPixel; /// @@ -58,17 +58,17 @@ namespace SixLabors.ImageSharp.Processing /// Initializes a new instance of the class. /// /// The configuration instance to use when performing operations. + /// The graphics options. /// The target image. /// An array of color stops sorted by their position. /// Defines if and how the gradient should be repeated. - /// The graphics options. protected GradientBrushApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame target, ColorStop[] colorStops, - GradientRepetitionMode repetitionMode, - GraphicsOptions options) - : base(configuration, target, options) + GradientRepetitionMode repetitionMode) + : base(configuration, options, target) { this.colorStops = colorStops; // TODO: requires colorStops to be sorted by position - should that be checked? this.repetitionMode = repetitionMode; diff --git a/src/ImageSharp.Drawing/Processing/IBrush.cs b/src/ImageSharp.Drawing/Processing/IBrush.cs index f2fdc32f05..f4c7ef7cbb 100644 --- a/src/ImageSharp.Drawing/Processing/IBrush.cs +++ b/src/ImageSharp.Drawing/Processing/IBrush.cs @@ -20,9 +20,9 @@ namespace SixLabors.ImageSharp.Processing /// /// The pixel type. /// The configuration instance to use when performing operations. + /// The graphic options. /// The source image. /// The region the brush will be applied to. - /// The graphic options /// /// The for this brush. /// @@ -32,9 +32,9 @@ namespace SixLabors.ImageSharp.Processing /// BrushApplicator CreateApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, - RectangleF region, - GraphicsOptions options) + RectangleF region) where TPixel : struct, IPixel; } } diff --git a/src/ImageSharp.Drawing/Processing/ImageBrush.cs b/src/ImageSharp.Drawing/Processing/ImageBrush.cs index f23fb1f18d..e38614070f 100644 --- a/src/ImageSharp.Drawing/Processing/ImageBrush.cs +++ b/src/ImageSharp.Drawing/Processing/ImageBrush.cs @@ -32,19 +32,19 @@ namespace SixLabors.ImageSharp.Processing /// public BrushApplicator CreateApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, - RectangleF region, - GraphicsOptions options) + RectangleF region) where TPixel : struct, IPixel { if (this.image is Image specificImage) { - return new ImageBrushApplicator(configuration, source, specificImage, region, false, options); + return new ImageBrushApplicator(configuration, options, source, specificImage, region, false); } specificImage = this.image.CloneAs(); - return new ImageBrushApplicator(configuration, source, specificImage, region, true, options); + return new ImageBrushApplicator(configuration, options, source, specificImage, region, true); } /// @@ -85,19 +85,19 @@ namespace SixLabors.ImageSharp.Processing /// Initializes a new instance of the class. /// /// The configuration instance to use when performing operations. + /// The graphics options. /// The target image. /// The image. /// The region. /// Whether to dispose the image on disposal of the applicator. - /// The graphics options. public ImageBrushApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame target, Image image, RectangleF region, - bool shouldDisposeImage, - GraphicsOptions options) - : base(configuration, target, options) + bool shouldDisposeImage) + : base(configuration, options, target) { this.sourceImage = image; this.sourceFrame = image.Frames.RootFrame; diff --git a/src/ImageSharp.Drawing/Processing/LinearGradientBrush.cs b/src/ImageSharp.Drawing/Processing/LinearGradientBrush.cs index bf6a6356ac..044bee72c5 100644 --- a/src/ImageSharp.Drawing/Processing/LinearGradientBrush.cs +++ b/src/ImageSharp.Drawing/Processing/LinearGradientBrush.cs @@ -40,17 +40,17 @@ namespace SixLabors.ImageSharp.Processing /// public override BrushApplicator CreateApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, - RectangleF region, - GraphicsOptions options) => + RectangleF region) => new LinearGradientBrushApplicator( configuration, + options, source, this.p1, this.p2, this.ColorStops, - this.RepetitionMode, - options); + this.RepetitionMode); /// /// The linear gradient brush applicator. @@ -96,21 +96,21 @@ namespace SixLabors.ImageSharp.Processing /// Initializes a new instance of the class. /// /// The configuration instance to use when performing operations. + /// The graphics options. /// The source image. - /// start point of the gradient. - /// end point of the gradient. - /// tuple list of colors and their respective position between 0 and 1 on the line. - /// defines how the gradient colors are repeated. - /// the graphics options. + /// The start point of the gradient. + /// The end point of the gradient. + /// A tuple list of colors and their respective position between 0 and 1 on the line. + /// Defines how the gradient colors are repeated. public LinearGradientBrushApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, PointF start, PointF end, ColorStop[] colorStops, - GradientRepetitionMode repetitionMode, - GraphicsOptions options) - : base(configuration, source, colorStops, repetitionMode, options) + GradientRepetitionMode repetitionMode) + : base(configuration, options, source, colorStops, repetitionMode) { this.start = start; this.end = end; diff --git a/src/ImageSharp.Drawing/Processing/PathGradientBrush.cs b/src/ImageSharp.Drawing/Processing/PathGradientBrush.cs index be1af50118..9e354120e6 100644 --- a/src/ImageSharp.Drawing/Processing/PathGradientBrush.cs +++ b/src/ImageSharp.Drawing/Processing/PathGradientBrush.cs @@ -84,12 +84,12 @@ namespace SixLabors.ImageSharp.Processing /// public BrushApplicator CreateApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, - RectangleF region, - GraphicsOptions options) + RectangleF region) where TPixel : struct, IPixel { - return new PathGradientBrushApplicator(configuration, source, this.edges, this.centerColor, options); + return new PathGradientBrushApplicator(configuration, options, source, this.edges, this.centerColor); } private static Color CalculateCenterColor(Color[] colors) @@ -201,17 +201,17 @@ namespace SixLabors.ImageSharp.Processing /// Initializes a new instance of the class. /// /// The configuration instance to use when performing operations. + /// The graphics options. /// The source image. /// Edges of the polygon. /// Color at the center of the gradient area to which the other colors converge. - /// The graphics options. public PathGradientBrushApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, IList edges, - Color centerColor, - GraphicsOptions options) - : base(configuration, source, options) + Color centerColor) + : base(configuration, options, source) { this.edges = edges; diff --git a/src/ImageSharp.Drawing/Processing/PatternBrush.cs b/src/ImageSharp.Drawing/Processing/PatternBrush.cs index 9024036d02..726df5a797 100644 --- a/src/ImageSharp.Drawing/Processing/PatternBrush.cs +++ b/src/ImageSharp.Drawing/Processing/PatternBrush.cs @@ -93,15 +93,15 @@ namespace SixLabors.ImageSharp.Processing /// public BrushApplicator CreateApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, - RectangleF region, - GraphicsOptions options) + RectangleF region) where TPixel : struct, IPixel => new PatternBrushApplicator( configuration, + options, source, - this.pattern.ToPixelMatrix(configuration), - options); + this.pattern.ToPixelMatrix(configuration)); /// /// The pattern brush applicator. @@ -118,15 +118,15 @@ namespace SixLabors.ImageSharp.Processing /// Initializes a new instance of the class. /// /// The configuration instance to use when performing operations. + /// The graphics options. /// The source image. /// The pattern. - /// The graphics options. public PatternBrushApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, - in DenseMatrix pattern, - GraphicsOptions options) - : base(configuration, source, options) + in DenseMatrix pattern) + : base(configuration, options, source) { this.pattern = pattern; } diff --git a/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillProcessor.cs b/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillProcessor.cs index 1d3cf35576..3963f99a5c 100644 --- a/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillProcessor.cs +++ b/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillProcessor.cs @@ -15,9 +15,9 @@ namespace SixLabors.ImageSharp.Processing.Processors.Drawing /// /// Initializes a new instance of the class. /// - /// The brush to use for filling. /// The defining how to blend the brush pixels over the image pixels. - public FillProcessor(IBrush brush, GraphicsOptions options) + /// The brush to use for filling. + public FillProcessor(GraphicsOptions options, IBrush brush) { this.Brush = brush; this.Options = options; diff --git a/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillProcessor{TPixel}.cs b/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillProcessor{TPixel}.cs index 0309c561aa..fc94826187 100644 --- a/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillProcessor{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillProcessor{TPixel}.cs @@ -85,9 +85,9 @@ namespace SixLabors.ImageSharp.Processing.Processors.Drawing using (IMemoryOwner amount = source.MemoryAllocator.Allocate(width)) using (BrushApplicator applicator = brush.CreateApplicator( configuration, + options, source, - sourceRectangle, - options)) + sourceRectangle)) { amount.Memory.Span.Fill(1f); diff --git a/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor.cs b/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor.cs index 2318f3168b..7d51be1c51 100644 --- a/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor.cs +++ b/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor.cs @@ -16,10 +16,10 @@ namespace SixLabors.ImageSharp.Processing.Processors.Drawing /// /// Initializes a new instance of the class. /// + /// The graphics options. /// The details how to fill the region of interest. /// The region of interest to be filled. - /// The configuration options. - public FillRegionProcessor(IBrush brush, Region region, GraphicsOptions options) + public FillRegionProcessor(GraphicsOptions options, IBrush brush, Region region) { this.Region = region; this.Brush = brush; diff --git a/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor{TPixel}.cs b/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor{TPixel}.cs index 8c665826fe..4744a4e920 100644 --- a/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor{TPixel}.cs @@ -71,7 +71,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Drawing } } - using (BrushApplicator applicator = brush.CreateApplicator(configuration, source, rect, options)) + using (BrushApplicator applicator = brush.CreateApplicator(configuration, options, source, rect)) { int scanlineWidth = maxX - minX; using (IMemoryOwner bBuffer = source.MemoryAllocator.Allocate(maxIntersections)) diff --git a/src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor{TPixel}.cs b/src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor{TPixel}.cs index 244e18b81c..64d32efb80 100644 --- a/src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor{TPixel}.cs @@ -83,7 +83,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Text { if (operations?.Count > 0) { - using (BrushApplicator app = brush.CreateApplicator(this.Configuration, source, this.SourceRectangle, this.textRenderer.Options)) + using (BrushApplicator app = brush.CreateApplicator(this.Configuration, this.textRenderer.Options, source, this.SourceRectangle)) { foreach (DrawingOperation operation in operations) { diff --git a/src/ImageSharp.Drawing/Processing/RadialGradientBrush.cs b/src/ImageSharp.Drawing/Processing/RadialGradientBrush.cs index 7f1fa818eb..2b1b6913f8 100644 --- a/src/ImageSharp.Drawing/Processing/RadialGradientBrush.cs +++ b/src/ImageSharp.Drawing/Processing/RadialGradientBrush.cs @@ -36,17 +36,17 @@ namespace SixLabors.ImageSharp.Processing /// public override BrushApplicator CreateApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, - RectangleF region, - GraphicsOptions options) => + RectangleF region) => new RadialGradientBrushApplicator( configuration, + options, source, this.center, this.radius, this.ColorStops, - this.RepetitionMode, - options); + this.RepetitionMode); /// private sealed class RadialGradientBrushApplicator : GradientBrushApplicator @@ -60,21 +60,21 @@ namespace SixLabors.ImageSharp.Processing /// Initializes a new instance of the class. /// /// The configuration instance to use when performing operations. + /// The graphics options. /// The target image. /// Center point of the gradient. /// Radius of the gradient. /// Definition of colors. /// How the colors are repeated beyond the first gradient. - /// The graphics options. public RadialGradientBrushApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame target, PointF center, float radius, ColorStop[] colorStops, - GradientRepetitionMode repetitionMode, - GraphicsOptions options) - : base(configuration, target, colorStops, repetitionMode, options) + GradientRepetitionMode repetitionMode) + : base(configuration, options, target, colorStops, repetitionMode) { this.center = center; this.radius = radius; diff --git a/src/ImageSharp.Drawing/Processing/RecolorBrush.cs b/src/ImageSharp.Drawing/Processing/RecolorBrush.cs index 1ad613bf82..e0e43cf780 100644 --- a/src/ImageSharp.Drawing/Processing/RecolorBrush.cs +++ b/src/ImageSharp.Drawing/Processing/RecolorBrush.cs @@ -47,18 +47,18 @@ namespace SixLabors.ImageSharp.Processing /// public BrushApplicator CreateApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, - RectangleF region, - GraphicsOptions options) + RectangleF region) where TPixel : struct, IPixel { return new RecolorBrushApplicator( configuration, + options, source, this.SourceColor.ToPixel(), this.TargetColor.ToPixel(), - this.Threshold, - options); + this.Threshold); } /// @@ -83,19 +83,19 @@ namespace SixLabors.ImageSharp.Processing /// Initializes a new instance of the class. /// /// The configuration instance to use when performing operations. + /// The options /// The source image. /// Color of the source. /// Color of the target. /// The threshold . - /// The options public RecolorBrushApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, TPixel sourceColor, TPixel targetColor, - float threshold, - GraphicsOptions options) - : base(configuration, source, options) + float threshold) + : base(configuration, options, source) { this.sourceColor = sourceColor.ToVector4(); this.targetColorPixel = targetColor; diff --git a/src/ImageSharp.Drawing/Processing/SolidBrush.cs b/src/ImageSharp.Drawing/Processing/SolidBrush.cs index a2be775daa..c297ede211 100644 --- a/src/ImageSharp.Drawing/Processing/SolidBrush.cs +++ b/src/ImageSharp.Drawing/Processing/SolidBrush.cs @@ -33,12 +33,12 @@ namespace SixLabors.ImageSharp.Processing /// public BrushApplicator CreateApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, - RectangleF region, - GraphicsOptions options) + RectangleF region) where TPixel : struct, IPixel { - return new SolidBrushApplicator(configuration, source, this.Color.ToPixel(), options); + return new SolidBrushApplicator(configuration, options, source, this.Color.ToPixel()); } /// @@ -53,15 +53,15 @@ namespace SixLabors.ImageSharp.Processing /// Initializes a new instance of the class. /// /// The configuration instance to use when performing operations. + /// The graphics options. /// The source image. /// The color. - /// The graphics options. public SolidBrushApplicator( Configuration configuration, + GraphicsOptions options, ImageFrame source, - TPixel color, - GraphicsOptions options) - : base(configuration, source, options) + TPixel color) + : base(configuration, options, source) { this.Colors = source.MemoryAllocator.Allocate(source.Width); this.Colors.Memory.Span.Fill(color); diff --git a/src/ImageSharp/Processing/Extensions/BackgroundColorExtensions.cs b/src/ImageSharp/Processing/Extensions/BackgroundColorExtensions.cs index cc2fb25120..4241721f46 100644 --- a/src/ImageSharp/Processing/Extensions/BackgroundColorExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/BackgroundColorExtensions.cs @@ -47,7 +47,7 @@ namespace SixLabors.ImageSharp.Processing this IImageProcessingContext source, GraphicsOptions options, Color color) => - source.ApplyProcessor(new BackgroundColorProcessor(color, options)); + source.ApplyProcessor(new BackgroundColorProcessor(options, color)); /// /// Replaces the background color of image with the given one. @@ -64,6 +64,6 @@ namespace SixLabors.ImageSharp.Processing GraphicsOptions options, Color color, Rectangle rectangle) => - source.ApplyProcessor(new BackgroundColorProcessor(color, options), rectangle); + source.ApplyProcessor(new BackgroundColorProcessor(options, color), rectangle); } } diff --git a/src/ImageSharp/Processing/Extensions/GlowExtensions.cs b/src/ImageSharp/Processing/Extensions/GlowExtensions.cs index 90b73794ba..48ecb5108f 100644 --- a/src/ImageSharp/Processing/Extensions/GlowExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/GlowExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.Primitives; @@ -155,7 +155,7 @@ namespace SixLabors.ImageSharp.Processing Color color, ValueSize radius, Rectangle rectangle) => - source.ApplyProcessor(new GlowProcessor(color, radius, options), rectangle); + source.ApplyProcessor(new GlowProcessor(options, color, radius), rectangle); /// /// Applies a radial glow effect to an image. @@ -170,6 +170,6 @@ namespace SixLabors.ImageSharp.Processing GraphicsOptions options, Color color, ValueSize radius) => - source.ApplyProcessor(new GlowProcessor(color, radius, options)); + source.ApplyProcessor(new GlowProcessor(options, color, radius)); } -} \ No newline at end of file +} diff --git a/src/ImageSharp/Processing/Extensions/VignetteExtensions.cs b/src/ImageSharp/Processing/Extensions/VignetteExtensions.cs index ffab8e2bf9..a1f3a6e8a0 100644 --- a/src/ImageSharp/Processing/Extensions/VignetteExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/VignetteExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors and contributors. +// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.Primitives; @@ -166,7 +166,7 @@ namespace SixLabors.ImageSharp.Processing ValueSize radiusX, ValueSize radiusY, Rectangle rectangle) => - source.ApplyProcessor(new VignetteProcessor(color, radiusX, radiusY, options), rectangle); + source.ApplyProcessor(new VignetteProcessor(options, color, radiusX, radiusY), rectangle); private static IImageProcessingContext VignetteInternal( this IImageProcessingContext source, @@ -174,6 +174,6 @@ namespace SixLabors.ImageSharp.Processing Color color, ValueSize radiusX, ValueSize radiusY) => - source.ApplyProcessor(new VignetteProcessor(color, radiusX, radiusY, options)); + source.ApplyProcessor(new VignetteProcessor(options, color, radiusX, radiusY)); } -} \ No newline at end of file +} diff --git a/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs index 4b4c537277..e78f7e5e75 100644 --- a/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs @@ -14,9 +14,9 @@ namespace SixLabors.ImageSharp.Processing.Processors.Overlays /// /// Initializes a new instance of the class. /// - /// The to set the background color to. /// The options defining blending algorithm and amount. - public BackgroundColorProcessor(Color color, GraphicsOptions options) + /// The to set the background color to. + public BackgroundColorProcessor(GraphicsOptions options, Color color) { this.Color = color; this.GraphicsOptions = options; diff --git a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs index 1a60b79aca..4b9a23eff1 100644 --- a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs @@ -24,10 +24,10 @@ namespace SixLabors.ImageSharp.Processing.Processors.Overlays /// /// Initializes a new instance of the class. /// - /// The color or the glow. /// The options effecting blending and composition. - public GlowProcessor(Color color, GraphicsOptions options) - : this(color, 0, options) + /// The color or the glow. + public GlowProcessor(GraphicsOptions options, Color color) + : this(options, color, 0) { } @@ -37,17 +37,17 @@ namespace SixLabors.ImageSharp.Processing.Processors.Overlays /// The color or the glow. /// The radius of the glow. internal GlowProcessor(Color color, ValueSize radius) - : this(color, radius, new GraphicsOptions()) + : this(new GraphicsOptions(), color, radius) { } /// /// Initializes a new instance of the class. /// + /// The options effecting blending and composition. /// The color or the glow. /// The radius of the glow. - /// The options effecting blending and composition. - internal GlowProcessor(Color color, ValueSize radius, GraphicsOptions options) + internal GlowProcessor(GraphicsOptions options, Color color, ValueSize radius) { this.GlowColor = color; this.Radius = radius; @@ -67,7 +67,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Overlays /// /// Gets the the radius. /// - internal ValueSize Radius { get; } + internal ValueSize Radius { get; } /// public IImageProcessor CreatePixelSpecificProcessor(Image source, Rectangle sourceRectangle) diff --git a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs index e1c836ff56..3cf48e5a40 100644 --- a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs @@ -17,16 +17,16 @@ namespace SixLabors.ImageSharp.Processing.Processors.Overlays /// /// The color of the vignette. public VignetteProcessor(Color color) - : this(color, new GraphicsOptions()) + : this(new GraphicsOptions(), color) { } /// /// Initializes a new instance of the class. /// - /// The color of the vignette. /// The options effecting blending and composition. - public VignetteProcessor(Color color, GraphicsOptions options) + /// The color of the vignette. + public VignetteProcessor(GraphicsOptions options, Color color) { this.VignetteColor = color; this.GraphicsOptions = options; @@ -35,11 +35,11 @@ namespace SixLabors.ImageSharp.Processing.Processors.Overlays /// /// Initializes a new instance of the class. /// + /// The options effecting blending and composition. /// The color of the vignette. /// The x-radius. /// The y-radius. - /// The options effecting blending and composition. - internal VignetteProcessor(Color color, ValueSize radiusX, ValueSize radiusY, GraphicsOptions options) + internal VignetteProcessor(GraphicsOptions options, Color color, ValueSize radiusX, ValueSize radiusY) { this.VignetteColor = color; this.RadiusX = radiusX; diff --git a/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs b/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs index 6230d52a17..e259d29d9c 100644 --- a/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs @@ -38,7 +38,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing Antialias = antialias, AntialiasSubpixelDepth = 1 }; - var processor = new FillRegionProcessor(brush.Object, region, options); + var processor = new FillRegionProcessor(options, brush.Object, region); var img = new Image(1, 1); processor.Execute(img, bounds); @@ -51,7 +51,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing var bounds = new Rectangle(-100, -10, 10, 10); var brush = new Mock(); var options = new GraphicsOptions { Antialias = true }; - var processor = new FillRegionProcessor(brush.Object, new MockRegion1(), options); + var processor = new FillRegionProcessor(options, brush.Object, new MockRegion1()); var img = new Image(10, 10); processor.Execute(img, bounds); } @@ -72,7 +72,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing public void DoesNotThrowForIssue928() { var rectText = new RectangleF(0, 0, 2000, 2000); - using (Image img = new Image((int)rectText.Width, (int)rectText.Height)) + using (var img = new Image((int)rectText.Width, (int)rectText.Height)) { img.Mutate(x => x.Fill(Rgba32.Transparent));