From 3ed4f3cf7343008986660c64b0c637dd1f7eadb2 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 11 Nov 2019 13:02:13 +1100 Subject: [PATCH] Prevent duplicate ctr in extensions --- .../Processing/EllipticGradientBrush.cs | 2 +- .../Extensions/DrawImageExtensions.cs | 36 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/ImageSharp.Drawing/Processing/EllipticGradientBrush.cs b/src/ImageSharp.Drawing/Processing/EllipticGradientBrush.cs index 30902e4117..fbab3605d2 100644 --- a/src/ImageSharp.Drawing/Processing/EllipticGradientBrush.cs +++ b/src/ImageSharp.Drawing/Processing/EllipticGradientBrush.cs @@ -89,6 +89,7 @@ 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 of the ellipse. /// Point on one angular points of the ellipse. @@ -97,7 +98,6 @@ namespace SixLabors.ImageSharp.Processing /// the first is defined by and . /// Definition of colors. /// Defines how the gradient colors are repeated. - /// The graphics options. public RadialGradientBrushApplicator( Configuration configuration, GraphicsOptions options, diff --git a/src/ImageSharp.Drawing/Processing/Extensions/DrawImageExtensions.cs b/src/ImageSharp.Drawing/Processing/Extensions/DrawImageExtensions.cs index 6c694ab73b..6c79984378 100644 --- a/src/ImageSharp.Drawing/Processing/Extensions/DrawImageExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Extensions/DrawImageExtensions.cs @@ -22,14 +22,17 @@ namespace SixLabors.ImageSharp.Processing public static IImageProcessingContext DrawImage( this IImageProcessingContext source, Image image, - float opacity) => - source.ApplyProcessor( + float opacity) + { + var options = new GraphicsOptions(); + return source.ApplyProcessor( new DrawImageProcessor( - image, - Point.Empty, - new GraphicsOptions().ColorBlendingMode, - new GraphicsOptions().AlphaCompositionMode, - opacity)); + image, + Point.Empty, + options.ColorBlendingMode, + options.AlphaCompositionMode, + opacity)); + } /// /// Draws the given image together with the current one by blending their pixels. @@ -100,14 +103,17 @@ namespace SixLabors.ImageSharp.Processing this IImageProcessingContext source, Image image, Point location, - float opacity) => - source.ApplyProcessor( + float opacity) + { + var options = new GraphicsOptions(); + return source.ApplyProcessor( new DrawImageProcessor( - image, - location, - new GraphicsOptions().ColorBlendingMode, - new GraphicsOptions().AlphaCompositionMode, - opacity)); + image, + location, + options.ColorBlendingMode, + options.AlphaCompositionMode, + opacity)); + } /// /// Draws the given image together with the current one by blending their pixels. @@ -172,4 +178,4 @@ namespace SixLabors.ImageSharp.Processing options.AlphaCompositionMode, options.BlendPercentage)); } -} \ No newline at end of file +}