Skip to content

Commit 0049ca2

Browse files
Prevent duplicate ctr in extensions
1 parent 86a4cb2 commit 0049ca2

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

src/ImageSharp.Drawing/Processing/EllipticGradientBrush.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ private sealed class RadialGradientBrushApplicator<TPixel> : GradientBrushApplic
8989
/// Initializes a new instance of the <see cref="RadialGradientBrushApplicator{TPixel}" /> class.
9090
/// </summary>
9191
/// <param name="configuration">The configuration instance to use when performing operations.</param>
92+
/// <param name="options">The graphics options.</param>
9293
/// <param name="target">The target image.</param>
9394
/// <param name="center">Center of the ellipse.</param>
9495
/// <param name="referenceAxisEnd">Point on one angular points of the ellipse.</param>
@@ -97,7 +98,6 @@ private sealed class RadialGradientBrushApplicator<TPixel> : GradientBrushApplic
9798
/// the first is defined by <see cref="center"/> and <see cref="referenceAxisEnd"/>.</param>
9899
/// <param name="colorStops">Definition of colors.</param>
99100
/// <param name="repetitionMode">Defines how the gradient colors are repeated.</param>
100-
/// <param name="options">The graphics options.</param>
101101
public RadialGradientBrushApplicator(
102102
Configuration configuration,
103103
GraphicsOptions options,

src/ImageSharp.Drawing/Processing/Extensions/DrawImageExtensions.cs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ public static class DrawImageExtensions
2222
public static IImageProcessingContext DrawImage(
2323
this IImageProcessingContext source,
2424
Image image,
25-
float opacity) =>
26-
source.ApplyProcessor(
25+
float opacity)
26+
{
27+
var options = new GraphicsOptions();
28+
return source.ApplyProcessor(
2729
new DrawImageProcessor(
28-
image,
29-
Point.Empty,
30-
new GraphicsOptions().ColorBlendingMode,
31-
new GraphicsOptions().AlphaCompositionMode,
32-
opacity));
30+
image,
31+
Point.Empty,
32+
options.ColorBlendingMode,
33+
options.AlphaCompositionMode,
34+
opacity));
35+
}
3336

3437
/// <summary>
3538
/// Draws the given image together with the current one by blending their pixels.
@@ -100,14 +103,17 @@ public static IImageProcessingContext DrawImage(
100103
this IImageProcessingContext source,
101104
Image image,
102105
Point location,
103-
float opacity) =>
104-
source.ApplyProcessor(
106+
float opacity)
107+
{
108+
var options = new GraphicsOptions();
109+
return source.ApplyProcessor(
105110
new DrawImageProcessor(
106-
image,
107-
location,
108-
new GraphicsOptions().ColorBlendingMode,
109-
new GraphicsOptions().AlphaCompositionMode,
110-
opacity));
111+
image,
112+
location,
113+
options.ColorBlendingMode,
114+
options.AlphaCompositionMode,
115+
opacity));
116+
}
111117

112118
/// <summary>
113119
/// Draws the given image together with the current one by blending their pixels.
@@ -172,4 +178,4 @@ public static IImageProcessingContext DrawImage(
172178
options.AlphaCompositionMode,
173179
options.BlendPercentage));
174180
}
175-
}
181+
}

0 commit comments

Comments
 (0)