mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
561 lines
25 KiB
561 lines
25 KiB
<#
|
|
// Copyright (c) Six Labors.
|
|
// Licensed under the Six Labors Split License.
|
|
#>
|
|
<#@ template debug="false" hostspecific="false" language="C#" #>
|
|
<#@ assembly name="System.Core" #>
|
|
<#@ import namespace="System.Linq" #>
|
|
<#@ import namespace="System.Text" #>
|
|
<#@ import namespace="System.Collections.Generic" #>
|
|
<#@ output extension=".cs" #>
|
|
// Copyright (c) Six Labors.
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
// <auto-generated />
|
|
|
|
using System.Numerics;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.Intrinsics;
|
|
using System.Runtime.Intrinsics.X86;
|
|
|
|
namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders;
|
|
|
|
internal static partial class PorterDuffFunctions
|
|
{<# void GeneratePixelBlenders(string blender) { #>
|
|
|
|
/// <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="Vector4"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector4 <#=blender#>Src(Vector4 backdrop, Vector4 source, float opacity)
|
|
{
|
|
source = Numerics.WithW(source, source * opacity);
|
|
|
|
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, source * opacity, BlendAlphaControl);
|
|
|
|
/// <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="Vector512{Single}"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector512<float> <#=blender#>Src(Vector512<float> backdrop, Vector512<float> source, Vector512<float> opacity)
|
|
=> Avx512F.BlendVariable(source, source * opacity, AlphaMask512());
|
|
|
|
/// <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="Vector4"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector4 <#=blender#>SrcAtop(Vector4 backdrop, Vector4 source, float opacity)
|
|
{
|
|
source = Numerics.WithW(source, source * opacity);
|
|
|
|
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, source * opacity, BlendAlphaControl);
|
|
|
|
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="Vector512{Single}"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector512<float> <#=blender#>SrcAtop(Vector512<float> backdrop, Vector512<float> source, Vector512<float> opacity)
|
|
{
|
|
source = Avx512F.BlendVariable(source, source * opacity, AlphaMask512());
|
|
|
|
return Atop(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="Vector4"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector4 <#=blender#>SrcOver(Vector4 backdrop, Vector4 source, float opacity)
|
|
{
|
|
source = Numerics.WithW(source, source * opacity);
|
|
|
|
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, source * opacity, BlendAlphaControl);
|
|
|
|
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="Vector512{Single}"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector512<float> <#=blender#>SrcOver(Vector512<float> backdrop, Vector512<float> source, Vector512<float> opacity)
|
|
{
|
|
source = Avx512F.BlendVariable(source, source * opacity, AlphaMask512());
|
|
|
|
return Over(backdrop, source, <#=blender#>(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="Vector4"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector4 <#=blender#>SrcIn(Vector4 backdrop, Vector4 source, float opacity)
|
|
{
|
|
source = Numerics.WithW(source, source * opacity);
|
|
|
|
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, source * opacity, BlendAlphaControl));
|
|
|
|
/// <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="Vector512{Single}"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector512<float> <#=blender#>SrcIn(Vector512<float> backdrop, Vector512<float> source, Vector512<float> opacity)
|
|
=> In(backdrop, Avx512F.BlendVariable(source, source * opacity, AlphaMask512()));
|
|
|
|
/// <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="Vector4"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector4 <#=blender#>SrcOut(Vector4 backdrop, Vector4 source, float opacity)
|
|
{
|
|
source = Numerics.WithW(source, source * opacity);
|
|
|
|
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, source * opacity, BlendAlphaControl));
|
|
|
|
/// <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="Vector512{Single}"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector512<float> <#=blender#>SrcOut(Vector512<float> backdrop, Vector512<float> source, Vector512<float> opacity)
|
|
=> Out(backdrop, Avx512F.BlendVariable(source, source * opacity, AlphaMask512()));
|
|
|
|
/// <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="Vector4"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector4 <#=blender#>Dest(Vector4 backdrop, Vector4 source, float opacity)
|
|
{
|
|
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#>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="Vector512{Single}"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector512<float> <#=blender#>Dest(Vector512<float> backdrop, Vector512<float> source, Vector512<float> opacity)
|
|
{
|
|
return 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="Vector4"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector4 <#=blender#>DestAtop(Vector4 backdrop, Vector4 source, float opacity)
|
|
{
|
|
source = Numerics.WithW(source, source * opacity);
|
|
|
|
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, source * opacity, BlendAlphaControl);
|
|
|
|
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="Vector512{Single}"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector512<float> <#=blender#>DestAtop(Vector512<float> backdrop, Vector512<float> source, Vector512<float> opacity)
|
|
{
|
|
source = Avx512F.BlendVariable(source, source * opacity, AlphaMask512());
|
|
|
|
return Atop(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="Vector4"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector4 <#=blender#>DestOver(Vector4 backdrop, Vector4 source, float opacity)
|
|
{
|
|
source = Numerics.WithW(source, source * opacity);
|
|
|
|
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, source * opacity, BlendAlphaControl);
|
|
|
|
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="Vector512{Single}"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector512<float> <#=blender#>DestOver(Vector512<float> backdrop, Vector512<float> source, Vector512<float> opacity)
|
|
{
|
|
source = Avx512F.BlendVariable(source, source * opacity, AlphaMask512());
|
|
|
|
return Over(source, backdrop, <#=blender#>(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="Vector4"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector4 <#=blender#>DestIn(Vector4 backdrop, Vector4 source, float opacity)
|
|
{
|
|
source = Numerics.WithW(source, source * opacity);
|
|
|
|
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, source * opacity, BlendAlphaControl), 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="Vector512{Single}"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector512<float> <#=blender#>DestIn(Vector512<float> backdrop, Vector512<float> source, Vector512<float> opacity)
|
|
=> In(Avx512F.BlendVariable(source, source * opacity, AlphaMask512()), 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="Vector4"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector4 <#=blender#>DestOut(Vector4 backdrop, Vector4 source, float opacity)
|
|
{
|
|
source = Numerics.WithW(source, source * opacity);
|
|
|
|
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, source * opacity, BlendAlphaControl), 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="Vector512{Single}"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector512<float> <#=blender#>DestOut(Vector512<float> backdrop, Vector512<float> source, Vector512<float> opacity)
|
|
=> Out(Avx512F.BlendVariable(source, source * opacity, AlphaMask512()), backdrop);
|
|
|
|
/// <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="Vector4"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector4 <#=blender#>Xor(Vector4 backdrop, Vector4 source, float opacity)
|
|
{
|
|
source = Numerics.WithW(source, source * opacity);
|
|
|
|
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, source * opacity, BlendAlphaControl));
|
|
|
|
/// <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="Vector512{Single}"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector512<float> <#=blender#>Xor(Vector512<float> backdrop, Vector512<float> source, Vector512<float> opacity)
|
|
=> Xor(backdrop, Avx512F.BlendVariable(source, source * opacity, AlphaMask512()));
|
|
|
|
/// <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="Vector4"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector4 <#=blender#>Clear(Vector4 backdrop, Vector4 source, float opacity)
|
|
{
|
|
source = Numerics.WithW(source, source * opacity);
|
|
|
|
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#>Clear(Vector256<float> backdrop, Vector256<float> source, Vector256<float> opacity)
|
|
=> Clear(backdrop, Avx.Blend(source, source * opacity, BlendAlphaControl));
|
|
|
|
/// <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="Vector512{Single}"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static Vector512<float> <#=blender#>Clear(Vector512<float> backdrop, Vector512<float> source, Vector512<float> opacity)
|
|
=> Clear(backdrop, Avx512F.BlendVariable(source, source * opacity, AlphaMask512()));
|
|
|
|
<#} #>
|
|
|
|
<# void GenerateGenericPixelBlender(string blender, string composer) { #>
|
|
|
|
/// <summary>
|
|
/// Returns the result of the "<#=blender#><#=composer#>" compositing equation.
|
|
/// </summary>
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
/// <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 <typeparamref name="TPixel"/>.</returns>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static TPixel <#=blender#><#=composer#><TPixel>(TPixel backdrop, TPixel source, float opacity)
|
|
where TPixel : unmanaged, IPixel<TPixel>
|
|
{
|
|
opacity = Numerics.Clamp(opacity, 0, 1);
|
|
return TPixel.FromScaledVector4(<#=blender#><#=composer#>(backdrop.ToScaledVector4(), source.ToScaledVector4(), opacity));
|
|
}
|
|
<# } #>
|
|
<#
|
|
var composers = new []{
|
|
"Src",
|
|
"SrcAtop",
|
|
"SrcOver",
|
|
"SrcIn",
|
|
"SrcOut",
|
|
"Dest",
|
|
"DestAtop",
|
|
"DestOver",
|
|
"DestIn",
|
|
"DestOut",
|
|
"Clear",
|
|
"Xor",
|
|
};
|
|
|
|
var blenders = new []{
|
|
"Normal",
|
|
"Multiply",
|
|
"Add",
|
|
"Subtract",
|
|
"Screen",
|
|
"Darken",
|
|
"Lighten",
|
|
"Overlay",
|
|
"HardLight"
|
|
};
|
|
|
|
foreach(var blender in blenders)
|
|
{
|
|
GeneratePixelBlenders(blender);
|
|
foreach(var composer in composers)
|
|
{
|
|
GenerateGenericPixelBlender(blender,composer);
|
|
}
|
|
}
|
|
#>
|
|
}
|
|
|