diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs
index cc6743d56..0aac25bd0 100644
--- a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs
+++ b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs
@@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.NormalSrc(background, source, amount);
+ return PorterDuffFunctions.NormalSrc(background, source, amount.Clamp(0,1));
}
///
@@ -52,7 +52,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.NormalSrc(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.NormalSrc(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -77,7 +77,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.MultiplySrc(background, source, amount);
+ return PorterDuffFunctions.MultiplySrc(background, source, amount.Clamp(0,1));
}
///
@@ -85,7 +85,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.MultiplySrc(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.MultiplySrc(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -110,7 +110,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.AddSrc(background, source, amount);
+ return PorterDuffFunctions.AddSrc(background, source, amount.Clamp(0,1));
}
///
@@ -118,7 +118,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.AddSrc(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.AddSrc(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -143,7 +143,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.SubtractSrc(background, source, amount);
+ return PorterDuffFunctions.SubtractSrc(background, source, amount.Clamp(0,1));
}
///
@@ -151,7 +151,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.SubtractSrc(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.SubtractSrc(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -176,7 +176,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.ScreenSrc(background, source, amount);
+ return PorterDuffFunctions.ScreenSrc(background, source, amount.Clamp(0,1));
}
///
@@ -184,7 +184,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.ScreenSrc(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.ScreenSrc(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -209,7 +209,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DarkenSrc(background, source, amount);
+ return PorterDuffFunctions.DarkenSrc(background, source, amount.Clamp(0,1));
}
///
@@ -217,7 +217,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.DarkenSrc(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.DarkenSrc(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -242,7 +242,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.LightenSrc(background, source, amount);
+ return PorterDuffFunctions.LightenSrc(background, source, amount.Clamp(0,1));
}
///
@@ -250,7 +250,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.LightenSrc(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.LightenSrc(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -275,7 +275,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.OverlaySrc(background, source, amount);
+ return PorterDuffFunctions.OverlaySrc(background, source, amount.Clamp(0,1));
}
///
@@ -283,7 +283,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.OverlaySrc(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.OverlaySrc(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -308,7 +308,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.HardLightSrc(background, source, amount);
+ return PorterDuffFunctions.HardLightSrc(background, source, amount.Clamp(0,1));
}
///
@@ -316,7 +316,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.HardLightSrc(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.HardLightSrc(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -341,7 +341,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.NormalSrcAtop(background, source, amount);
+ return PorterDuffFunctions.NormalSrcAtop(background, source, amount.Clamp(0,1));
}
///
@@ -349,7 +349,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.NormalSrcAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.NormalSrcAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -374,7 +374,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.MultiplySrcAtop(background, source, amount);
+ return PorterDuffFunctions.MultiplySrcAtop(background, source, amount.Clamp(0,1));
}
///
@@ -382,7 +382,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.MultiplySrcAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.MultiplySrcAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -407,7 +407,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.AddSrcAtop(background, source, amount);
+ return PorterDuffFunctions.AddSrcAtop(background, source, amount.Clamp(0,1));
}
///
@@ -415,7 +415,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.AddSrcAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.AddSrcAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -440,7 +440,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.SubtractSrcAtop(background, source, amount);
+ return PorterDuffFunctions.SubtractSrcAtop(background, source, amount.Clamp(0,1));
}
///
@@ -448,7 +448,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.SubtractSrcAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.SubtractSrcAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -473,7 +473,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.ScreenSrcAtop(background, source, amount);
+ return PorterDuffFunctions.ScreenSrcAtop(background, source, amount.Clamp(0,1));
}
///
@@ -481,7 +481,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.ScreenSrcAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.ScreenSrcAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -506,7 +506,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DarkenSrcAtop(background, source, amount);
+ return PorterDuffFunctions.DarkenSrcAtop(background, source, amount.Clamp(0,1));
}
///
@@ -514,7 +514,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.DarkenSrcAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.DarkenSrcAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -539,7 +539,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.LightenSrcAtop(background, source, amount);
+ return PorterDuffFunctions.LightenSrcAtop(background, source, amount.Clamp(0,1));
}
///
@@ -547,7 +547,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.LightenSrcAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.LightenSrcAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -572,7 +572,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.OverlaySrcAtop(background, source, amount);
+ return PorterDuffFunctions.OverlaySrcAtop(background, source, amount.Clamp(0,1));
}
///
@@ -580,7 +580,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.OverlaySrcAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.OverlaySrcAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -605,7 +605,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.HardLightSrcAtop(background, source, amount);
+ return PorterDuffFunctions.HardLightSrcAtop(background, source, amount.Clamp(0,1));
}
///
@@ -613,7 +613,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.HardLightSrcAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.HardLightSrcAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -638,7 +638,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.NormalSrcOver(background, source, amount);
+ return PorterDuffFunctions.NormalSrcOver(background, source, amount.Clamp(0,1));
}
///
@@ -646,7 +646,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.NormalSrcOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.NormalSrcOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -671,7 +671,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.MultiplySrcOver(background, source, amount);
+ return PorterDuffFunctions.MultiplySrcOver(background, source, amount.Clamp(0,1));
}
///
@@ -679,7 +679,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.MultiplySrcOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.MultiplySrcOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -704,7 +704,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.AddSrcOver(background, source, amount);
+ return PorterDuffFunctions.AddSrcOver(background, source, amount.Clamp(0,1));
}
///
@@ -712,7 +712,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.AddSrcOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.AddSrcOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -737,7 +737,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.SubtractSrcOver(background, source, amount);
+ return PorterDuffFunctions.SubtractSrcOver(background, source, amount.Clamp(0,1));
}
///
@@ -745,7 +745,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.SubtractSrcOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.SubtractSrcOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -770,7 +770,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.ScreenSrcOver(background, source, amount);
+ return PorterDuffFunctions.ScreenSrcOver(background, source, amount.Clamp(0,1));
}
///
@@ -778,7 +778,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.ScreenSrcOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.ScreenSrcOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -803,7 +803,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DarkenSrcOver(background, source, amount);
+ return PorterDuffFunctions.DarkenSrcOver(background, source, amount.Clamp(0,1));
}
///
@@ -811,7 +811,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.DarkenSrcOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.DarkenSrcOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -836,7 +836,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.LightenSrcOver(background, source, amount);
+ return PorterDuffFunctions.LightenSrcOver(background, source, amount.Clamp(0,1));
}
///
@@ -844,7 +844,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.LightenSrcOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.LightenSrcOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -869,7 +869,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.OverlaySrcOver(background, source, amount);
+ return PorterDuffFunctions.OverlaySrcOver(background, source, amount.Clamp(0,1));
}
///
@@ -877,7 +877,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.OverlaySrcOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.OverlaySrcOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -902,7 +902,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.HardLightSrcOver(background, source, amount);
+ return PorterDuffFunctions.HardLightSrcOver(background, source, amount.Clamp(0,1));
}
///
@@ -910,7 +910,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.HardLightSrcOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.HardLightSrcOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -935,7 +935,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.NormalSrcIn(background, source, amount);
+ return PorterDuffFunctions.NormalSrcIn(background, source, amount.Clamp(0,1));
}
///
@@ -943,7 +943,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.NormalSrcIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.NormalSrcIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -968,7 +968,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.MultiplySrcIn(background, source, amount);
+ return PorterDuffFunctions.MultiplySrcIn(background, source, amount.Clamp(0,1));
}
///
@@ -976,7 +976,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.MultiplySrcIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.MultiplySrcIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1001,7 +1001,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.AddSrcIn(background, source, amount);
+ return PorterDuffFunctions.AddSrcIn(background, source, amount.Clamp(0,1));
}
///
@@ -1009,7 +1009,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.AddSrcIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.AddSrcIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1034,7 +1034,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.SubtractSrcIn(background, source, amount);
+ return PorterDuffFunctions.SubtractSrcIn(background, source, amount.Clamp(0,1));
}
///
@@ -1042,7 +1042,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.SubtractSrcIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.SubtractSrcIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1067,7 +1067,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.ScreenSrcIn(background, source, amount);
+ return PorterDuffFunctions.ScreenSrcIn(background, source, amount.Clamp(0,1));
}
///
@@ -1075,7 +1075,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.ScreenSrcIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.ScreenSrcIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1100,7 +1100,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DarkenSrcIn(background, source, amount);
+ return PorterDuffFunctions.DarkenSrcIn(background, source, amount.Clamp(0,1));
}
///
@@ -1108,7 +1108,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.DarkenSrcIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.DarkenSrcIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1133,7 +1133,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.LightenSrcIn(background, source, amount);
+ return PorterDuffFunctions.LightenSrcIn(background, source, amount.Clamp(0,1));
}
///
@@ -1141,7 +1141,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.LightenSrcIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.LightenSrcIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1166,7 +1166,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.OverlaySrcIn(background, source, amount);
+ return PorterDuffFunctions.OverlaySrcIn(background, source, amount.Clamp(0,1));
}
///
@@ -1174,7 +1174,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.OverlaySrcIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.OverlaySrcIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1199,7 +1199,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.HardLightSrcIn(background, source, amount);
+ return PorterDuffFunctions.HardLightSrcIn(background, source, amount.Clamp(0,1));
}
///
@@ -1207,7 +1207,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.HardLightSrcIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.HardLightSrcIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1232,7 +1232,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.NormalSrcOut(background, source, amount);
+ return PorterDuffFunctions.NormalSrcOut(background, source, amount.Clamp(0,1));
}
///
@@ -1240,7 +1240,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.NormalSrcOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.NormalSrcOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1265,7 +1265,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.MultiplySrcOut(background, source, amount);
+ return PorterDuffFunctions.MultiplySrcOut(background, source, amount.Clamp(0,1));
}
///
@@ -1273,7 +1273,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.MultiplySrcOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.MultiplySrcOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1298,7 +1298,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.AddSrcOut(background, source, amount);
+ return PorterDuffFunctions.AddSrcOut(background, source, amount.Clamp(0,1));
}
///
@@ -1306,7 +1306,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.AddSrcOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.AddSrcOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1331,7 +1331,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.SubtractSrcOut(background, source, amount);
+ return PorterDuffFunctions.SubtractSrcOut(background, source, amount.Clamp(0,1));
}
///
@@ -1339,7 +1339,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.SubtractSrcOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.SubtractSrcOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1364,7 +1364,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.ScreenSrcOut(background, source, amount);
+ return PorterDuffFunctions.ScreenSrcOut(background, source, amount.Clamp(0,1));
}
///
@@ -1372,7 +1372,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.ScreenSrcOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.ScreenSrcOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1397,7 +1397,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DarkenSrcOut(background, source, amount);
+ return PorterDuffFunctions.DarkenSrcOut(background, source, amount.Clamp(0,1));
}
///
@@ -1405,7 +1405,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.DarkenSrcOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.DarkenSrcOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1430,7 +1430,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.LightenSrcOut(background, source, amount);
+ return PorterDuffFunctions.LightenSrcOut(background, source, amount.Clamp(0,1));
}
///
@@ -1438,7 +1438,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.LightenSrcOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.LightenSrcOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1463,7 +1463,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.OverlaySrcOut(background, source, amount);
+ return PorterDuffFunctions.OverlaySrcOut(background, source, amount.Clamp(0,1));
}
///
@@ -1471,7 +1471,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.OverlaySrcOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.OverlaySrcOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1496,7 +1496,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.HardLightSrcOut(background, source, amount);
+ return PorterDuffFunctions.HardLightSrcOut(background, source, amount.Clamp(0,1));
}
///
@@ -1504,7 +1504,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.HardLightSrcOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.HardLightSrcOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1529,7 +1529,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.NormalDest(background, source, amount);
+ return PorterDuffFunctions.NormalDest(background, source, amount.Clamp(0,1));
}
///
@@ -1537,7 +1537,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.NormalDest(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.NormalDest(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1562,7 +1562,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.MultiplyDest(background, source, amount);
+ return PorterDuffFunctions.MultiplyDest(background, source, amount.Clamp(0,1));
}
///
@@ -1570,7 +1570,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.MultiplyDest(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.MultiplyDest(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1595,7 +1595,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.AddDest(background, source, amount);
+ return PorterDuffFunctions.AddDest(background, source, amount.Clamp(0,1));
}
///
@@ -1603,7 +1603,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.AddDest(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.AddDest(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1628,7 +1628,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.SubtractDest(background, source, amount);
+ return PorterDuffFunctions.SubtractDest(background, source, amount.Clamp(0,1));
}
///
@@ -1636,7 +1636,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.SubtractDest(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.SubtractDest(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1661,7 +1661,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.ScreenDest(background, source, amount);
+ return PorterDuffFunctions.ScreenDest(background, source, amount.Clamp(0,1));
}
///
@@ -1669,7 +1669,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.ScreenDest(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.ScreenDest(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1694,7 +1694,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DarkenDest(background, source, amount);
+ return PorterDuffFunctions.DarkenDest(background, source, amount.Clamp(0,1));
}
///
@@ -1702,7 +1702,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.DarkenDest(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.DarkenDest(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1727,7 +1727,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.LightenDest(background, source, amount);
+ return PorterDuffFunctions.LightenDest(background, source, amount.Clamp(0,1));
}
///
@@ -1735,7 +1735,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.LightenDest(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.LightenDest(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1760,7 +1760,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.OverlayDest(background, source, amount);
+ return PorterDuffFunctions.OverlayDest(background, source, amount.Clamp(0,1));
}
///
@@ -1768,7 +1768,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.OverlayDest(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.OverlayDest(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1793,7 +1793,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.HardLightDest(background, source, amount);
+ return PorterDuffFunctions.HardLightDest(background, source, amount.Clamp(0,1));
}
///
@@ -1801,7 +1801,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.HardLightDest(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.HardLightDest(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1826,7 +1826,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.NormalDestAtop(background, source, amount);
+ return PorterDuffFunctions.NormalDestAtop(background, source, amount.Clamp(0,1));
}
///
@@ -1834,7 +1834,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.NormalDestAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.NormalDestAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1859,7 +1859,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.MultiplyDestAtop(background, source, amount);
+ return PorterDuffFunctions.MultiplyDestAtop(background, source, amount.Clamp(0,1));
}
///
@@ -1867,7 +1867,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.MultiplyDestAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.MultiplyDestAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1892,7 +1892,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.AddDestAtop(background, source, amount);
+ return PorterDuffFunctions.AddDestAtop(background, source, amount.Clamp(0,1));
}
///
@@ -1900,7 +1900,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.AddDestAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.AddDestAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1925,7 +1925,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.SubtractDestAtop(background, source, amount);
+ return PorterDuffFunctions.SubtractDestAtop(background, source, amount.Clamp(0,1));
}
///
@@ -1933,7 +1933,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.SubtractDestAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.SubtractDestAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1958,7 +1958,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.ScreenDestAtop(background, source, amount);
+ return PorterDuffFunctions.ScreenDestAtop(background, source, amount.Clamp(0,1));
}
///
@@ -1966,7 +1966,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.ScreenDestAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.ScreenDestAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -1991,7 +1991,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DarkenDestAtop(background, source, amount);
+ return PorterDuffFunctions.DarkenDestAtop(background, source, amount.Clamp(0,1));
}
///
@@ -1999,7 +1999,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.DarkenDestAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.DarkenDestAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2024,7 +2024,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.LightenDestAtop(background, source, amount);
+ return PorterDuffFunctions.LightenDestAtop(background, source, amount.Clamp(0,1));
}
///
@@ -2032,7 +2032,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.LightenDestAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.LightenDestAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2057,7 +2057,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.OverlayDestAtop(background, source, amount);
+ return PorterDuffFunctions.OverlayDestAtop(background, source, amount.Clamp(0,1));
}
///
@@ -2065,7 +2065,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.OverlayDestAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.OverlayDestAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2090,7 +2090,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.HardLightDestAtop(background, source, amount);
+ return PorterDuffFunctions.HardLightDestAtop(background, source, amount.Clamp(0,1));
}
///
@@ -2098,7 +2098,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.HardLightDestAtop(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.HardLightDestAtop(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2123,7 +2123,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.NormalDestOver(background, source, amount);
+ return PorterDuffFunctions.NormalDestOver(background, source, amount.Clamp(0,1));
}
///
@@ -2131,7 +2131,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.NormalDestOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.NormalDestOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2156,7 +2156,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.MultiplyDestOver(background, source, amount);
+ return PorterDuffFunctions.MultiplyDestOver(background, source, amount.Clamp(0,1));
}
///
@@ -2164,7 +2164,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.MultiplyDestOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.MultiplyDestOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2189,7 +2189,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.AddDestOver(background, source, amount);
+ return PorterDuffFunctions.AddDestOver(background, source, amount.Clamp(0,1));
}
///
@@ -2197,7 +2197,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.AddDestOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.AddDestOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2222,7 +2222,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.SubtractDestOver(background, source, amount);
+ return PorterDuffFunctions.SubtractDestOver(background, source, amount.Clamp(0,1));
}
///
@@ -2230,7 +2230,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.SubtractDestOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.SubtractDestOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2255,7 +2255,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.ScreenDestOver(background, source, amount);
+ return PorterDuffFunctions.ScreenDestOver(background, source, amount.Clamp(0,1));
}
///
@@ -2263,7 +2263,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.ScreenDestOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.ScreenDestOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2288,7 +2288,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DarkenDestOver(background, source, amount);
+ return PorterDuffFunctions.DarkenDestOver(background, source, amount.Clamp(0,1));
}
///
@@ -2296,7 +2296,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.DarkenDestOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.DarkenDestOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2321,7 +2321,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.LightenDestOver(background, source, amount);
+ return PorterDuffFunctions.LightenDestOver(background, source, amount.Clamp(0,1));
}
///
@@ -2329,7 +2329,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.LightenDestOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.LightenDestOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2354,7 +2354,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.OverlayDestOver(background, source, amount);
+ return PorterDuffFunctions.OverlayDestOver(background, source, amount.Clamp(0,1));
}
///
@@ -2362,7 +2362,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.OverlayDestOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.OverlayDestOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2387,7 +2387,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.HardLightDestOver(background, source, amount);
+ return PorterDuffFunctions.HardLightDestOver(background, source, amount.Clamp(0,1));
}
///
@@ -2395,7 +2395,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.HardLightDestOver(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.HardLightDestOver(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2420,7 +2420,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.NormalDestIn(background, source, amount);
+ return PorterDuffFunctions.NormalDestIn(background, source, amount.Clamp(0,1));
}
///
@@ -2428,7 +2428,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.NormalDestIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.NormalDestIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2453,7 +2453,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.MultiplyDestIn(background, source, amount);
+ return PorterDuffFunctions.MultiplyDestIn(background, source, amount.Clamp(0,1));
}
///
@@ -2461,7 +2461,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.MultiplyDestIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.MultiplyDestIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2486,7 +2486,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.AddDestIn(background, source, amount);
+ return PorterDuffFunctions.AddDestIn(background, source, amount.Clamp(0,1));
}
///
@@ -2494,7 +2494,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.AddDestIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.AddDestIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2519,7 +2519,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.SubtractDestIn(background, source, amount);
+ return PorterDuffFunctions.SubtractDestIn(background, source, amount.Clamp(0,1));
}
///
@@ -2527,7 +2527,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.SubtractDestIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.SubtractDestIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2552,7 +2552,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.ScreenDestIn(background, source, amount);
+ return PorterDuffFunctions.ScreenDestIn(background, source, amount.Clamp(0,1));
}
///
@@ -2560,7 +2560,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.ScreenDestIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.ScreenDestIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2585,7 +2585,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DarkenDestIn(background, source, amount);
+ return PorterDuffFunctions.DarkenDestIn(background, source, amount.Clamp(0,1));
}
///
@@ -2593,7 +2593,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.DarkenDestIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.DarkenDestIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2618,7 +2618,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.LightenDestIn(background, source, amount);
+ return PorterDuffFunctions.LightenDestIn(background, source, amount.Clamp(0,1));
}
///
@@ -2626,7 +2626,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.LightenDestIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.LightenDestIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2651,7 +2651,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.OverlayDestIn(background, source, amount);
+ return PorterDuffFunctions.OverlayDestIn(background, source, amount.Clamp(0,1));
}
///
@@ -2659,7 +2659,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.OverlayDestIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.OverlayDestIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2684,7 +2684,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.HardLightDestIn(background, source, amount);
+ return PorterDuffFunctions.HardLightDestIn(background, source, amount.Clamp(0,1));
}
///
@@ -2692,7 +2692,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.HardLightDestIn(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.HardLightDestIn(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2717,7 +2717,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.NormalDestOut(background, source, amount);
+ return PorterDuffFunctions.NormalDestOut(background, source, amount.Clamp(0,1));
}
///
@@ -2725,7 +2725,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.NormalDestOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.NormalDestOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2750,7 +2750,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.MultiplyDestOut(background, source, amount);
+ return PorterDuffFunctions.MultiplyDestOut(background, source, amount.Clamp(0,1));
}
///
@@ -2758,7 +2758,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.MultiplyDestOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.MultiplyDestOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2783,7 +2783,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.AddDestOut(background, source, amount);
+ return PorterDuffFunctions.AddDestOut(background, source, amount.Clamp(0,1));
}
///
@@ -2791,7 +2791,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.AddDestOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.AddDestOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2816,7 +2816,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.SubtractDestOut(background, source, amount);
+ return PorterDuffFunctions.SubtractDestOut(background, source, amount.Clamp(0,1));
}
///
@@ -2824,7 +2824,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.SubtractDestOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.SubtractDestOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2849,7 +2849,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.ScreenDestOut(background, source, amount);
+ return PorterDuffFunctions.ScreenDestOut(background, source, amount.Clamp(0,1));
}
///
@@ -2857,7 +2857,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.ScreenDestOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.ScreenDestOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2882,7 +2882,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DarkenDestOut(background, source, amount);
+ return PorterDuffFunctions.DarkenDestOut(background, source, amount.Clamp(0,1));
}
///
@@ -2890,7 +2890,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.DarkenDestOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.DarkenDestOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2915,7 +2915,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.LightenDestOut(background, source, amount);
+ return PorterDuffFunctions.LightenDestOut(background, source, amount.Clamp(0,1));
}
///
@@ -2923,7 +2923,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.LightenDestOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.LightenDestOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2948,7 +2948,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.OverlayDestOut(background, source, amount);
+ return PorterDuffFunctions.OverlayDestOut(background, source, amount.Clamp(0,1));
}
///
@@ -2956,7 +2956,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.OverlayDestOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.OverlayDestOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -2981,7 +2981,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.HardLightDestOut(background, source, amount);
+ return PorterDuffFunctions.HardLightDestOut(background, source, amount.Clamp(0,1));
}
///
@@ -2989,7 +2989,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.HardLightDestOut(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.HardLightDestOut(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3014,7 +3014,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.NormalClear(background, source, amount);
+ return PorterDuffFunctions.NormalClear(background, source, amount.Clamp(0,1));
}
///
@@ -3022,7 +3022,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.NormalClear(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.NormalClear(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3047,7 +3047,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.MultiplyClear(background, source, amount);
+ return PorterDuffFunctions.MultiplyClear(background, source, amount.Clamp(0,1));
}
///
@@ -3055,7 +3055,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.MultiplyClear(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.MultiplyClear(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3080,7 +3080,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.AddClear(background, source, amount);
+ return PorterDuffFunctions.AddClear(background, source, amount.Clamp(0,1));
}
///
@@ -3088,7 +3088,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.AddClear(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.AddClear(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3113,7 +3113,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.SubtractClear(background, source, amount);
+ return PorterDuffFunctions.SubtractClear(background, source, amount.Clamp(0,1));
}
///
@@ -3121,7 +3121,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.SubtractClear(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.SubtractClear(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3146,7 +3146,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.ScreenClear(background, source, amount);
+ return PorterDuffFunctions.ScreenClear(background, source, amount.Clamp(0,1));
}
///
@@ -3154,7 +3154,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.ScreenClear(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.ScreenClear(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3179,7 +3179,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DarkenClear(background, source, amount);
+ return PorterDuffFunctions.DarkenClear(background, source, amount.Clamp(0,1));
}
///
@@ -3187,7 +3187,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.DarkenClear(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.DarkenClear(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3212,7 +3212,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.LightenClear(background, source, amount);
+ return PorterDuffFunctions.LightenClear(background, source, amount.Clamp(0,1));
}
///
@@ -3220,7 +3220,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.LightenClear(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.LightenClear(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3245,7 +3245,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.OverlayClear(background, source, amount);
+ return PorterDuffFunctions.OverlayClear(background, source, amount.Clamp(0,1));
}
///
@@ -3253,7 +3253,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.OverlayClear(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.OverlayClear(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3278,7 +3278,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.HardLightClear(background, source, amount);
+ return PorterDuffFunctions.HardLightClear(background, source, amount.Clamp(0,1));
}
///
@@ -3286,7 +3286,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.HardLightClear(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.HardLightClear(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3311,7 +3311,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.NormalXor(background, source, amount);
+ return PorterDuffFunctions.NormalXor(background, source, amount.Clamp(0,1));
}
///
@@ -3319,7 +3319,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.NormalXor(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.NormalXor(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3344,7 +3344,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.MultiplyXor(background, source, amount);
+ return PorterDuffFunctions.MultiplyXor(background, source, amount.Clamp(0,1));
}
///
@@ -3352,7 +3352,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.MultiplyXor(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.MultiplyXor(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3377,7 +3377,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.AddXor(background, source, amount);
+ return PorterDuffFunctions.AddXor(background, source, amount.Clamp(0,1));
}
///
@@ -3385,7 +3385,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.AddXor(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.AddXor(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3410,7 +3410,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.SubtractXor(background, source, amount);
+ return PorterDuffFunctions.SubtractXor(background, source, amount.Clamp(0,1));
}
///
@@ -3418,7 +3418,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.SubtractXor(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.SubtractXor(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3443,7 +3443,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.ScreenXor(background, source, amount);
+ return PorterDuffFunctions.ScreenXor(background, source, amount.Clamp(0,1));
}
///
@@ -3451,7 +3451,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.ScreenXor(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.ScreenXor(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3476,7 +3476,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DarkenXor(background, source, amount);
+ return PorterDuffFunctions.DarkenXor(background, source, amount.Clamp(0,1));
}
///
@@ -3484,7 +3484,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.DarkenXor(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.DarkenXor(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3509,7 +3509,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.LightenXor(background, source, amount);
+ return PorterDuffFunctions.LightenXor(background, source, amount.Clamp(0,1));
}
///
@@ -3517,7 +3517,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.LightenXor(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.LightenXor(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3542,7 +3542,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.OverlayXor(background, source, amount);
+ return PorterDuffFunctions.OverlayXor(background, source, amount.Clamp(0,1));
}
///
@@ -3550,7 +3550,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.OverlayXor(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.OverlayXor(background[i], source[i], amount.Clamp(0,1));
}
}
@@ -3575,7 +3575,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.HardLightXor(background, source, amount);
+ return PorterDuffFunctions.HardLightXor(background, source, amount.Clamp(0,1));
}
///
@@ -3583,7 +3583,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.HardLightXor(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.HardLightXor(background[i], source[i], amount.Clamp(0,1));
}
}
diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt
index 85dbd7091..17e93d9d7 100644
--- a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt
+++ b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt
@@ -80,7 +80,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.<#=blender_composer#>(background, source, amount);
+ return PorterDuffFunctions.<#=blender_composer#>(background, source, amount.Clamp(0,1));
}
///
@@ -88,7 +88,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = PorterDuffFunctions.<#=blender_composer#>(background[i], source[i], amount);
+ destination[i] = PorterDuffFunctions.<#=blender_composer#>(background[i], source[i], amount.Clamp(0,1));
}
}
diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs
index 4b0ffdd48..841f6ea85 100644
--- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs
+++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs
@@ -19,7 +19,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 NormalSrc(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return source;
@@ -28,7 +29,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 NormalSrcAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(backdrop, source, Normal(backdrop, source));
@@ -37,7 +39,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 NormalSrcOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(backdrop, source, Normal(backdrop, source));
@@ -46,7 +49,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 NormalSrcIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(backdrop, source, Normal(backdrop, source));
@@ -55,7 +59,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 NormalSrcOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(backdrop, source);
@@ -70,7 +75,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 NormalDestAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(source, backdrop, Normal(source, backdrop));
@@ -79,7 +85,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 NormalDestOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(source, backdrop, Normal(source, backdrop));
@@ -88,7 +95,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 NormalDestIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(source, backdrop, Normal(source, backdrop));
@@ -97,7 +105,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 NormalDestOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(source, backdrop);
@@ -106,7 +115,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 NormalXor(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Xor(backdrop, source);
@@ -115,7 +125,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 NormalClear(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Clear(backdrop, source);
@@ -256,7 +267,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 MultiplySrc(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return source;
@@ -265,7 +277,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 MultiplySrcAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(backdrop, source, Multiply(backdrop, source));
@@ -274,7 +287,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 MultiplySrcOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(backdrop, source, Multiply(backdrop, source));
@@ -283,7 +297,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 MultiplySrcIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(backdrop, source, Multiply(backdrop, source));
@@ -292,7 +307,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 MultiplySrcOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(backdrop, source);
@@ -307,7 +323,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 MultiplyDestAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(source, backdrop, Multiply(source, backdrop));
@@ -316,7 +333,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 MultiplyDestOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(source, backdrop, Multiply(source, backdrop));
@@ -325,7 +343,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 MultiplyDestIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(source, backdrop, Multiply(source, backdrop));
@@ -334,7 +353,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 MultiplyDestOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(source, backdrop);
@@ -343,7 +363,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 MultiplyXor(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Xor(backdrop, source);
@@ -352,7 +373,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 MultiplyClear(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Clear(backdrop, source);
@@ -493,7 +515,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 AddSrc(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return source;
@@ -502,7 +525,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 AddSrcAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(backdrop, source, Add(backdrop, source));
@@ -511,7 +535,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 AddSrcOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(backdrop, source, Add(backdrop, source));
@@ -520,7 +545,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 AddSrcIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(backdrop, source, Add(backdrop, source));
@@ -529,7 +555,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 AddSrcOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(backdrop, source);
@@ -544,7 +571,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 AddDestAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(source, backdrop, Add(source, backdrop));
@@ -553,7 +581,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 AddDestOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(source, backdrop, Add(source, backdrop));
@@ -562,7 +591,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 AddDestIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(source, backdrop, Add(source, backdrop));
@@ -571,7 +601,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 AddDestOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(source, backdrop);
@@ -580,7 +611,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 AddXor(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Xor(backdrop, source);
@@ -589,7 +621,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 AddClear(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Clear(backdrop, source);
@@ -730,7 +763,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 SubtractSrc(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return source;
@@ -739,7 +773,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 SubtractSrcAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(backdrop, source, Subtract(backdrop, source));
@@ -748,7 +783,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 SubtractSrcOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(backdrop, source, Subtract(backdrop, source));
@@ -757,7 +793,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 SubtractSrcIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(backdrop, source, Subtract(backdrop, source));
@@ -766,7 +803,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 SubtractSrcOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(backdrop, source);
@@ -781,7 +819,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 SubtractDestAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(source, backdrop, Subtract(source, backdrop));
@@ -790,7 +829,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 SubtractDestOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(source, backdrop, Subtract(source, backdrop));
@@ -799,7 +839,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 SubtractDestIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(source, backdrop, Subtract(source, backdrop));
@@ -808,7 +849,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 SubtractDestOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(source, backdrop);
@@ -817,7 +859,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 SubtractXor(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Xor(backdrop, source);
@@ -826,7 +869,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 SubtractClear(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Clear(backdrop, source);
@@ -967,7 +1011,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 ScreenSrc(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return source;
@@ -976,7 +1021,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 ScreenSrcAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(backdrop, source, Screen(backdrop, source));
@@ -985,7 +1031,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 ScreenSrcOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(backdrop, source, Screen(backdrop, source));
@@ -994,7 +1041,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 ScreenSrcIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(backdrop, source, Screen(backdrop, source));
@@ -1003,7 +1051,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 ScreenSrcOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(backdrop, source);
@@ -1018,7 +1067,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 ScreenDestAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(source, backdrop, Screen(source, backdrop));
@@ -1027,7 +1077,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 ScreenDestOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(source, backdrop, Screen(source, backdrop));
@@ -1036,7 +1087,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 ScreenDestIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(source, backdrop, Screen(source, backdrop));
@@ -1045,7 +1097,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 ScreenDestOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(source, backdrop);
@@ -1054,7 +1107,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 ScreenXor(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Xor(backdrop, source);
@@ -1063,7 +1117,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 ScreenClear(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Clear(backdrop, source);
@@ -1204,7 +1259,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 DarkenSrc(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return source;
@@ -1213,7 +1269,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 DarkenSrcAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(backdrop, source, Darken(backdrop, source));
@@ -1222,7 +1279,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 DarkenSrcOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(backdrop, source, Darken(backdrop, source));
@@ -1231,7 +1289,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 DarkenSrcIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(backdrop, source, Darken(backdrop, source));
@@ -1240,7 +1299,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 DarkenSrcOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(backdrop, source);
@@ -1255,7 +1315,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 DarkenDestAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(source, backdrop, Darken(source, backdrop));
@@ -1264,7 +1325,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 DarkenDestOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(source, backdrop, Darken(source, backdrop));
@@ -1273,7 +1335,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 DarkenDestIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(source, backdrop, Darken(source, backdrop));
@@ -1282,7 +1345,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 DarkenDestOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(source, backdrop);
@@ -1291,7 +1355,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 DarkenXor(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Xor(backdrop, source);
@@ -1300,7 +1365,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 DarkenClear(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Clear(backdrop, source);
@@ -1441,7 +1507,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 LightenSrc(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return source;
@@ -1450,7 +1517,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 LightenSrcAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(backdrop, source, Lighten(backdrop, source));
@@ -1459,7 +1527,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 LightenSrcOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(backdrop, source, Lighten(backdrop, source));
@@ -1468,7 +1537,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 LightenSrcIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(backdrop, source, Lighten(backdrop, source));
@@ -1477,7 +1547,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 LightenSrcOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(backdrop, source);
@@ -1492,7 +1563,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 LightenDestAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(source, backdrop, Lighten(source, backdrop));
@@ -1501,7 +1573,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 LightenDestOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(source, backdrop, Lighten(source, backdrop));
@@ -1510,7 +1583,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 LightenDestIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(source, backdrop, Lighten(source, backdrop));
@@ -1519,7 +1593,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 LightenDestOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(source, backdrop);
@@ -1528,7 +1603,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 LightenXor(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Xor(backdrop, source);
@@ -1537,7 +1613,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 LightenClear(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Clear(backdrop, source);
@@ -1678,7 +1755,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 OverlaySrc(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return source;
@@ -1687,7 +1765,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 OverlaySrcAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(backdrop, source, Overlay(backdrop, source));
@@ -1696,7 +1775,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 OverlaySrcOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(backdrop, source, Overlay(backdrop, source));
@@ -1705,7 +1785,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 OverlaySrcIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(backdrop, source, Overlay(backdrop, source));
@@ -1714,7 +1795,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 OverlaySrcOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(backdrop, source);
@@ -1729,7 +1811,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 OverlayDestAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(source, backdrop, Overlay(source, backdrop));
@@ -1738,7 +1821,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 OverlayDestOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(source, backdrop, Overlay(source, backdrop));
@@ -1747,7 +1831,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 OverlayDestIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(source, backdrop, Overlay(source, backdrop));
@@ -1756,7 +1841,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 OverlayDestOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(source, backdrop);
@@ -1765,7 +1851,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 OverlayXor(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Xor(backdrop, source);
@@ -1774,7 +1861,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 OverlayClear(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Clear(backdrop, source);
@@ -1915,7 +2003,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 HardLightSrc(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return source;
@@ -1924,7 +2013,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 HardLightSrcAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(backdrop, source, HardLight(backdrop, source));
@@ -1933,7 +2023,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 HardLightSrcOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(backdrop, source, HardLight(backdrop, source));
@@ -1942,7 +2033,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 HardLightSrcIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(backdrop, source, HardLight(backdrop, source));
@@ -1951,7 +2043,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 HardLightSrcOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(backdrop, source);
@@ -1966,7 +2059,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 HardLightDestAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(source, backdrop, HardLight(source, backdrop));
@@ -1975,7 +2069,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 HardLightDestOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(source, backdrop, HardLight(source, backdrop));
@@ -1984,7 +2079,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 HardLightDestIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(source, backdrop, HardLight(source, backdrop));
@@ -1993,7 +2089,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 HardLightDestOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(source, backdrop);
@@ -2002,7 +2099,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 HardLightXor(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Xor(backdrop, source);
@@ -2011,7 +2109,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 HardLightClear(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Clear(backdrop, source);
diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt
index 5e46a89a8..7d5b8663d 100644
--- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt
+++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt
@@ -27,7 +27,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 <#=blender#>Src(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return source;
@@ -36,7 +37,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 <#=blender#>SrcAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(backdrop, source, <#=blender#>(backdrop, source));
@@ -45,7 +47,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 <#=blender#>SrcOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(backdrop, source, <#=blender#>(backdrop, source));
@@ -54,7 +57,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 <#=blender#>SrcIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(backdrop, source, <#=blender#>(backdrop, source));
@@ -63,7 +67,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 <#=blender#>SrcOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(backdrop, source);
@@ -78,7 +83,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 <#=blender#>DestAtop(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Atop(source, backdrop, <#=blender#>(source, backdrop));
@@ -87,7 +93,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 <#=blender#>DestOver(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Over(source, backdrop, <#=blender#>(source, backdrop));
@@ -96,7 +103,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 <#=blender#>DestIn(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return In(source, backdrop, <#=blender#>(source, backdrop));
@@ -105,7 +113,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 <#=blender#>DestOut(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Out(source, backdrop);
@@ -114,7 +123,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 <#=blender#>Xor(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Xor(backdrop, source);
@@ -123,7 +133,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 <#=blender#>Clear(Vector4 backdrop, Vector4 source, float opacity)
{
- opacity = opacity.Clamp(0, 1);
+ DebugGuard.MustBeBetweenOrEqualTo(opacity, 0, 1, nameof(opacity));
+
source.W *= opacity;
return Clear(backdrop, source);
diff --git a/src/ImageSharp/PixelFormats/PixelBlender{TPixel}.cs b/src/ImageSharp/PixelFormats/PixelBlender{TPixel}.cs
index 0180ef36c..bc53fec75 100644
--- a/src/ImageSharp/PixelFormats/PixelBlender{TPixel}.cs
+++ b/src/ImageSharp/PixelFormats/PixelBlender{TPixel}.cs
@@ -55,7 +55,6 @@ namespace SixLabors.ImageSharp.PixelFormats
///
/// Blends 2 rows together
///
- /// the pixel format of the source span
/// memory manager to use internally
/// the destination span
/// the background span
@@ -64,26 +63,9 @@ namespace SixLabors.ImageSharp.PixelFormats
/// A span with values between 0 and 1 indicating the weight of the second source vector.
/// At amount = 0, "from" is returned, at amount = 1, "to" is returned.
///
- public void Blend(MemoryAllocator memoryManager, Span destination, ReadOnlySpan background, ReadOnlySpan source, ReadOnlySpan amount)
- where TPixelSrc : struct, IPixel
+ public void Blend(MemoryAllocator memoryManager, Span destination, ReadOnlySpan background, ReadOnlySpan source, ReadOnlySpan amount)
{
- Guard.MustBeGreaterThanOrEqualTo(background.Length, destination.Length, nameof(background.Length));
- Guard.MustBeGreaterThanOrEqualTo(source.Length, destination.Length, nameof(source.Length));
- Guard.MustBeGreaterThanOrEqualTo(amount.Length, destination.Length, nameof(amount.Length));
-
- using (IMemoryOwner buffer = memoryManager.Allocate(destination.Length * 3))
- {
- Span destinationSpan = buffer.Slice(0, destination.Length);
- Span backgroundSpan = buffer.Slice(destination.Length, destination.Length);
- Span sourceSpan = buffer.Slice(destination.Length * 2, destination.Length);
-
- PixelOperations.Instance.ToVector4(background, backgroundSpan, destination.Length);
- PixelOperations.Instance.ToVector4(source, sourceSpan, destination.Length);
-
- this.BlendFunction(destinationSpan, backgroundSpan, sourceSpan, amount);
-
- PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
- }
+ this.Blend(memoryManager, destination, background, source, amount);
}
///
@@ -95,15 +77,15 @@ namespace SixLabors.ImageSharp.PixelFormats
/// the background span
/// the source span
///
- /// A value between 0 and 1 indicating the weight of the second source vector.
+ /// A span with values between 0 and 1 indicating the weight of the second source vector.
/// At amount = 0, "from" is returned, at amount = 1, "to" is returned.
///
- public void Blend(MemoryAllocator memoryManager, Span destination, ReadOnlySpan background, ReadOnlySpan source, float amount)
+ public void Blend(MemoryAllocator memoryManager, Span destination, ReadOnlySpan background, ReadOnlySpan source, ReadOnlySpan amount)
where TPixelSrc : struct, IPixel
{
Guard.MustBeGreaterThanOrEqualTo(background.Length, destination.Length, nameof(background.Length));
Guard.MustBeGreaterThanOrEqualTo(source.Length, destination.Length, nameof(source.Length));
- Guard.MustBeBetweenOrEqualTo(amount, 0, 1, nameof(amount));
+ Guard.MustBeGreaterThanOrEqualTo(amount.Length, destination.Length, nameof(amount.Length));
using (IMemoryOwner buffer = memoryManager.Allocate(destination.Length * 3))
{
@@ -123,19 +105,21 @@ namespace SixLabors.ImageSharp.PixelFormats
///
/// Blends 2 rows together
///
+ /// the pixel format of the source span
/// memory manager to use internally
/// the destination span
/// the background span
/// the source span
///
- /// A span with values between 0 and 1 indicating the weight of the second source vector.
+ /// A value between 0 and 1 indicating the weight of the second source vector.
/// At amount = 0, "from" is returned, at amount = 1, "to" is returned.
///
- public void Blend(MemoryAllocator memoryManager, Span destination, ReadOnlySpan background, ReadOnlySpan source, ReadOnlySpan amount)
+ public void Blend(MemoryAllocator memoryManager, Span destination, ReadOnlySpan background, ReadOnlySpan source, float amount)
+ where TPixelSrc : struct, IPixel
{
Guard.MustBeGreaterThanOrEqualTo(background.Length, destination.Length, nameof(background.Length));
Guard.MustBeGreaterThanOrEqualTo(source.Length, destination.Length, nameof(source.Length));
- Guard.MustBeGreaterThanOrEqualTo(amount.Length, destination.Length, nameof(amount.Length));
+ Guard.MustBeBetweenOrEqualTo(amount, 0, 1, nameof(amount));
using (IMemoryOwner buffer = memoryManager.Allocate(destination.Length * 3))
{
@@ -144,7 +128,7 @@ namespace SixLabors.ImageSharp.PixelFormats
Span sourceSpan = buffer.Slice(destination.Length * 2, destination.Length);
PixelOperations.Instance.ToVector4(background, backgroundSpan, destination.Length);
- PixelOperations.Instance.ToVector4(source, sourceSpan, destination.Length);
+ PixelOperations.Instance.ToVector4(source, sourceSpan, destination.Length);
this.BlendFunction(destinationSpan, backgroundSpan, sourceSpan, amount);