diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/GradientBrushBase{TPixel}.cs b/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/GradientBrushBase{TPixel}.cs
index d0a1ef1c24..061023428b 100644
--- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/GradientBrushBase{TPixel}.cs
+++ b/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/GradientBrushBase{TPixel}.cs
@@ -121,7 +121,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing.Brushes.GradientBrushes
float onLocalGradient = (positionOnCompleteGradient - from.Ratio) / to.Ratio;
// TODO: this should be changeble for different gradienting functions
- Vector4 result = PorterDuffFunctions.Normal(
+ Vector4 result = PorterDuffFunctions.Normal_SrcOver(
fromAsVector,
toAsVector,
onLocalGradient);
diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs
index 6828f11dcc..c5bed2b270 100644
--- a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs
+++ b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs
@@ -1,4 +1,11 @@
-// Copyright (c) Six Labors and contributors.
+
+
+
+
+
+
+
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -24,17 +31,258 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
where TPixel : struct, IPixel
{
- internal class Normal : PixelBlender
+
+ internal class Normal_Src : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Normal_Src Instance { get; } = new Normal_Src();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Normal_Src(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Normal_Src(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class Multiply_Src : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Multiply_Src Instance { get; } = new Multiply_Src();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Multiply_Src(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Multiply_Src(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class Add_Src : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Add_Src Instance { get; } = new Add_Src();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Add_Src(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Add_Src(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class Subtract_Src : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Subtract_Src Instance { get; } = new Subtract_Src();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Subtract_Src(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Subtract_Src(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class Screen_Src : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Screen_Src Instance { get; } = new Screen_Src();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Screen_Src(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Screen_Src(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class Darken_Src : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Darken_Src Instance { get; } = new Darken_Src();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Darken_Src(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Darken_Src(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class Lighten_Src : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Normal Instance { get; } = new Normal();
+ public static Lighten_Src Instance { get; } = new Lighten_Src();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Normal(background, source, amount);
+ return PorterDuffFunctions.Lighten_Src(background, source, amount);
}
///
@@ -55,7 +303,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Normal(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Lighten_Src(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -63,17 +311,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Multiply : PixelBlender
+
+ internal class Overlay_Src : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Multiply Instance { get; } = new Multiply();
+ public static Overlay_Src Instance { get; } = new Overlay_Src();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Multiply(background, source, amount);
+ return PorterDuffFunctions.Overlay_Src(background, source, amount);
}
///
@@ -94,7 +343,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Multiply(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Overlay_Src(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -102,17 +351,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Add : PixelBlender
+
+ internal class HardLight_Src : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Add Instance { get; } = new Add();
+ public static HardLight_Src Instance { get; } = new HardLight_Src();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Add(background, source, amount);
+ return PorterDuffFunctions.HardLight_Src(background, source, amount);
}
///
@@ -133,7 +383,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Add(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.HardLight_Src(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -141,17 +391,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Subtract : PixelBlender
+
+ internal class Normal_SrcAtop : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Subtract Instance { get; } = new Subtract();
+ public static Normal_SrcAtop Instance { get; } = new Normal_SrcAtop();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Subtract(background, source, amount);
+ return PorterDuffFunctions.Normal_SrcAtop(background, source, amount);
}
///
@@ -172,7 +423,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Subtract(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Normal_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -180,17 +431,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Screen : PixelBlender
+
+ internal class Multiply_SrcAtop : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Screen Instance { get; } = new Screen();
+ public static Multiply_SrcAtop Instance { get; } = new Multiply_SrcAtop();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Screen(background, source, amount);
+ return PorterDuffFunctions.Multiply_SrcAtop(background, source, amount);
}
///
@@ -211,7 +463,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Screen(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Multiply_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -219,17 +471,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Darken : PixelBlender
+
+ internal class Add_SrcAtop : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Darken Instance { get; } = new Darken();
+ public static Add_SrcAtop Instance { get; } = new Add_SrcAtop();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Darken(background, source, amount);
+ return PorterDuffFunctions.Add_SrcAtop(background, source, amount);
}
///
@@ -250,7 +503,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Darken(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Add_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -258,17 +511,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Lighten : PixelBlender
+
+ internal class Subtract_SrcAtop : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Lighten Instance { get; } = new Lighten();
+ public static Subtract_SrcAtop Instance { get; } = new Subtract_SrcAtop();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Lighten(background, source, amount);
+ return PorterDuffFunctions.Subtract_SrcAtop(background, source, amount);
}
///
@@ -289,7 +543,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Lighten(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Subtract_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -297,17 +551,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Overlay : PixelBlender
+
+ internal class Screen_SrcAtop : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Overlay Instance { get; } = new Overlay();
+ public static Screen_SrcAtop Instance { get; } = new Screen_SrcAtop();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Overlay(background, source, amount);
+ return PorterDuffFunctions.Screen_SrcAtop(background, source, amount);
}
///
@@ -328,7 +583,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Overlay(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Screen_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -336,17 +591,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class HardLight : PixelBlender
+
+ internal class Darken_SrcAtop : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static HardLight Instance { get; } = new HardLight();
+ public static Darken_SrcAtop Instance { get; } = new Darken_SrcAtop();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.HardLight(background, source, amount);
+ return PorterDuffFunctions.Darken_SrcAtop(background, source, amount);
}
///
@@ -367,7 +623,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.HardLight(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Darken_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -375,17 +631,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Src : PixelBlender
+
+ internal class Lighten_SrcAtop : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Src Instance { get; } = new Src();
+ public static Lighten_SrcAtop Instance { get; } = new Lighten_SrcAtop();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Src(background, source, amount);
+ return PorterDuffFunctions.Lighten_SrcAtop(background, source, amount);
}
///
@@ -406,7 +663,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Src(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Lighten_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -414,17 +671,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Atop : PixelBlender
+
+ internal class Overlay_SrcAtop : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Atop Instance { get; } = new Atop();
+ public static Overlay_SrcAtop Instance { get; } = new Overlay_SrcAtop();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Atop(background, source, amount);
+ return PorterDuffFunctions.Overlay_SrcAtop(background, source, amount);
}
///
@@ -445,7 +703,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Atop(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Overlay_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -453,17 +711,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Over : PixelBlender
+
+ internal class HardLight_SrcAtop : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Over Instance { get; } = new Over();
+ public static HardLight_SrcAtop Instance { get; } = new HardLight_SrcAtop();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Over(background, source, amount);
+ return PorterDuffFunctions.HardLight_SrcAtop(background, source, amount);
}
///
@@ -484,7 +743,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Over(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.HardLight_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -492,17 +751,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class In : PixelBlender
+
+ internal class Normal_SrcOver : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static In Instance { get; } = new In();
+ public static Normal_SrcOver Instance { get; } = new Normal_SrcOver();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.In(background, source, amount);
+ return PorterDuffFunctions.Normal_SrcOver(background, source, amount);
}
///
@@ -523,7 +783,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.In(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Normal_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -531,17 +791,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Out : PixelBlender
+
+ internal class Multiply_SrcOver : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Out Instance { get; } = new Out();
+ public static Multiply_SrcOver Instance { get; } = new Multiply_SrcOver();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Out(background, source, amount);
+ return PorterDuffFunctions.Multiply_SrcOver(background, source, amount);
}
///
@@ -562,7 +823,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Out(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Multiply_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -570,17 +831,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Dest : PixelBlender
+
+ internal class Add_SrcOver : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Dest Instance { get; } = new Dest();
+ public static Add_SrcOver Instance { get; } = new Add_SrcOver();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Dest(background, source, amount);
+ return PorterDuffFunctions.Add_SrcOver(background, source, amount);
}
///
@@ -601,7 +863,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Dest(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Add_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -609,17 +871,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class DestAtop : PixelBlender
+
+ internal class Subtract_SrcOver : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static DestAtop Instance { get; } = new DestAtop();
+ public static Subtract_SrcOver Instance { get; } = new Subtract_SrcOver();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DestAtop(background, source, amount);
+ return PorterDuffFunctions.Subtract_SrcOver(background, source, amount);
}
///
@@ -640,7 +903,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Subtract_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -648,17 +911,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class DestOver : PixelBlender
+
+ internal class Screen_SrcOver : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static DestOver Instance { get; } = new DestOver();
+ public static Screen_SrcOver Instance { get; } = new Screen_SrcOver();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DestOver(background, source, amount);
+ return PorterDuffFunctions.Screen_SrcOver(background, source, amount);
}
///
@@ -679,7 +943,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.DestOver(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Screen_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -687,17 +951,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class DestIn : PixelBlender
+
+ internal class Darken_SrcOver : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static DestIn Instance { get; } = new DestIn();
+ public static Darken_SrcOver Instance { get; } = new Darken_SrcOver();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DestIn(background, source, amount);
+ return PorterDuffFunctions.Darken_SrcOver(background, source, amount);
}
///
@@ -718,7 +983,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.DestIn(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Darken_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -726,17 +991,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class DestOut : PixelBlender
+
+ internal class Lighten_SrcOver : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static DestOut Instance { get; } = new DestOut();
+ public static Lighten_SrcOver Instance { get; } = new Lighten_SrcOver();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.DestOut(background, source, amount);
+ return PorterDuffFunctions.Lighten_SrcOver(background, source, amount);
}
///
@@ -757,7 +1023,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.DestOut(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Lighten_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -765,17 +1031,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Clear : PixelBlender
+
+ internal class Overlay_SrcOver : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Clear Instance { get; } = new Clear();
+ public static Overlay_SrcOver Instance { get; } = new Overlay_SrcOver();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Clear(background, source, amount);
+ return PorterDuffFunctions.Overlay_SrcOver(background, source, amount);
}
///
@@ -796,7 +1063,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Clear(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.Overlay_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -804,17 +1071,18 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
- internal class Xor : PixelBlender
+
+ internal class HardLight_SrcOver : PixelBlender
{
///
/// Gets the static instance of this blender.
///
- public static Xor Instance { get; } = new Xor();
+ public static HardLight_SrcOver Instance { get; } = new HardLight_SrcOver();
///
public override TPixel Blend(TPixel background, TPixel source, float amount)
{
- return PorterDuffFunctions.Xor(background, source, amount);
+ return PorterDuffFunctions.HardLight_SrcOver(background, source, amount);
}
///
@@ -835,7 +1103,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
for (int i = 0; i < destination.Length; i++)
{
- destinationSpan[i] = PorterDuffFunctions.Xor(backgroundSpan[i], sourceSpan[i], amount[i]);
+ destinationSpan[i] = PorterDuffFunctions.HardLight_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]);
}
PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
@@ -843,5 +1111,3246 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
}
}
+
+ internal class Normal_SrcIn : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Normal_SrcIn Instance { get; } = new Normal_SrcIn();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Normal_SrcIn(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Normal_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class Multiply_SrcIn : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Multiply_SrcIn Instance { get; } = new Multiply_SrcIn();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Multiply_SrcIn(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Multiply_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class Add_SrcIn : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Add_SrcIn Instance { get; } = new Add_SrcIn();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Add_SrcIn(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Add_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class Subtract_SrcIn : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Subtract_SrcIn Instance { get; } = new Subtract_SrcIn();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Subtract_SrcIn(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Subtract_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class Screen_SrcIn : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Screen_SrcIn Instance { get; } = new Screen_SrcIn();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Screen_SrcIn(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Screen_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class Darken_SrcIn : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Darken_SrcIn Instance { get; } = new Darken_SrcIn();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Darken_SrcIn(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Darken_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class Lighten_SrcIn : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Lighten_SrcIn Instance { get; } = new Lighten_SrcIn();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Lighten_SrcIn(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Lighten_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class Overlay_SrcIn : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static Overlay_SrcIn Instance { get; } = new Overlay_SrcIn();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.Overlay_SrcIn(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ 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);
+
+ for (int i = 0; i < destination.Length; i++)
+ {
+ destinationSpan[i] = PorterDuffFunctions.Overlay_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]);
+ }
+
+ PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
+ }
+ }
+ }
+
+
+ internal class HardLight_SrcIn : PixelBlender
+ {
+ ///
+ /// Gets the static instance of this blender.
+ ///
+ public static HardLight_SrcIn Instance { get; } = new HardLight_SrcIn();
+
+ ///
+ public override TPixel Blend(TPixel background, TPixel source, float amount)
+ {
+ return PorterDuffFunctions.HardLight_SrcIn(background, source, amount);
+ }
+
+ ///
+ public override void Blend(MemoryAllocator memoryManager, Span destination, Span background, Span source, Span 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 (IBuffer buffer = memoryManager.Allocate(destination.Length * 3, false))
+ {
+ Span destinationSpan = buffer.Slice(0, destination.Length);
+ Span