|
|
|
@ -15,6 +15,8 @@ |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
using System.Runtime.Intrinsics; |
|
|
|
using System.Runtime.Intrinsics.X86; |
|
|
|
|
|
|
|
namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders; |
|
|
|
|
|
|
|
@ -36,6 +38,17 @@ internal static partial class PorterDuffFunctions |
|
|
|
return source; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>Src compositing equation. |
|
|
|
/// </summary> |
|
|
|
/// <param name="backdrop">The backdrop vector.</param> |
|
|
|
/// <param name="source">The source vector.</param> |
|
|
|
/// <param name="opacity">The source opacity. Range 0..1</param> |
|
|
|
/// <returns>The <see cref="Vector256{Single}"/>.</returns> |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static Vector256<float> <#=blender#>Src(Vector256<float> backdrop, Vector256<float> source, Vector256<float> opacity) |
|
|
|
=> Avx.Blend(source, Avx.Multiply(source, opacity), BlendAlphaControl); |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>SrcAtop" compositing equation. |
|
|
|
/// </summary> |
|
|
|
@ -51,6 +64,21 @@ internal static partial class PorterDuffFunctions |
|
|
|
return Atop(backdrop, source, <#=blender#>(backdrop, source)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>SrcAtop" compositing equation. |
|
|
|
/// </summary> |
|
|
|
/// <param name="backdrop">The backdrop vector.</param> |
|
|
|
/// <param name="source">The source vector.</param> |
|
|
|
/// <param name="opacity">The source opacity. Range 0..1</param> |
|
|
|
/// <returns>The <see cref="Vector256{Single}"/>.</returns> |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static Vector256<float> <#=blender#>SrcAtop(Vector256<float> backdrop, Vector256<float> source, Vector256<float> opacity) |
|
|
|
{ |
|
|
|
source = Avx.Blend(source, Avx.Multiply(source, opacity), BlendAlphaControl); |
|
|
|
|
|
|
|
return Atop(backdrop, source, <#=blender#>(backdrop, source)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>SrcOver" compositing equation. |
|
|
|
/// </summary> |
|
|
|
@ -66,6 +94,21 @@ internal static partial class PorterDuffFunctions |
|
|
|
return Over(backdrop, source, <#=blender#>(backdrop, source)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>SrcOver" compositing equation. |
|
|
|
/// </summary> |
|
|
|
/// <param name="backdrop">The backdrop vector.</param> |
|
|
|
/// <param name="source">The source vector.</param> |
|
|
|
/// <param name="opacity">The source opacity. Range 0..1</param> |
|
|
|
/// <returns>The <see cref="Vector256{Single}"/>.</returns> |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static Vector256<float> <#=blender#>SrcOver(Vector256<float> backdrop, Vector256<float> source, Vector256<float> opacity) |
|
|
|
{ |
|
|
|
source = Avx.Blend(source, Avx.Multiply(source, opacity), BlendAlphaControl); |
|
|
|
|
|
|
|
return Over(backdrop, source, <#=blender#>(backdrop, source)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>SrcIn" compositing equation. |
|
|
|
/// </summary> |
|
|
|
@ -81,6 +124,17 @@ internal static partial class PorterDuffFunctions |
|
|
|
return In(backdrop, source); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>SrcIn" compositing equation. |
|
|
|
/// </summary> |
|
|
|
/// <param name="backdrop">The backdrop vector.</param> |
|
|
|
/// <param name="source">The source vector.</param> |
|
|
|
/// <param name="opacity">The source opacity. Range 0..1</param> |
|
|
|
/// <returns>The <see cref="Vector256{Single}"/>.</returns> |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static Vector256<float> <#=blender#>SrcIn(Vector256<float> backdrop, Vector256<float> source, Vector256<float> opacity) |
|
|
|
=> In(backdrop, Avx.Blend(source, Avx.Multiply(source, opacity), BlendAlphaControl)); |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>SrcOut" compositing equation. |
|
|
|
/// </summary> |
|
|
|
@ -96,6 +150,17 @@ internal static partial class PorterDuffFunctions |
|
|
|
return Out(backdrop, source); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>SrcOut" compositing equation. |
|
|
|
/// </summary> |
|
|
|
/// <param name="backdrop">The backdrop vector.</param> |
|
|
|
/// <param name="source">The source vector.</param> |
|
|
|
/// <param name="opacity">The source opacity. Range 0..1</param> |
|
|
|
/// <returns>The <see cref="Vector256{Single}"/>.</returns> |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static Vector256<float> <#=blender#>SrcOut(Vector256<float> backdrop, Vector256<float> source, Vector256<float> opacity) |
|
|
|
=> Out(backdrop, Avx.Blend(source, Avx.Multiply(source, opacity), BlendAlphaControl)); |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>Dest" compositing equation. |
|
|
|
/// </summary> |
|
|
|
@ -109,6 +174,19 @@ internal static partial class PorterDuffFunctions |
|
|
|
return backdrop; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>Dest" compositing equation. |
|
|
|
/// </summary> |
|
|
|
/// <param name="backdrop">The backdrop vector.</param> |
|
|
|
/// <param name="source">The source vector.</param> |
|
|
|
/// <param name="opacity">The source opacity. Range 0..1</param> |
|
|
|
/// <returns>The <see cref="Vector256{Single}"/>.</returns> |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static Vector256<float> <#=blender#>Dest(Vector256<float> backdrop, Vector256<float> source, Vector256<float> opacity) |
|
|
|
{ |
|
|
|
return backdrop; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>DestAtop" compositing equation. |
|
|
|
/// </summary> |
|
|
|
@ -124,6 +202,21 @@ internal static partial class PorterDuffFunctions |
|
|
|
return Atop(source, backdrop, <#=blender#>(source, backdrop)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>DestAtop" compositing equation. |
|
|
|
/// </summary> |
|
|
|
/// <param name="backdrop">The backdrop vector.</param> |
|
|
|
/// <param name="source">The source vector.</param> |
|
|
|
/// <param name="opacity">The source opacity. Range 0..1</param> |
|
|
|
/// <returns>The <see cref="Vector256{Single}"/>.</returns> |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static Vector256<float> <#=blender#>DestAtop(Vector256<float> backdrop, Vector256<float> source, Vector256<float> opacity) |
|
|
|
{ |
|
|
|
source = Avx.Blend(source, Avx.Multiply(source, opacity), BlendAlphaControl); |
|
|
|
|
|
|
|
return Atop(source, backdrop, <#=blender#>(source, backdrop)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>DestOver" compositing equation. |
|
|
|
/// </summary> |
|
|
|
@ -139,6 +232,21 @@ internal static partial class PorterDuffFunctions |
|
|
|
return Over(source, backdrop, <#=blender#>(source, backdrop)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>DestOver" compositing equation. |
|
|
|
/// </summary> |
|
|
|
/// <param name="backdrop">The backdrop vector.</param> |
|
|
|
/// <param name="source">The source vector.</param> |
|
|
|
/// <param name="opacity">The source opacity. Range 0..1</param> |
|
|
|
/// <returns>The <see cref="Vector256{Single}"/>.</returns> |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static Vector256<float> <#=blender#>DestOver(Vector256<float> backdrop, Vector256<float> source, Vector256<float> opacity) |
|
|
|
{ |
|
|
|
source = Avx.Blend(source, Avx.Multiply(source, opacity), BlendAlphaControl); |
|
|
|
|
|
|
|
return Over(source, backdrop, <#=blender#>(source, backdrop)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>DestIn" compositing equation. |
|
|
|
/// </summary> |
|
|
|
@ -154,6 +262,17 @@ internal static partial class PorterDuffFunctions |
|
|
|
return In(source, backdrop); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>DestIn" compositing equation. |
|
|
|
/// </summary> |
|
|
|
/// <param name="backdrop">The backdrop vector.</param> |
|
|
|
/// <param name="source">The source vector.</param> |
|
|
|
/// <param name="opacity">The source opacity. Range 0..1</param> |
|
|
|
/// <returns>The <see cref="Vector256{Single}"/>.</returns> |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static Vector256<float> <#=blender#>DestIn(Vector256<float> backdrop, Vector256<float> source, Vector256<float> opacity) |
|
|
|
=> In(Avx.Blend(source, Avx.Multiply(source, opacity), BlendAlphaControl), backdrop); |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>DestOut" compositing equation. |
|
|
|
/// </summary> |
|
|
|
@ -169,6 +288,17 @@ internal static partial class PorterDuffFunctions |
|
|
|
return Out(source, backdrop); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>DestOut" compositing equation. |
|
|
|
/// </summary> |
|
|
|
/// <param name="backdrop">The backdrop vector.</param> |
|
|
|
/// <param name="source">The source vector.</param> |
|
|
|
/// <param name="opacity">The source opacity. Range 0..1</param> |
|
|
|
/// <returns>The <see cref="Vector256{Single}"/>.</returns> |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static Vector256<float> <#=blender#>DestOut(Vector256<float> backdrop, Vector256<float> source, Vector256<float> opacity) |
|
|
|
=> Out(Avx.Blend(source, Avx.Multiply(source, opacity), BlendAlphaControl), backdrop); |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>Xor" compositing equation. |
|
|
|
/// </summary> |
|
|
|
@ -184,6 +314,17 @@ internal static partial class PorterDuffFunctions |
|
|
|
return Xor(backdrop, source); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>Xor" compositing equation. |
|
|
|
/// </summary> |
|
|
|
/// <param name="backdrop">The backdrop vector.</param> |
|
|
|
/// <param name="source">The source vector.</param> |
|
|
|
/// <param name="opacity">The source opacity. Range 0..1</param> |
|
|
|
/// <returns>The <see cref="Vector256{Single}"/>.</returns> |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static Vector256<float> <#=blender#>Xor(Vector256<float> backdrop, Vector256<float> source, Vector256<float> opacity) |
|
|
|
=> Xor(backdrop, Avx.Blend(source, Avx.Multiply(source, opacity), BlendAlphaControl)); |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>Clear" compositing equation. |
|
|
|
/// </summary> |
|
|
|
@ -199,6 +340,17 @@ internal static partial class PorterDuffFunctions |
|
|
|
return Clear(backdrop, source); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Returns the result of the "<#=blender#>Clear" compositing equation. |
|
|
|
/// </summary> |
|
|
|
/// <param name="backdrop">The backdrop vector.</param> |
|
|
|
/// <param name="source">The source vector.</param> |
|
|
|
/// <param name="opacity">The source opacity. Range 0..1</param> |
|
|
|
/// <returns>The <see cref="Vector256{Single}"/>.</returns> |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static Vector256<float> <#=blender#>Xor(Vector256<float> backdrop, Vector256<float> source, Vector256<float> opacity) |
|
|
|
=> Clear(backdrop, Avx.Blend(source, Avx.Multiply(source, opacity), BlendAlphaControl)); |
|
|
|
|
|
|
|
<#} #> |
|
|
|
|
|
|
|
<# void GenerateGenericPixelBlender(string blender, string composer) { #> |
|
|
|
|