From be1e555a604ca5c3e8afdf4fd5a963e51bade47b Mon Sep 17 00:00:00 2001 From: Vicente Penades Date: Wed, 27 Jun 2018 13:44:56 +0200 Subject: [PATCH 01/10] Changed Pixel Blender/Composer generators to generate all combinations of ColorBlenders and AlphaComposers --- .../GradientBrushBase{TPixel}.cs | 2 +- .../DefaultPixelBlenders.Generated.cs | 3679 ++++++++++++++++- .../DefaultPixelBlenders.Generated.tt | 50 +- .../PorterDuffFunctions.Generated.cs | 2827 ++++++++++++- .../PorterDuffFunctions.Generated.tt | 150 +- .../PixelBlenders/PorterDuffFunctions.cs | 371 +- .../PixelOperations{TPixel}.PixelBenders.cs | 42 +- .../PixelBlenders/PorterDuffBulkVsPixel.cs | 4 +- .../PixelBlenders/PorterDuffFunctionsTests.cs | 18 +- .../PorterDuffFunctionsTests_TPixel.cs | 54 +- .../PixelOperationsTests.Blender.cs | 84 +- 11 files changed, 6706 insertions(+), 575 deletions(-) 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 @@ protected GradientBrushApplicatorBase( 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 @@ internal static class DefaultPixelBlenders 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati 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 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } + + 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 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.HardLight_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Normal_SrcOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Normal_SrcOut Instance { get; } = new Normal_SrcOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Normal_SrcOut(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_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Multiply_SrcOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Multiply_SrcOut Instance { get; } = new Multiply_SrcOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Multiply_SrcOut(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_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Add_SrcOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Add_SrcOut Instance { get; } = new Add_SrcOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Add_SrcOut(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_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Subtract_SrcOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Subtract_SrcOut Instance { get; } = new Subtract_SrcOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Subtract_SrcOut(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_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Screen_SrcOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Screen_SrcOut Instance { get; } = new Screen_SrcOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Screen_SrcOut(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_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Darken_SrcOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Darken_SrcOut Instance { get; } = new Darken_SrcOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Darken_SrcOut(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_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Lighten_SrcOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Lighten_SrcOut Instance { get; } = new Lighten_SrcOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Lighten_SrcOut(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_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Overlay_SrcOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Overlay_SrcOut Instance { get; } = new Overlay_SrcOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Overlay_SrcOut(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_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class HardLight_SrcOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static HardLight_SrcOut Instance { get; } = new HardLight_SrcOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.HardLight_SrcOut(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.HardLight_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Normal_Dest : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Normal_Dest Instance { get; } = new Normal_Dest(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Normal_Dest(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_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Multiply_Dest : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Multiply_Dest Instance { get; } = new Multiply_Dest(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Multiply_Dest(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_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Add_Dest : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Add_Dest Instance { get; } = new Add_Dest(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Add_Dest(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_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Subtract_Dest : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Subtract_Dest Instance { get; } = new Subtract_Dest(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Subtract_Dest(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_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Screen_Dest : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Screen_Dest Instance { get; } = new Screen_Dest(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Screen_Dest(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_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Darken_Dest : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Darken_Dest Instance { get; } = new Darken_Dest(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Darken_Dest(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_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Lighten_Dest : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Lighten_Dest Instance { get; } = new Lighten_Dest(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Lighten_Dest(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_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Overlay_Dest : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Overlay_Dest Instance { get; } = new Overlay_Dest(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Overlay_Dest(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_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class HardLight_Dest : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static HardLight_Dest Instance { get; } = new HardLight_Dest(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.HardLight_Dest(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.HardLight_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Normal_DestAtop : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Normal_DestAtop Instance { get; } = new Normal_DestAtop(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Normal_DestAtop(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_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Multiply_DestAtop : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Multiply_DestAtop Instance { get; } = new Multiply_DestAtop(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Multiply_DestAtop(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_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Add_DestAtop : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Add_DestAtop Instance { get; } = new Add_DestAtop(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Add_DestAtop(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_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Subtract_DestAtop : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Subtract_DestAtop Instance { get; } = new Subtract_DestAtop(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Subtract_DestAtop(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_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Screen_DestAtop : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Screen_DestAtop Instance { get; } = new Screen_DestAtop(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Screen_DestAtop(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_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Darken_DestAtop : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Darken_DestAtop Instance { get; } = new Darken_DestAtop(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Darken_DestAtop(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_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Lighten_DestAtop : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Lighten_DestAtop Instance { get; } = new Lighten_DestAtop(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Lighten_DestAtop(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_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Overlay_DestAtop : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Overlay_DestAtop Instance { get; } = new Overlay_DestAtop(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Overlay_DestAtop(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_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class HardLight_DestAtop : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static HardLight_DestAtop Instance { get; } = new HardLight_DestAtop(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.HardLight_DestAtop(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.HardLight_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Normal_DestOver : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Normal_DestOver Instance { get; } = new Normal_DestOver(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Normal_DestOver(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_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Multiply_DestOver : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Multiply_DestOver Instance { get; } = new Multiply_DestOver(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Multiply_DestOver(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_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Add_DestOver : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Add_DestOver Instance { get; } = new Add_DestOver(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Add_DestOver(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_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Subtract_DestOver : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Subtract_DestOver Instance { get; } = new Subtract_DestOver(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Subtract_DestOver(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_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Screen_DestOver : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Screen_DestOver Instance { get; } = new Screen_DestOver(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Screen_DestOver(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_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Darken_DestOver : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Darken_DestOver Instance { get; } = new Darken_DestOver(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Darken_DestOver(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_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Lighten_DestOver : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Lighten_DestOver Instance { get; } = new Lighten_DestOver(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Lighten_DestOver(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_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Overlay_DestOver : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Overlay_DestOver Instance { get; } = new Overlay_DestOver(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Overlay_DestOver(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_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class HardLight_DestOver : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static HardLight_DestOver Instance { get; } = new HardLight_DestOver(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.HardLight_DestOver(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.HardLight_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Normal_DestIn : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Normal_DestIn Instance { get; } = new Normal_DestIn(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Normal_DestIn(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_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Multiply_DestIn : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Multiply_DestIn Instance { get; } = new Multiply_DestIn(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Multiply_DestIn(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_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Add_DestIn : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Add_DestIn Instance { get; } = new Add_DestIn(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Add_DestIn(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_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Subtract_DestIn : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Subtract_DestIn Instance { get; } = new Subtract_DestIn(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Subtract_DestIn(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_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Screen_DestIn : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Screen_DestIn Instance { get; } = new Screen_DestIn(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Screen_DestIn(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_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Darken_DestIn : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Darken_DestIn Instance { get; } = new Darken_DestIn(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Darken_DestIn(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_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Lighten_DestIn : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Lighten_DestIn Instance { get; } = new Lighten_DestIn(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Lighten_DestIn(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_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Overlay_DestIn : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Overlay_DestIn Instance { get; } = new Overlay_DestIn(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Overlay_DestIn(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_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class HardLight_DestIn : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static HardLight_DestIn Instance { get; } = new HardLight_DestIn(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.HardLight_DestIn(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.HardLight_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Normal_DestOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Normal_DestOut Instance { get; } = new Normal_DestOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Normal_DestOut(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_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Multiply_DestOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Multiply_DestOut Instance { get; } = new Multiply_DestOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Multiply_DestOut(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_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Add_DestOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Add_DestOut Instance { get; } = new Add_DestOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Add_DestOut(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_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Subtract_DestOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Subtract_DestOut Instance { get; } = new Subtract_DestOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Subtract_DestOut(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_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Screen_DestOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Screen_DestOut Instance { get; } = new Screen_DestOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Screen_DestOut(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_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Darken_DestOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Darken_DestOut Instance { get; } = new Darken_DestOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Darken_DestOut(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_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Lighten_DestOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Lighten_DestOut Instance { get; } = new Lighten_DestOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Lighten_DestOut(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_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Overlay_DestOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Overlay_DestOut Instance { get; } = new Overlay_DestOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Overlay_DestOut(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_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class HardLight_DestOut : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static HardLight_DestOut Instance { get; } = new HardLight_DestOut(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.HardLight_DestOut(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.HardLight_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Normal_Clear : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Normal_Clear Instance { get; } = new Normal_Clear(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Normal_Clear(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_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Multiply_Clear : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Multiply_Clear Instance { get; } = new Multiply_Clear(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Multiply_Clear(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_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Add_Clear : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Add_Clear Instance { get; } = new Add_Clear(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Add_Clear(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_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Subtract_Clear : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Subtract_Clear Instance { get; } = new Subtract_Clear(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Subtract_Clear(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_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Screen_Clear : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Screen_Clear Instance { get; } = new Screen_Clear(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Screen_Clear(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_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Darken_Clear : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Darken_Clear Instance { get; } = new Darken_Clear(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Darken_Clear(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_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Lighten_Clear : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Lighten_Clear Instance { get; } = new Lighten_Clear(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Lighten_Clear(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_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Overlay_Clear : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Overlay_Clear Instance { get; } = new Overlay_Clear(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Overlay_Clear(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_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class HardLight_Clear : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static HardLight_Clear Instance { get; } = new HardLight_Clear(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.HardLight_Clear(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.HardLight_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Normal_Xor : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Normal_Xor Instance { get; } = new Normal_Xor(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Normal_Xor(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_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Multiply_Xor : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Multiply_Xor Instance { get; } = new Multiply_Xor(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Multiply_Xor(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_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Add_Xor : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Add_Xor Instance { get; } = new Add_Xor(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Add_Xor(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_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Subtract_Xor : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Subtract_Xor Instance { get; } = new Subtract_Xor(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Subtract_Xor(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_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Screen_Xor : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Screen_Xor Instance { get; } = new Screen_Xor(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Screen_Xor(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_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Darken_Xor : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Darken_Xor Instance { get; } = new Darken_Xor(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Darken_Xor(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_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Lighten_Xor : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Lighten_Xor Instance { get; } = new Lighten_Xor(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Lighten_Xor(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_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class Overlay_Xor : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static Overlay_Xor Instance { get; } = new Overlay_Xor(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.Overlay_Xor(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_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + + internal class HardLight_Xor : PixelBlender + { + /// + /// Gets the static instance of this blender. + /// + public static HardLight_Xor Instance { get; } = new HardLight_Xor(); + + /// + public override TPixel Blend(TPixel background, TPixel source, float amount) + { + return PorterDuffFunctions.HardLight_Xor(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.HardLight_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + } + + PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); + } + } + } + + } } \ No newline at end of file diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt index 07888a756d..c2afc6cf67 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt +++ b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt @@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders { using System; using System.Numerics; - using SixLabors.ImageSharp.Memory; + using SixLabors.Memory; /// @@ -35,24 +35,12 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders { <# - - - - string[] blenders = new []{ - "Normal", - "Multiply", - "Add", - "Subtract", - "Screen", - "Darken", - "Lighten", - "Overlay", - "HardLight", + string[] composers = new []{ "Src" , - "Atop" , - "Over" , - "In" , - "Out" , + "SrcAtop" , + "SrcOver" , + "SrcIn" , + "SrcOut" , "Dest" , "DestAtop" , "DestOver" , @@ -62,21 +50,37 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders "Xor" , }; + string[] blenders = new []{ + "Normal" , + "Multiply" , + "Add" , + "Subtract" , + "Screen" , + "Darken" , + "Lighten" , + "Overlay" , + "HardLight" + }; + + foreach(var composer in composers) { foreach(var blender in blenders) { + + string blender_composer= $"{blender}_{composer}"; + #> - internal class <#=blender#> : PixelBlender + internal class <#= blender_composer#> : PixelBlender { /// /// Gets the static instance of this blender. /// - public static <#=blender#> Instance { get; } = new <#=blender#>(); + public static <#= blender_composer#> Instance { get; } = new <#= blender_composer#>(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.<#=blender#>(background, source, amount); + return PorterDuffFunctions.<#= blender_composer#>(background, source, amount); } /// @@ -97,7 +101,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.<#=blender#>(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.<#= blender_composer#>(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -106,7 +110,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } <# - + } } #> diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs index 66cc427deb..25c22bd502 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.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. // @@ -11,12 +18,14 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders { internal static partial class PorterDuffFunctions { + + + #region Compositors + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Src(Vector4 backdrop, Vector4 source, Vector4 xform) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - // calculate weights float xw = backdrop.W * source.W; float bw = backdrop.W - xw; @@ -26,17 +35,15 @@ public static Vector4 Src(Vector4 backdrop, Vector4 source, float opacity) float fw = (sw * 1) + (bw * 0) + (xw * 1); // calculate final value - Vector4 xform = ((source * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((xform * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; - return Vector4.Lerp(backdrop, xform, opacity); + return xform; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Atop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SrcAtop(Vector4 backdrop, Vector4 source, Vector4 xform) { - opacity = opacity.Clamp(0, 1); - // calculate weights float xw = backdrop.W * source.W; float bw = backdrop.W - xw; @@ -46,18 +53,15 @@ public static Vector4 Atop(Vector4 backdrop, Vector4 source, float opacity) float fw = (sw * 0) + (bw * 1) + (xw * 1); // calculate final value - Vector4 xform = ((source * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((xform * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; - return Vector4.Lerp(backdrop, xform, opacity); + return xform; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Over(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SrcOver(Vector4 backdrop, Vector4 source, Vector4 xform) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - // calculate weights float xw = backdrop.W * source.W; float bw = backdrop.W - xw; @@ -67,17 +71,15 @@ public static Vector4 Over(Vector4 backdrop, Vector4 source, float opacity) float fw = (sw * 1) + (bw * 1) + (xw * 1); // calculate final value - Vector4 xform = ((source * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((xform * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; - return Vector4.Lerp(backdrop, xform, opacity); + return xform; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 In(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SrcIn(Vector4 backdrop, Vector4 source, Vector4 xform) { - opacity = opacity.Clamp(0, 1); - // calculate weights float xw = backdrop.W * source.W; float bw = backdrop.W - xw; @@ -87,18 +89,15 @@ public static Vector4 In(Vector4 backdrop, Vector4 source, float opacity) float fw = (sw * 0) + (bw * 0) + (xw * 1); // calculate final value - Vector4 xform = ((source * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((xform * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; - return Vector4.Lerp(backdrop, xform, opacity); + return xform; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Out(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SrcOut(Vector4 backdrop, Vector4 source, Vector4 xform) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - // calculate weights float xw = backdrop.W * source.W; float bw = backdrop.W - xw; @@ -108,17 +107,15 @@ public static Vector4 Out(Vector4 backdrop, Vector4 source, float opacity) float fw = (sw * 1) + (bw * 0) + (xw * 0); // calculate final value - Vector4 xform = ((Vector4.Zero * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((Vector4.Zero * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; - return Vector4.Lerp(backdrop, xform, opacity); + return xform; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Dest(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Dest(Vector4 backdrop, Vector4 source, Vector4 xform) { - opacity = opacity.Clamp(0, 1); - // calculate weights float xw = backdrop.W * source.W; float bw = backdrop.W - xw; @@ -128,18 +125,15 @@ public static Vector4 Dest(Vector4 backdrop, Vector4 source, float opacity) float fw = (sw * 0) + (bw * 1) + (xw * 1); // calculate final value - Vector4 xform = ((backdrop * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((backdrop * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; - return Vector4.Lerp(backdrop, xform, opacity); + return xform; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 DestAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DestAtop(Vector4 backdrop, Vector4 source, Vector4 xform) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - // calculate weights float xw = backdrop.W * source.W; float bw = backdrop.W - xw; @@ -149,18 +143,15 @@ public static Vector4 DestAtop(Vector4 backdrop, Vector4 source, float opacity) float fw = (sw * 1) + (bw * 0) + (xw * 1); // calculate final value - Vector4 xform = ((backdrop * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((backdrop * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; - return Vector4.Lerp(backdrop, xform, opacity); + return xform; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 DestOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DestOver(Vector4 backdrop, Vector4 source, Vector4 xform) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - // calculate weights float xw = backdrop.W * source.W; float bw = backdrop.W - xw; @@ -170,17 +161,15 @@ public static Vector4 DestOver(Vector4 backdrop, Vector4 source, float opacity) float fw = (sw * 1) + (bw * 1) + (xw * 1); // calculate final value - Vector4 xform = ((backdrop * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((backdrop * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; - return Vector4.Lerp(backdrop, xform, opacity); + return xform; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DestIn(Vector4 backdrop, Vector4 source, Vector4 xform) { - opacity = opacity.Clamp(0, 1); - // calculate weights float xw = backdrop.W * source.W; float bw = backdrop.W - xw; @@ -190,17 +179,15 @@ public static Vector4 DestIn(Vector4 backdrop, Vector4 source, float opacity) float fw = (sw * 0) + (bw * 0) + (xw * 1); // calculate final value - Vector4 xform = ((backdrop * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((backdrop * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; - return Vector4.Lerp(backdrop, xform, opacity); + return xform; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DestOut(Vector4 backdrop, Vector4 source, Vector4 xform) { - opacity = opacity.Clamp(0, 1); - // calculate weights float xw = backdrop.W * source.W; float bw = backdrop.W - xw; @@ -210,17 +197,15 @@ public static Vector4 DestOut(Vector4 backdrop, Vector4 source, float opacity) float fw = (sw * 0) + (bw * 1) + (xw * 0); // calculate final value - Vector4 xform = ((Vector4.Zero * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((Vector4.Zero * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; - return Vector4.Lerp(backdrop, xform, opacity); + return xform; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Clear(Vector4 backdrop, Vector4 source, Vector4 xform) { - opacity = opacity.Clamp(0, 1); - // calculate weights float xw = backdrop.W * source.W; float bw = backdrop.W - xw; @@ -230,18 +215,15 @@ public static Vector4 Clear(Vector4 backdrop, Vector4 source, float opacity) float fw = (sw * 0) + (bw * 0) + (xw * 0); // calculate final value - Vector4 xform = ((Vector4.Zero * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((Vector4.Zero * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; - return Vector4.Lerp(backdrop, xform, opacity); + return xform; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Xor(Vector4 backdrop, Vector4 source, Vector4 xform) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - // calculate weights float xw = backdrop.W * source.W; float bw = backdrop.W - xw; @@ -251,200 +233,2827 @@ public static Vector4 Xor(Vector4 backdrop, Vector4 source, float opacity) float fw = (sw * 1) + (bw * 1) + (xw * 0); // calculate final value - Vector4 xform = ((Vector4.Zero * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((Vector4.Zero * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; - return Vector4.Lerp(backdrop, xform, opacity); + return xform; + } + + + #endregion + + #region Blenders + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop,source, Normal(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Src(backdropV,sourceV, Normal(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop,source, Multiply(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Src(backdropV,sourceV, Multiply(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop,source, Add(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Src(backdropV,sourceV, Add(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop,source, Subtract(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Src(backdropV,sourceV, Subtract(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop,source, Screen(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Src(backdropV,sourceV, Screen(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop,source, Darken(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal(TPixel backdrop, TPixel source, float amount) + public static TPixel Darken_Src(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Normal(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(Src(backdropV,sourceV, Darken(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop,source, Lighten(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply(TPixel backdrop, TPixel source, float amount) + public static TPixel Lighten_Src(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Multiply(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(Src(backdropV,sourceV, Lighten(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop,source, Overlay(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add(TPixel backdrop, TPixel source, float amount) + public static TPixel Overlay_Src(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Add(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(Src(backdropV,sourceV, Overlay(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop,source, HardLight(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract(TPixel backdrop, TPixel source, float amount) + public static TPixel HardLight_Src(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Subtract(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(Src(backdropV,sourceV, HardLight(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcAtop(backdrop,source, Normal(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen(TPixel backdrop, TPixel source, float amount) + public static TPixel Normal_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Screen(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcAtop(backdropV,sourceV, Normal(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcAtop(backdrop,source, Multiply(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken(TPixel backdrop, TPixel source, float amount) + public static TPixel Multiply_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Darken(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcAtop(backdropV,sourceV, Multiply(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcAtop(backdrop,source, Add(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten(TPixel backdrop, TPixel source, float amount) + public static TPixel Add_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Lighten(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcAtop(backdropV,sourceV, Add(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcAtop(backdrop,source, Subtract(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay(TPixel backdrop, TPixel source, float amount) + public static TPixel Subtract_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Overlay(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcAtop(backdropV,sourceV, Subtract(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcAtop(backdrop,source, Screen(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight(TPixel backdrop, TPixel source, float amount) + public static TPixel Screen_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(HardLight(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcAtop(backdropV,sourceV, Screen(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcAtop(backdrop,source, Darken(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Src(TPixel backdrop, TPixel source, float amount) + public static TPixel Darken_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Src(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcAtop(backdropV,sourceV, Darken(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcAtop(backdrop,source, Lighten(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Atop(TPixel backdrop, TPixel source, float amount) + public static TPixel Lighten_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Atop(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcAtop(backdropV,sourceV, Lighten(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcAtop(backdrop,source, Overlay(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Over(TPixel backdrop, TPixel source, float amount) + public static TPixel Overlay_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Over(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcAtop(backdropV,sourceV, Overlay(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcAtop(backdrop,source, HardLight(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel In(TPixel backdrop, TPixel source, float amount) + public static TPixel HardLight_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(In(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcAtop(backdropV,sourceV, HardLight(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOver(backdrop,source, Normal(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Out(TPixel backdrop, TPixel source, float amount) + public static TPixel Normal_SrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Out(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcOver(backdropV,sourceV, Normal(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOver(backdrop,source, Multiply(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Dest(TPixel backdrop, TPixel source, float amount) + public static TPixel Multiply_SrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Dest(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcOver(backdropV,sourceV, Multiply(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOver(backdrop,source, Add(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel DestAtop(TPixel backdrop, TPixel source, float amount) + public static TPixel Add_SrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(DestAtop(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcOver(backdropV,sourceV, Add(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOver(backdrop,source, Subtract(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel DestOver(TPixel backdrop, TPixel source, float amount) + public static TPixel Subtract_SrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(DestOver(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcOver(backdropV,sourceV, Subtract(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOver(backdrop,source, Screen(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel DestIn(TPixel backdrop, TPixel source, float amount) + public static TPixel Screen_SrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(DestIn(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcOver(backdropV,sourceV, Screen(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOver(backdrop,source, Darken(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel DestOut(TPixel backdrop, TPixel source, float amount) + public static TPixel Darken_SrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(DestOut(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcOver(backdropV,sourceV, Darken(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOver(backdrop,source, Lighten(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Clear(TPixel backdrop, TPixel source, float amount) + public static TPixel Lighten_SrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Clear(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcOver(backdropV,sourceV, Lighten(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOver(backdrop,source, Overlay(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Xor(TPixel backdrop, TPixel source, float amount) + public static TPixel Overlay_SrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + TPixel dest = default; - dest.PackFromVector4(Xor(backdrop.ToVector4(), source.ToVector4(), amount)); + dest.PackFromVector4(SrcOver(backdropV,sourceV, Overlay(backdropV, sourceV))); return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOver(backdrop,source, HardLight(backdrop, source)); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcOver(backdropV,sourceV, HardLight(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop,source, Normal(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcIn(backdropV,sourceV, Normal(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop,source, Multiply(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcIn(backdropV,sourceV, Multiply(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop,source, Add(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcIn(backdropV,sourceV, Add(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop,source, Subtract(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcIn(backdropV,sourceV, Subtract(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop,source, Screen(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcIn(backdropV,sourceV, Screen(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop,source, Darken(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcIn(backdropV,sourceV, Darken(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop,source, Lighten(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcIn(backdropV,sourceV, Lighten(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop,source, Overlay(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcIn(backdropV,sourceV, Overlay(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop,source, HardLight(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcIn(backdropV,sourceV, HardLight(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOut(backdrop,source, Normal(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcOut(backdropV,sourceV, Normal(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOut(backdrop,source, Multiply(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcOut(backdropV,sourceV, Multiply(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOut(backdrop,source, Add(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcOut(backdropV,sourceV, Add(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOut(backdrop,source, Subtract(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcOut(backdropV,sourceV, Subtract(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOut(backdrop,source, Screen(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcOut(backdropV,sourceV, Screen(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOut(backdrop,source, Darken(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcOut(backdropV,sourceV, Darken(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOut(backdrop,source, Lighten(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcOut(backdropV,sourceV, Lighten(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOut(backdrop,source, Overlay(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcOut(backdropV,sourceV, Overlay(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOut(backdrop,source, HardLight(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(SrcOut(backdropV,sourceV, HardLight(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Dest(backdrop,source, Normal(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Dest(backdropV,sourceV, Normal(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Dest(backdrop,source, Multiply(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Dest(backdropV,sourceV, Multiply(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Dest(backdrop,source, Add(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Dest(backdropV,sourceV, Add(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Dest(backdrop,source, Subtract(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Dest(backdropV,sourceV, Subtract(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Dest(backdrop,source, Screen(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Dest(backdropV,sourceV, Screen(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Dest(backdrop,source, Darken(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Dest(backdropV,sourceV, Darken(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Dest(backdrop,source, Lighten(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Dest(backdropV,sourceV, Lighten(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Dest(backdrop,source, Overlay(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Dest(backdropV,sourceV, Overlay(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Dest(backdrop,source, HardLight(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Dest(backdropV,sourceV, HardLight(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop,source, Normal(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestAtop(backdropV,sourceV, Normal(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop,source, Multiply(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestAtop(backdropV,sourceV, Multiply(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop,source, Add(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestAtop(backdropV,sourceV, Add(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop,source, Subtract(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestAtop(backdropV,sourceV, Subtract(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop,source, Screen(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestAtop(backdropV,sourceV, Screen(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop,source, Darken(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestAtop(backdropV,sourceV, Darken(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop,source, Lighten(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestAtop(backdropV,sourceV, Lighten(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop,source, Overlay(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestAtop(backdropV,sourceV, Overlay(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop,source, HardLight(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestAtop(backdropV,sourceV, HardLight(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOver(backdrop,source, Normal(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOver(backdropV,sourceV, Normal(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOver(backdrop,source, Multiply(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOver(backdropV,sourceV, Multiply(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOver(backdrop,source, Add(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOver(backdropV,sourceV, Add(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOver(backdrop,source, Subtract(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOver(backdropV,sourceV, Subtract(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOver(backdrop,source, Screen(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOver(backdropV,sourceV, Screen(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOver(backdrop,source, Darken(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOver(backdropV,sourceV, Darken(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOver(backdrop,source, Lighten(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOver(backdropV,sourceV, Lighten(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOver(backdrop,source, Overlay(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOver(backdropV,sourceV, Overlay(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOver(backdrop,source, HardLight(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOver(backdropV,sourceV, HardLight(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestIn(backdrop,source, Normal(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestIn(backdropV,sourceV, Normal(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestIn(backdrop,source, Multiply(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestIn(backdropV,sourceV, Multiply(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestIn(backdrop,source, Add(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestIn(backdropV,sourceV, Add(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestIn(backdrop,source, Subtract(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestIn(backdropV,sourceV, Subtract(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestIn(backdrop,source, Screen(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestIn(backdropV,sourceV, Screen(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestIn(backdrop,source, Darken(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestIn(backdropV,sourceV, Darken(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestIn(backdrop,source, Lighten(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestIn(backdropV,sourceV, Lighten(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestIn(backdrop,source, Overlay(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestIn(backdropV,sourceV, Overlay(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestIn(backdrop,source, HardLight(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestIn(backdropV,sourceV, HardLight(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOut(backdrop,source, Normal(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOut(backdropV,sourceV, Normal(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOut(backdrop,source, Multiply(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOut(backdropV,sourceV, Multiply(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOut(backdrop,source, Add(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOut(backdropV,sourceV, Add(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOut(backdrop,source, Subtract(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOut(backdropV,sourceV, Subtract(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOut(backdrop,source, Screen(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOut(backdropV,sourceV, Screen(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOut(backdrop,source, Darken(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOut(backdropV,sourceV, Darken(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOut(backdrop,source, Lighten(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOut(backdropV,sourceV, Lighten(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOut(backdrop,source, Overlay(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOut(backdropV,sourceV, Overlay(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOut(backdrop,source, HardLight(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(DestOut(backdropV,sourceV, HardLight(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop,source, Normal(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Clear(backdropV,sourceV, Normal(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop,source, Multiply(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Clear(backdropV,sourceV, Multiply(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop,source, Add(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Clear(backdropV,sourceV, Add(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop,source, Subtract(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Clear(backdropV,sourceV, Subtract(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop,source, Screen(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Clear(backdropV,sourceV, Screen(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop,source, Darken(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Clear(backdropV,sourceV, Darken(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop,source, Lighten(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Clear(backdropV,sourceV, Lighten(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop,source, Overlay(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Clear(backdropV,sourceV, Overlay(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop,source, HardLight(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Clear(backdropV,sourceV, HardLight(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop,source, Normal(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Xor(backdropV,sourceV, Normal(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop,source, Multiply(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Xor(backdropV,sourceV, Multiply(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop,source, Add(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Xor(backdropV,sourceV, Add(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop,source, Subtract(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Xor(backdropV,sourceV, Subtract(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop,source, Screen(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Xor(backdropV,sourceV, Screen(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop,source, Darken(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Xor(backdropV,sourceV, Darken(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop,source, Lighten(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Xor(backdropV,sourceV, Lighten(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop,source, Overlay(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Xor(backdropV,sourceV, Overlay(backdropV, sourceV))); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop,source, HardLight(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(Xor(backdropV,sourceV, HardLight(backdropV, sourceV))); + return dest; + } + + + + #endregion } } \ No newline at end of file diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt index 4cbc068618..25f1e76487 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt @@ -21,37 +21,15 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders { internal static partial class PorterDuffFunctions { -<# - - void GeneratePixelBlender (string blender) - { -#> - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel <#=blender#>(TPixel backdrop, TPixel source, float amount) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(<#=blender#>(backdrop.ToVector4(), source.ToVector4(), amount)); - return dest; - } - -<# - } - - void GenerateVectorCompositor(string name, string sourceVar, string destVar, string blendVar) +<# void GenerateVectorCompositor(string name, string sourceVar, string destVar, string blendVar) { int a_s = sourceVar == "Vector4.Zero" ? 0 : 1; int a_b = destVar == "Vector4.Zero" ? 0 : 1; int a_x = blendVar == "Vector4.Zero" ? 0 : 1; #> [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=name#>(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=name#>(Vector4 backdrop, Vector4 source, Vector4 xform) { - opacity = opacity.Clamp(0, 1); -<# if(sourceVar != "Vector4.Zero" ) { #> - source.W *= opacity; -<# } #> - // calculate weights float xw = backdrop.W * source.W; float bw = backdrop.W - xw; @@ -61,52 +39,98 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders float fw = (sw * <#=a_s#>) + (bw * <#=a_b#>) + (xw * <#=a_x#>); // calculate final value - Vector4 xform = ((<#=blendVar#> * xw) + (<#=destVar#> * bw) + (<#=sourceVar#> * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((<#=blendVar#> * xw) + (<#=destVar#> * bw) + (<#=sourceVar#> * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; - return Vector4.Lerp(backdrop, xform, opacity); + return xform; + } +<# } #> +<# void GeneratePixelBlender(string blender, string compositor) { #> + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_<#=compositor#>(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return <#=compositor#>(backdrop,source, <#=blender#>(backdrop, source)); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel <#=blender#>_<#=compositor#>(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + opacity = opacity.Clamp(0, 1); + + Vector4 backdropV = backdrop.ToVector4(); + Vector4 sourceV = source.ToVector4(); + sourceV.W *= opacity; + + TPixel dest = default; + dest.PackFromVector4(<#=compositor#>(backdropV,sourceV, <#=blender#>(backdropV, sourceV))); + return dest; + } + +<# } #> + #region Compositors + <# - } - GenerateVectorCompositor("Src", "source", "Vector4.Zero", "source"); - GenerateVectorCompositor("Atop", "Vector4.Zero", "backdrop", "source"); - GenerateVectorCompositor("Over", "source", "backdrop", "source"); - GenerateVectorCompositor("In", "Vector4.Zero", "Vector4.Zero", "source"); - GenerateVectorCompositor("Out", "source", "Vector4.Zero", "Vector4.Zero"); - GenerateVectorCompositor("Dest", "Vector4.Zero", "backdrop", "backdrop"); - GenerateVectorCompositor("DestAtop", "source", "Vector4.Zero", "backdrop"); - GenerateVectorCompositor("DestOver", "source", "backdrop", "backdrop"); - GenerateVectorCompositor("DestIn", "Vector4.Zero", "Vector4.Zero", "backdrop"); - GenerateVectorCompositor("DestOut", "Vector4.Zero", "backdrop", "Vector4.Zero"); - GenerateVectorCompositor("Clear", "Vector4.Zero", "Vector4.Zero", "Vector4.Zero"); - GenerateVectorCompositor("Xor", "source", "backdrop", "Vector4.Zero"); - - - GeneratePixelBlender("Normal"); - GeneratePixelBlender("Multiply"); - GeneratePixelBlender("Add"); - GeneratePixelBlender("Subtract"); - GeneratePixelBlender("Screen"); - GeneratePixelBlender("Darken"); - GeneratePixelBlender("Lighten"); - GeneratePixelBlender("Overlay"); - GeneratePixelBlender("HardLight"); - - GeneratePixelBlender("Src"); - GeneratePixelBlender("Atop"); - GeneratePixelBlender("Over"); - GeneratePixelBlender("In"); - GeneratePixelBlender("Out"); - GeneratePixelBlender("Dest"); - GeneratePixelBlender("DestAtop"); - GeneratePixelBlender("DestOver"); - GeneratePixelBlender("DestIn"); - GeneratePixelBlender("DestOut"); - GeneratePixelBlender("Clear"); - GeneratePixelBlender("Xor"); +GenerateVectorCompositor("Src", "source", "Vector4.Zero", "xform"); +GenerateVectorCompositor("SrcAtop", "Vector4.Zero", "backdrop", "xform"); +GenerateVectorCompositor("SrcOver", "source", "backdrop", "xform"); +GenerateVectorCompositor("SrcIn", "Vector4.Zero", "Vector4.Zero", "xform"); +GenerateVectorCompositor("SrcOut", "source", "Vector4.Zero", "Vector4.Zero"); +GenerateVectorCompositor("Dest", "Vector4.Zero", "backdrop", "backdrop"); +GenerateVectorCompositor("DestAtop", "source", "Vector4.Zero", "backdrop"); +GenerateVectorCompositor("DestOver", "source", "backdrop", "backdrop"); +GenerateVectorCompositor("DestIn", "Vector4.Zero", "Vector4.Zero", "backdrop"); +GenerateVectorCompositor("DestOut", "Vector4.Zero", "backdrop", "Vector4.Zero"); +GenerateVectorCompositor("Clear", "Vector4.Zero", "Vector4.Zero", "Vector4.Zero"); +GenerateVectorCompositor("Xor", "source", "backdrop", "Vector4.Zero"); +#> + + #endregion + + #region Blenders + +<# +string[] composers = new []{ + "Src" , + "SrcAtop" , + "SrcOver" , + "SrcIn" , + "SrcOut" , + "Dest" , + "DestAtop" , + "DestOver" , + "DestIn" , + "DestOut" , + "Clear" , + "Xor" , +}; +string[] blenders = new []{ + "Normal" , + "Multiply" , + "Add" , + "Subtract" , + "Screen" , + "Darken" , + "Lighten" , + "Overlay" , + "HardLight" +}; +foreach(var composer in composers) +{ + foreach(var blender in blenders) + { + GeneratePixelBlender(blender,composer); + + } +} #> + + #endregion } } \ No newline at end of file diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs index c47ef35a3d..b5e89dbec8 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs @@ -1,194 +1,179 @@ -// Copyright (c) Six Labors and contributors. -// Licensed under the Apache License, Version 2.0. - -using System; -using System.Numerics; -using System.Runtime.CompilerServices; - -namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders -{ - /// - /// Collection of Porter Duff alpha blending functions applying an the 'Over' composition model. - /// - /// - /// These functions are designed to be a general solution for all color cases, - /// that is, they take in account the alpha value of both the backdrop - /// and source, and there's no need to alpha-premultiply neither the backdrop - /// nor the source. - /// Note there are faster functions for when the backdrop color is known - /// to be opaque - /// - internal static partial class PorterDuffFunctions - { - /// - /// Source over backdrop - /// - /// Backdrop color - /// Source color - /// Opacity applied to Source Alpha - /// Output color - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal(Vector4 backdrop, Vector4 source, float opacity) - { - source.W *= opacity; - return Compose(backdrop, source, source); - } - - /// - /// Source multiplied by backdrop - /// - /// Backdrop color - /// Source color - /// Opacity applied to Source Alpha - /// Output color - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply(Vector4 backdrop, Vector4 source, float opacity) - { - source.W *= opacity; - return Compose(backdrop, source, backdrop * source); - } - - /// - /// Source added to backdrop - /// - /// Backdrop color - /// Source color - /// Opacity applied to Source Alpha - /// Output color - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add(Vector4 backdrop, Vector4 source, float opacity) - { - source.W *= opacity; - return Compose(backdrop, source, Vector4.Min(Vector4.One, backdrop + source)); - } - - /// - /// Source subtracted from backdrop - /// - /// Backdrop color - /// Source color - /// Opacity applied to Source Alpha - /// Output color - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract(Vector4 backdrop, Vector4 source, float opacity) - { - source.W *= opacity; - return Compose(backdrop, source, Vector4.Max(Vector4.Zero, backdrop - source)); - } - - /// - /// Complement of source multiplied by the complement of backdrop - /// - /// Backdrop color - /// Source color - /// Opacity applied to Source Alpha - /// Output color - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen(Vector4 backdrop, Vector4 source, float opacity) - { - source.W *= opacity; - return Compose(backdrop, source, Vector4.One - ((Vector4.One - backdrop) * (Vector4.One - source))); - } - - /// - /// Per element, chooses the smallest value of source and backdrop - /// - /// Backdrop color - /// Source color - /// Opacity applied to Source Alpha - /// Output color - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken(Vector4 backdrop, Vector4 source, float opacity) - { - source.W *= opacity; - return Compose(backdrop, source, Vector4.Min(backdrop, source)); - } - - /// - /// Per element, chooses the largest value of source and backdrop - /// - /// Backdrop color - /// Source color - /// Opacity applied to Source Alpha - /// Output color - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten(Vector4 backdrop, Vector4 source, float opacity) - { - source.W *= opacity; - return Compose(backdrop, source, Vector4.Max(backdrop, source)); - } - - /// - /// Overlays source over backdrop - /// - /// Backdrop color - /// Source color - /// Opacity applied to Source Alpha - /// Output color - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay(Vector4 backdrop, Vector4 source, float opacity) - { - source.W *= opacity; - float cr = OverlayValueFunction(backdrop.X, source.X); - float cg = OverlayValueFunction(backdrop.Y, source.Y); - float cb = OverlayValueFunction(backdrop.Z, source.Z); - - return Compose(backdrop, source, Vector4.Min(Vector4.One, new Vector4(cr, cg, cb, 0))); - } - - /// - /// Hard light effect - /// - /// Backdrop color - /// Source color - /// Opacity applied to Source Alpha - /// Output color - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight(Vector4 backdrop, Vector4 source, float opacity) - { - source.W *= opacity; - float cr = OverlayValueFunction(source.X, backdrop.X); - float cg = OverlayValueFunction(source.Y, backdrop.Y); - float cb = OverlayValueFunction(source.Z, backdrop.Z); - - return Compose(backdrop, source, Vector4.Min(Vector4.One, new Vector4(cr, cg, cb, 0))); - } - - /// - /// Helper function for Overlay andHardLight modes - /// - /// Backdrop color element - /// Source color element - /// Overlay value - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static float OverlayValueFunction(float backdrop, float source) - { - return backdrop <= 0.5f ? (2 * backdrop * source) : 1 - ((2 * (1 - source)) * (1 - backdrop)); - } - - /// - /// General composition function for all modes, with a general solution for alpha channel - /// - /// Original Backdrop color - /// Original source color - /// Desired transformed color, without taking Alpha channel in account - /// The final color - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Vector4 Compose(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float a = xw + bw + sw; - - // calculate final value - xform = ((xform * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(a, Constants.Epsilon); - xform.W = a; - - return xform; - } - } +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using System; +using System.Numerics; +using System.Runtime.CompilerServices; + +namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders +{ + /// + /// Collection of Porter Duff alpha blending functions applying an the 'Over' composition model. + /// + /// + /// These functions are designed to be a general solution for all color cases, + /// that is, they take in account the alpha value of both the backdrop + /// and source, and there's no need to alpha-premultiply neither the backdrop + /// nor the source. + /// Note there are faster functions for when the backdrop color is known + /// to be opaque + /// + internal static partial class PorterDuffFunctions + { + /// + /// Source over backdrop + /// + /// Backdrop color + /// Source color + /// Output color + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal(Vector4 backdrop, Vector4 source) + { + return source; + } + + /// + /// Source multiplied by backdrop + /// + /// Backdrop color + /// Source color + /// Output color + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply(Vector4 backdrop, Vector4 source) + { + return backdrop * source; + } + + /// + /// Source added to backdrop + /// + /// Backdrop color + /// Source color + /// Output color + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add(Vector4 backdrop, Vector4 source) + { + return Vector4.Min(Vector4.One, backdrop + source); + } + + /// + /// Source subtracted from backdrop + /// + /// Backdrop color + /// Source color + /// Output color + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract(Vector4 backdrop, Vector4 source) + { + return Vector4.Max(Vector4.Zero, backdrop - source); + } + + /// + /// Complement of source multiplied by the complement of backdrop + /// + /// Backdrop color + /// Source color + /// Output color + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen(Vector4 backdrop, Vector4 source) + { + return Vector4.One - ((Vector4.One - backdrop) * (Vector4.One - source)); + } + + /// + /// Per element, chooses the smallest value of source and backdrop + /// + /// Backdrop color + /// Source color + /// Output color + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken(Vector4 backdrop, Vector4 source) + { + return Vector4.Min(backdrop, source); + } + + /// + /// Per element, chooses the largest value of source and backdrop + /// + /// Backdrop color + /// Source color + /// Output color + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten(Vector4 backdrop, Vector4 source) + { + return Vector4.Max(backdrop, source); + } + + /// + /// Overlays source over backdrop + /// + /// Backdrop color + /// Source color + /// Output color + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay(Vector4 backdrop, Vector4 source) + { + float cr = OverlayValueFunction(backdrop.X, source.X); + float cg = OverlayValueFunction(backdrop.Y, source.Y); + float cb = OverlayValueFunction(backdrop.Z, source.Z); + + return Vector4.Min(Vector4.One, new Vector4(cr, cg, cb, 0)); + } + + /// + /// Hard light effect + /// + /// Backdrop color + /// Source color + /// Output color + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight(Vector4 backdrop, Vector4 source) + { + float cr = OverlayValueFunction(source.X, backdrop.X); + float cg = OverlayValueFunction(source.Y, backdrop.Y); + float cb = OverlayValueFunction(source.Z, backdrop.Z); + + return Vector4.Min(Vector4.One, new Vector4(cr, cg, cb, 0)); + } + + /// + /// Helper function for Overlay andHardLight modes + /// + /// Backdrop color element + /// Source color element + /// Overlay value + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static float OverlayValueFunction(float backdrop, float source) + { + return backdrop <= 0.5f ? (2 * backdrop * source) : 1 - ((2 * (1 - source)) * (1 - backdrop)); + } + + /// + /// General composition function for all modes, with a general solution for alpha channel + /// + /// Original Backdrop color + /// Original source color + /// Desired transformed color, without taking Alpha channel in account + /// The final color + /// + /// This is the default compositor for "normal" alpha blending, which matches the generated SrcOver compositor. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static Vector4 Compose(Vector4 backdrop, Vector4 source, Vector4 xform) + { + // calculate weights + float xw = backdrop.W * source.W; + float bw = backdrop.W - xw; + float sw = source.W - xw; + + // calculate final alpha + float a = xw + bw + sw; + + // calculate final value + xform = ((xform * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(a, Constants.Epsilon); + xform.W = a; + + return xform; + } + } } \ No newline at end of file diff --git a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.PixelBenders.cs b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.PixelBenders.cs index 2c225ba4c4..ad9366bc52 100644 --- a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.PixelBenders.cs +++ b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.PixelBenders.cs @@ -20,30 +20,30 @@ internal virtual PixelBlender GetPixelBlender(PixelBlenderMode mode) { switch (mode) { - case PixelBlenderMode.Multiply: return DefaultPixelBlenders.Multiply.Instance; - case PixelBlenderMode.Add: return DefaultPixelBlenders.Add.Instance; - case PixelBlenderMode.Subtract: return DefaultPixelBlenders.Subtract.Instance; - case PixelBlenderMode.Screen: return DefaultPixelBlenders.Screen.Instance; - case PixelBlenderMode.Darken: return DefaultPixelBlenders.Darken.Instance; - case PixelBlenderMode.Lighten: return DefaultPixelBlenders.Lighten.Instance; - case PixelBlenderMode.Overlay: return DefaultPixelBlenders.Overlay.Instance; - case PixelBlenderMode.HardLight: return DefaultPixelBlenders.HardLight.Instance; - case PixelBlenderMode.Src: return DefaultPixelBlenders.Src.Instance; - case PixelBlenderMode.Atop: return DefaultPixelBlenders.Atop.Instance; - case PixelBlenderMode.Over: return DefaultPixelBlenders.Over.Instance; - case PixelBlenderMode.In: return DefaultPixelBlenders.In.Instance; - case PixelBlenderMode.Out: return DefaultPixelBlenders.Out.Instance; - case PixelBlenderMode.Dest: return DefaultPixelBlenders.Dest.Instance; - case PixelBlenderMode.DestAtop: return DefaultPixelBlenders.DestAtop.Instance; - case PixelBlenderMode.DestOver: return DefaultPixelBlenders.DestOver.Instance; - case PixelBlenderMode.DestIn: return DefaultPixelBlenders.DestIn.Instance; - case PixelBlenderMode.DestOut: return DefaultPixelBlenders.DestOut.Instance; - case PixelBlenderMode.Clear: return DefaultPixelBlenders.Clear.Instance; - case PixelBlenderMode.Xor: return DefaultPixelBlenders.Xor.Instance; + case PixelBlenderMode.Multiply: return DefaultPixelBlenders.Multiply_SrcOver.Instance; + case PixelBlenderMode.Add: return DefaultPixelBlenders.Add_SrcOver.Instance; + case PixelBlenderMode.Subtract: return DefaultPixelBlenders.Subtract_SrcOver.Instance; + case PixelBlenderMode.Screen: return DefaultPixelBlenders.Screen_SrcOver.Instance; + case PixelBlenderMode.Darken: return DefaultPixelBlenders.Darken_SrcOver.Instance; + case PixelBlenderMode.Lighten: return DefaultPixelBlenders.Lighten_SrcOver.Instance; + case PixelBlenderMode.Overlay: return DefaultPixelBlenders.Overlay_SrcOver.Instance; + case PixelBlenderMode.HardLight: return DefaultPixelBlenders.HardLight_SrcOver.Instance; + case PixelBlenderMode.Src: return DefaultPixelBlenders.Normal_Src.Instance; + case PixelBlenderMode.Atop: return DefaultPixelBlenders.Normal_SrcAtop.Instance; + case PixelBlenderMode.Over: return DefaultPixelBlenders.Normal_SrcOver.Instance; + case PixelBlenderMode.In: return DefaultPixelBlenders.Normal_SrcIn.Instance; + case PixelBlenderMode.Out: return DefaultPixelBlenders.Normal_SrcOut.Instance; + case PixelBlenderMode.Dest: return DefaultPixelBlenders.Normal_Dest.Instance; + case PixelBlenderMode.DestAtop: return DefaultPixelBlenders.Normal_DestAtop.Instance; + case PixelBlenderMode.DestOver: return DefaultPixelBlenders.Normal_DestOver.Instance; + case PixelBlenderMode.DestIn: return DefaultPixelBlenders.Normal_DestIn.Instance; + case PixelBlenderMode.DestOut: return DefaultPixelBlenders.Normal_DestOut.Instance; + case PixelBlenderMode.Clear: return DefaultPixelBlenders.Normal_Clear.Instance; + case PixelBlenderMode.Xor: return DefaultPixelBlenders.Normal_Xor.Instance; case PixelBlenderMode.Normal: default: - return DefaultPixelBlenders.Normal.Instance; + return DefaultPixelBlenders.Normal_SrcOver.Instance; } } } diff --git a/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs b/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs index 5fe8b2785d..df7e5b4135 100644 --- a/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs +++ b/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs @@ -35,7 +35,7 @@ private void BulkVectorConvert(Span destination, Span ba for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.Normal_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -50,7 +50,7 @@ private void BulkPixelConvert(Span destination, Span bac for (int i = 0; i < destination.Length; i++) { - destination[i] = PorterDuffFunctions.Normal(destination[i], source[i], amount[i]); + destination[i] = PorterDuffFunctions.Normal_SrcOver(destination[i], source[i], amount[i]); } } diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs index c5910e13a3..c34bdc56e4 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs @@ -22,7 +22,7 @@ public class PorterDuffFunctionsTests [MemberData(nameof(NormalBlendFunctionData))] public void NormalBlendFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Normal((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.Normal_SrcOver((Vector4)back, source, amount); Assert.Equal(expected, actual); } @@ -41,7 +41,7 @@ public void NormalBlendFunction(TestVector4 back, TestVector4 source, float amou [MemberData(nameof(MultiplyFunctionData))] public void MultiplyFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Multiply((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.Multiply_SrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -60,7 +60,7 @@ public void MultiplyFunction(TestVector4 back, TestVector4 source, float amount, [MemberData(nameof(AddFunctionData))] public void AddFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Multiply((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.Multiply_SrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -79,7 +79,7 @@ public void AddFunction(TestVector4 back, TestVector4 source, float amount, Test [MemberData(nameof(SubstractFunctionData))] public void SubstractFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Subtract((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.Subtract_SrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -98,7 +98,7 @@ public void SubstractFunction(TestVector4 back, TestVector4 source, float amount [MemberData(nameof(ScreenFunctionData))] public void ScreenFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Screen((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.Screen_SrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -117,7 +117,7 @@ public void ScreenFunction(TestVector4 back, TestVector4 source, float amount, T [MemberData(nameof(DarkenFunctionData))] public void DarkenFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Darken((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.Darken_SrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -136,7 +136,7 @@ public void DarkenFunction(TestVector4 back, TestVector4 source, float amount, T [MemberData(nameof(LightenFunctionData))] public void LightenFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Lighten((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.Lighten_SrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -155,7 +155,7 @@ public void LightenFunction(TestVector4 back, TestVector4 source, float amount, [MemberData(nameof(OverlayFunctionData))] public void OverlayFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Overlay((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.Overlay_SrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -174,7 +174,7 @@ public void OverlayFunction(TestVector4 back, TestVector4 source, float amount, [MemberData(nameof(HardLightFunctionData))] public void HardLightFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.HardLight((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.HardLight_SrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } } diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs index 1273a453ea..a53591dbc2 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs @@ -34,7 +34,7 @@ private static Span AsSpan(T value) public void NormalBlendFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Normal((TPixel)(TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.Normal_SrcOver((TPixel)(TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -43,7 +43,7 @@ public void NormalBlendFunction(TestPixel back, TestPixel(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Normal().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.Normal_SrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -53,7 +53,7 @@ public void NormalBlendFunction_Blender_Bulk(TestPixel back, Tes where TPixel : struct, IPixel { Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Normal().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + new DefaultPixelBlenders.Normal_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -73,7 +73,7 @@ public void NormalBlendFunction_Blender_Bulk(TestPixel back, Tes public void MultiplyFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Multiply((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.Multiply_SrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -82,7 +82,7 @@ public void MultiplyFunction(TestPixel back, TestPixel s public void MultiplyFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Multiply().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.Multiply_SrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -92,7 +92,7 @@ public void MultiplyFunction_Blender_Bulk(TestPixel back, TestPi where TPixel : struct, IPixel { Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Multiply().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + new DefaultPixelBlenders.Multiply_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -112,7 +112,7 @@ public void MultiplyFunction_Blender_Bulk(TestPixel back, TestPi public void AddFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Add((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.Add_SrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -121,7 +121,7 @@ public void AddFunction(TestPixel back, TestPixel source public void AddFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Add().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.Add_SrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -131,7 +131,7 @@ public void AddFunction_Blender_Bulk(TestPixel back, TestPixel { Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Add().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + new DefaultPixelBlenders.Add_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -151,7 +151,7 @@ public void AddFunction_Blender_Bulk(TestPixel back, TestPixel(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Subtract((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.Subtract_SrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -160,7 +160,7 @@ public void SubstractFunction(TestPixel back, TestPixel public void SubstractFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Subtract().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.Subtract_SrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -170,7 +170,7 @@ public void SubstractFunction_Blender_Bulk(TestPixel back, TestP where TPixel : struct, IPixel { Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Subtract().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + new DefaultPixelBlenders.Subtract_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -190,7 +190,7 @@ public void SubstractFunction_Blender_Bulk(TestPixel back, TestP public void ScreenFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Screen((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.Screen_SrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -199,7 +199,7 @@ public void ScreenFunction(TestPixel back, TestPixel sou public void ScreenFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Screen().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.Screen_SrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -209,7 +209,7 @@ public void ScreenFunction_Blender_Bulk(TestPixel back, TestPixe where TPixel : struct, IPixel { Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Screen().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + new DefaultPixelBlenders.Screen_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -229,7 +229,7 @@ public void ScreenFunction_Blender_Bulk(TestPixel back, TestPixe public void DarkenFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Darken((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.Darken_SrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -238,7 +238,7 @@ public void DarkenFunction(TestPixel back, TestPixel sou public void DarkenFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Darken().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.Darken_SrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -248,7 +248,7 @@ public void DarkenFunction_Blender_Bulk(TestPixel back, TestPixe where TPixel : struct, IPixel { Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Darken().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + new DefaultPixelBlenders.Darken_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -268,7 +268,7 @@ public void DarkenFunction_Blender_Bulk(TestPixel back, TestPixe public void LightenFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Lighten((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.Lighten_SrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -277,7 +277,7 @@ public void LightenFunction(TestPixel back, TestPixel so public void LightenFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Lighten().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.Lighten_SrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -287,7 +287,7 @@ public void LightenFunction_Blender_Bulk(TestPixel back, TestPix where TPixel : struct, IPixel { Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Lighten().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + new DefaultPixelBlenders.Lighten_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -307,7 +307,7 @@ public void LightenFunction_Blender_Bulk(TestPixel back, TestPix public void OverlayFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Overlay((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.Overlay_SrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -316,7 +316,7 @@ public void OverlayFunction(TestPixel back, TestPixel so public void OverlayFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Overlay().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.Overlay_SrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -326,7 +326,7 @@ public void OverlayFunction_Blender_Bulk(TestPixel back, TestPix where TPixel : struct, IPixel { Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Overlay().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + new DefaultPixelBlenders.Overlay_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -346,7 +346,7 @@ public void OverlayFunction_Blender_Bulk(TestPixel back, TestPix public void HardLightFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.HardLight((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.HardLight_SrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -355,7 +355,7 @@ public void HardLightFunction(TestPixel back, TestPixel public void HardLightFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.HardLight().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.HardLight_SrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } @@ -365,7 +365,7 @@ public void HardLightFunction_Blender_Bulk(TestPixel back, TestP where TPixel : struct, IPixel { Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.HardLight().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + new DefaultPixelBlenders.HardLight_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } } diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.Blender.cs b/tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.Blender.cs index d3956ecd5d..1a4121c974 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.Blender.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.Blender.cs @@ -17,50 +17,50 @@ public class PixelBlenderTests public static TheoryData BlenderMappings = new TheoryData() { - { new TestPixel(), typeof(DefaultPixelBlenders.Normal), PixelBlenderMode.Normal }, - { new TestPixel(), typeof(DefaultPixelBlenders.Screen), PixelBlenderMode.Screen }, - { new TestPixel(), typeof(DefaultPixelBlenders.HardLight), PixelBlenderMode.HardLight }, - { new TestPixel(), typeof(DefaultPixelBlenders.Overlay), PixelBlenderMode.Overlay }, - { new TestPixel(), typeof(DefaultPixelBlenders.Darken), PixelBlenderMode.Darken }, - { new TestPixel(), typeof(DefaultPixelBlenders.Lighten), PixelBlenderMode.Lighten }, - { new TestPixel(), typeof(DefaultPixelBlenders.Add), PixelBlenderMode.Add }, - { new TestPixel(), typeof(DefaultPixelBlenders.Subtract), PixelBlenderMode.Subtract }, - { new TestPixel(), typeof(DefaultPixelBlenders.Multiply), PixelBlenderMode.Multiply }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcOver), PixelBlenderMode.Normal }, + { new TestPixel(), typeof(DefaultPixelBlenders.Screen_SrcOver), PixelBlenderMode.Screen }, + { new TestPixel(), typeof(DefaultPixelBlenders.HardLight_SrcOver), PixelBlenderMode.HardLight }, + { new TestPixel(), typeof(DefaultPixelBlenders.Overlay_SrcOver), PixelBlenderMode.Overlay }, + { new TestPixel(), typeof(DefaultPixelBlenders.Darken_SrcOver), PixelBlenderMode.Darken }, + { new TestPixel(), typeof(DefaultPixelBlenders.Lighten_SrcOver), PixelBlenderMode.Lighten }, + { new TestPixel(), typeof(DefaultPixelBlenders.Add_SrcOver), PixelBlenderMode.Add }, + { new TestPixel(), typeof(DefaultPixelBlenders.Subtract_SrcOver), PixelBlenderMode.Subtract }, + { new TestPixel(), typeof(DefaultPixelBlenders.Multiply_SrcOver), PixelBlenderMode.Multiply }, - { new TestPixel(), typeof(DefaultPixelBlenders.Src), PixelBlenderMode.Src }, - { new TestPixel(), typeof(DefaultPixelBlenders.Atop), PixelBlenderMode.Atop }, - { new TestPixel(), typeof(DefaultPixelBlenders.Over), PixelBlenderMode.Over }, - { new TestPixel(), typeof(DefaultPixelBlenders.In), PixelBlenderMode.In }, - { new TestPixel(), typeof(DefaultPixelBlenders.Out), PixelBlenderMode.Out }, - { new TestPixel(), typeof(DefaultPixelBlenders.Dest), PixelBlenderMode.Dest }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestAtop), PixelBlenderMode.DestAtop }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestOver), PixelBlenderMode.DestOver }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestIn), PixelBlenderMode.DestIn }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestOut), PixelBlenderMode.DestOut }, - { new TestPixel(), typeof(DefaultPixelBlenders.Clear), PixelBlenderMode.Clear }, - { new TestPixel(), typeof(DefaultPixelBlenders.Xor), PixelBlenderMode.Xor }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Src), PixelBlenderMode.Src }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcAtop), PixelBlenderMode.Atop }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcOver), PixelBlenderMode.Over }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcIn), PixelBlenderMode.In }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcOut), PixelBlenderMode.Out }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Dest), PixelBlenderMode.Dest }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestAtop), PixelBlenderMode.DestAtop }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestOver), PixelBlenderMode.DestOver }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestIn), PixelBlenderMode.DestIn }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestOut), PixelBlenderMode.DestOut }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Clear), PixelBlenderMode.Clear }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Xor), PixelBlenderMode.Xor }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal), PixelBlenderMode.Normal }, - { new TestPixel(), typeof(DefaultPixelBlenders.Screen), PixelBlenderMode.Screen }, - { new TestPixel(), typeof(DefaultPixelBlenders.HardLight), PixelBlenderMode.HardLight }, - { new TestPixel(), typeof(DefaultPixelBlenders.Overlay), PixelBlenderMode.Overlay }, - { new TestPixel(), typeof(DefaultPixelBlenders.Darken), PixelBlenderMode.Darken }, - { new TestPixel(), typeof(DefaultPixelBlenders.Lighten), PixelBlenderMode.Lighten }, - { new TestPixel(), typeof(DefaultPixelBlenders.Add), PixelBlenderMode.Add }, - { new TestPixel(), typeof(DefaultPixelBlenders.Subtract), PixelBlenderMode.Subtract }, - { new TestPixel(), typeof(DefaultPixelBlenders.Multiply), PixelBlenderMode.Multiply }, - { new TestPixel(), typeof(DefaultPixelBlenders.Src), PixelBlenderMode.Src }, - { new TestPixel(), typeof(DefaultPixelBlenders.Atop), PixelBlenderMode.Atop }, - { new TestPixel(), typeof(DefaultPixelBlenders.Over), PixelBlenderMode.Over }, - { new TestPixel(), typeof(DefaultPixelBlenders.In), PixelBlenderMode.In }, - { new TestPixel(), typeof(DefaultPixelBlenders.Out), PixelBlenderMode.Out }, - { new TestPixel(), typeof(DefaultPixelBlenders.Dest), PixelBlenderMode.Dest }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestAtop), PixelBlenderMode.DestAtop }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestOver), PixelBlenderMode.DestOver }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestIn), PixelBlenderMode.DestIn }, - { new TestPixel(), typeof(DefaultPixelBlenders.DestOut), PixelBlenderMode.DestOut }, - { new TestPixel(), typeof(DefaultPixelBlenders.Clear), PixelBlenderMode.Clear }, - { new TestPixel(), typeof(DefaultPixelBlenders.Xor), PixelBlenderMode.Xor }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcOver), PixelBlenderMode.Normal }, + { new TestPixel(), typeof(DefaultPixelBlenders.Screen_SrcOver), PixelBlenderMode.Screen }, + { new TestPixel(), typeof(DefaultPixelBlenders.HardLight_SrcOver), PixelBlenderMode.HardLight }, + { new TestPixel(), typeof(DefaultPixelBlenders.Overlay_SrcOver), PixelBlenderMode.Overlay }, + { new TestPixel(), typeof(DefaultPixelBlenders.Darken_SrcOver), PixelBlenderMode.Darken }, + { new TestPixel(), typeof(DefaultPixelBlenders.Lighten_SrcOver), PixelBlenderMode.Lighten }, + { new TestPixel(), typeof(DefaultPixelBlenders.Add_SrcOver), PixelBlenderMode.Add }, + { new TestPixel(), typeof(DefaultPixelBlenders.Subtract_SrcOver), PixelBlenderMode.Subtract }, + { new TestPixel(), typeof(DefaultPixelBlenders.Multiply_SrcOver), PixelBlenderMode.Multiply }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Src), PixelBlenderMode.Src }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcAtop), PixelBlenderMode.Atop }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcOver), PixelBlenderMode.Over }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcIn), PixelBlenderMode.In }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcOut), PixelBlenderMode.Out }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Dest), PixelBlenderMode.Dest }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestAtop), PixelBlenderMode.DestAtop }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestOver), PixelBlenderMode.DestOver }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestIn), PixelBlenderMode.DestIn }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestOut), PixelBlenderMode.DestOut }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Clear), PixelBlenderMode.Clear }, + { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Xor), PixelBlenderMode.Xor }, }; From a720778807551ee13c0e66e8d02da5cc6fa45f00 Mon Sep 17 00:00:00 2001 From: Vicente Penades Date: Wed, 27 Jun 2018 16:23:11 +0200 Subject: [PATCH 02/10] removed trailing spaces --- .../PixelBlenders/PorterDuffFunctions.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs index b5e89dbec8..0719b834c6 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs @@ -24,7 +24,7 @@ internal static partial class PorterDuffFunctions /// Source over backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Normal(Vector4 backdrop, Vector4 source) @@ -36,7 +36,7 @@ public static Vector4 Normal(Vector4 backdrop, Vector4 source) /// Source multiplied by backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Multiply(Vector4 backdrop, Vector4 source) @@ -48,7 +48,7 @@ public static Vector4 Multiply(Vector4 backdrop, Vector4 source) /// Source added to backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Add(Vector4 backdrop, Vector4 source) @@ -60,7 +60,7 @@ public static Vector4 Add(Vector4 backdrop, Vector4 source) /// Source subtracted from backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Subtract(Vector4 backdrop, Vector4 source) @@ -72,7 +72,7 @@ public static Vector4 Subtract(Vector4 backdrop, Vector4 source) /// Complement of source multiplied by the complement of backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Screen(Vector4 backdrop, Vector4 source) @@ -84,7 +84,7 @@ public static Vector4 Screen(Vector4 backdrop, Vector4 source) /// Per element, chooses the smallest value of source and backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Darken(Vector4 backdrop, Vector4 source) @@ -96,7 +96,7 @@ public static Vector4 Darken(Vector4 backdrop, Vector4 source) /// Per element, chooses the largest value of source and backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Lighten(Vector4 backdrop, Vector4 source) @@ -108,7 +108,7 @@ public static Vector4 Lighten(Vector4 backdrop, Vector4 source) /// Overlays source over backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Overlay(Vector4 backdrop, Vector4 source) @@ -124,7 +124,7 @@ public static Vector4 Overlay(Vector4 backdrop, Vector4 source) /// Hard light effect /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 HardLight(Vector4 backdrop, Vector4 source) From 4836450c22ea4e9500f3223d1b83e6a757fd9e79 Mon Sep 17 00:00:00 2001 From: Vicente Penades Date: Thu, 28 Jun 2018 17:59:10 +0200 Subject: [PATCH 03/10] exploring an alternative way of generating methods --- .../PorterDuffFunctions.Generated.cs | 3077 +++++++---------- .../PorterDuffFunctions.Generated.tt | 177 +- .../PixelBlenders/PorterDuffFunctions.cs | 157 +- 3 files changed, 1441 insertions(+), 1970 deletions(-) diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs index 25c22bd502..73e1c7f024 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs @@ -20,26 +20,18 @@ internal static partial class PorterDuffFunctions { - #region Compositors - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Src(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - // calculate final alpha - float fw = (sw * 1) + (bw * 0) + (xw * 1); - // calculate final value - xform = ((xform * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; - return xform; - } + + + + + + + #region Blenders [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 SrcAtop(Vector4 backdrop, Vector4 source, Vector4 xform) @@ -78,7 +70,7 @@ public static Vector4 SrcOver(Vector4 backdrop, Vector4 source, Vector4 xform) } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 SrcIn(Vector4 backdrop, Vector4 source, Vector4 xform) + public static Vector4 Dest(Vector4 backdrop, Vector4 source, Vector4 xform) { // calculate weights float xw = backdrop.W * source.W; @@ -86,17 +78,17 @@ public static Vector4 SrcIn(Vector4 backdrop, Vector4 source, Vector4 xform) float sw = source.W - xw; // calculate final alpha - float fw = (sw * 0) + (bw * 0) + (xw * 1); + float fw = (sw * 0) + (bw * 1) + (xw * 1); // calculate final value - xform = ((xform * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((backdrop * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; return xform; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 SrcOut(Vector4 backdrop, Vector4 source, Vector4 xform) + public static Vector4 DestOut(Vector4 backdrop, Vector4 source, Vector4 xform) { // calculate weights float xw = backdrop.W * source.W; @@ -104,17 +96,17 @@ public static Vector4 SrcOut(Vector4 backdrop, Vector4 source, Vector4 xform) float sw = source.W - xw; // calculate final alpha - float fw = (sw * 1) + (bw * 0) + (xw * 0); + float fw = (sw * 0) + (bw * 1) + (xw * 0); // calculate final value - xform = ((Vector4.Zero * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((Vector4.Zero * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; return xform; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Dest(Vector4 backdrop, Vector4 source, Vector4 xform) + public static Vector4 Xor(Vector4 backdrop, Vector4 source, Vector4 xform) { // calculate weights float xw = backdrop.W * source.W; @@ -122,2935 +114,2182 @@ public static Vector4 Dest(Vector4 backdrop, Vector4 source, Vector4 xform) float sw = source.W - xw; // calculate final alpha - float fw = (sw * 0) + (bw * 1) + (xw * 1); + float fw = (sw * 1) + (bw * 1) + (xw * 0); // calculate final value - xform = ((backdrop * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform = ((Vector4.Zero * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); xform.W = fw; return xform; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 DestAtop(Vector4 backdrop, Vector4 source, Vector4 xform) + public static Vector4 Normal_Src(Vector4 backdrop, Vector4 source, float opacity) { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float fw = (sw * 1) + (bw * 0) + (xw * 1); - - // calculate final value - xform = ((backdrop * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - return xform; + return Src(backdrop, source, Normal(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 DestOver(Vector4 backdrop, Vector4 source, Vector4 xform) + public static Vector4 Normal_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float fw = (sw * 1) + (bw * 1) + (xw * 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - // calculate final value - xform = ((backdrop * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; - - return xform; + return SrcAtop(backdrop, source, Normal(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 DestIn(Vector4 backdrop, Vector4 source, Vector4 xform) + public static Vector4 Normal_SrcOver(Vector4 backdrop, Vector4 source, float opacity) { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - // calculate final alpha - float fw = (sw * 0) + (bw * 0) + (xw * 1); + return SrcOver(backdrop, source, Normal(backdrop, source)); + } - // calculate final value - xform = ((backdrop * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - return xform; + return SrcIn(backdrop, source, Normal(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 DestOut(Vector4 backdrop, Vector4 source, Vector4 xform) + public static Vector4 Normal_SrcOut(Vector4 backdrop, Vector4 source, float opacity) { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - // calculate final alpha - float fw = (sw * 0) + (bw * 1) + (xw * 0); + return SrcOut(backdrop, source, Normal(backdrop, source)); + } - // calculate final value - xform = ((Vector4.Zero * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - return xform; + return Dest(backdrop, source, Normal(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Clear(Vector4 backdrop, Vector4 source, Vector4 xform) + public static Vector4 Normal_DestAtop(Vector4 backdrop, Vector4 source, float opacity) { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - // calculate final alpha - float fw = (sw * 0) + (bw * 0) + (xw * 0); + return DestAtop(backdrop, source, Normal(backdrop, source)); + } - // calculate final value - xform = ((Vector4.Zero * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - return xform; + return DestOver(backdrop, source, Normal(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Xor(Vector4 backdrop, Vector4 source, Vector4 xform) + public static Vector4 Normal_DestIn(Vector4 backdrop, Vector4 source, float opacity) { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - // calculate final alpha - float fw = (sw * 1) + (bw * 1) + (xw * 0); + return DestIn(backdrop, source, Normal(backdrop, source)); + } - // calculate final value - xform = ((Vector4.Zero * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - return xform; + return DestOut(backdrop, source, Normal(backdrop, source)); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Clear(backdrop, source, source); + } - #endregion - - #region Blenders + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Xor(backdrop, source, source); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_Src(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Normal_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop,source, Normal(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Normal_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel Normal_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Src(backdropV,sourceV, Normal(backdropV, sourceV))); + dest.PackFromVector4(Normal_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_Src(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Normal_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop,source, Multiply(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Normal_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel Normal_SrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Src(backdropV,sourceV, Multiply(backdropV, sourceV))); + dest.PackFromVector4(Normal_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_Src(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Normal_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop,source, Add(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Normal_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel Normal_Dest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Src(backdropV,sourceV, Add(backdropV, sourceV))); + dest.PackFromVector4(Normal_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_Src(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Normal_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop,source, Subtract(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Normal_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel Normal_DestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Src(backdropV,sourceV, Subtract(backdropV, sourceV))); + dest.PackFromVector4(Normal_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_Src(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Normal_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop,source, Screen(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Normal_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel Normal_DestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Src(backdropV,sourceV, Screen(backdropV, sourceV))); + dest.PackFromVector4(Normal_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_Src(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Normal_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop,source, Darken(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Normal_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel Normal_Xor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Src(backdropV,sourceV, Darken(backdropV, sourceV))); + dest.PackFromVector4(Normal_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Multiply_Src(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop,source, Lighten(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop, source, Multiply(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_Src(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Multiply_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(Src(backdropV,sourceV, Lighten(backdropV, sourceV))); - return dest; - } + return SrcAtop(backdrop, source, Multiply(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return SrcOver(backdrop, source, Multiply(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Multiply_SrcIn(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop,source, Overlay(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop, source, Multiply(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_Src(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Multiply_SrcOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(Src(backdropV,sourceV, Overlay(backdropV, sourceV))); - return dest; - } + return SrcOut(backdrop, source, Multiply(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Dest(backdrop, source, Multiply(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Multiply_DestAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop,source, HardLight(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop, source, Multiply(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_Src(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Multiply_DestOver(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Src(backdropV,sourceV, HardLight(backdropV, sourceV))); - return dest; - } + return DestOver(backdrop, source, Multiply(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestIn(backdrop, source, Multiply(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Multiply_DestOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop,source, Normal(backdrop, source)); - } + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestOut(backdrop, source, Multiply(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_SrcAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Multiply_Clear(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + return Clear(backdrop, source, source); + } - TPixel dest = default; - dest.PackFromVector4(SrcAtop(backdropV,sourceV, Normal(backdropV, sourceV))); - return dest; - } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Xor(backdrop, source, source); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Multiply_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop,source, Multiply(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Multiply_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TPixel Multiply_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcAtop(backdropV,sourceV, Multiply(backdropV, sourceV))); + dest.PackFromVector4(Multiply_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Multiply_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop,source, Add(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Multiply_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel Multiply_SrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcAtop(backdropV,sourceV, Add(backdropV, sourceV))); + dest.PackFromVector4(Multiply_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Multiply_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop,source, Subtract(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Multiply_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel Multiply_Dest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcAtop(backdropV,sourceV, Subtract(backdropV, sourceV))); + dest.PackFromVector4(Multiply_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Multiply_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop,source, Screen(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Multiply_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel Multiply_DestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcAtop(backdropV,sourceV, Screen(backdropV, sourceV))); + dest.PackFromVector4(Multiply_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Multiply_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop,source, Darken(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Multiply_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel Multiply_DestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcAtop(backdropV,sourceV, Darken(backdropV, sourceV))); + dest.PackFromVector4(Multiply_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Multiply_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop,source, Lighten(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Multiply_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel Multiply_Xor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcAtop(backdropV,sourceV, Lighten(backdropV, sourceV))); + dest.PackFromVector4(Multiply_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Add_Src(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop,source, Overlay(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop, source, Add(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_SrcAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Add_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(SrcAtop(backdropV,sourceV, Overlay(backdropV, sourceV))); - return dest; - } + return SrcAtop(backdrop, source, Add(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return SrcOver(backdrop, source, Add(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Add_SrcIn(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop,source, HardLight(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop, source, Add(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_SrcAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Add_SrcOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(SrcAtop(backdropV,sourceV, HardLight(backdropV, sourceV))); - return dest; - } + return SrcOut(backdrop, source, Add(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Dest(backdrop, source, Add(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Add_DestAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop,source, Normal(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop, source, Add(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_SrcOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Add_DestOver(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcOver(backdropV,sourceV, Normal(backdropV, sourceV))); - return dest; - } + return DestOver(backdrop, source, Add(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestIn(backdrop, source, Add(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Add_DestOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop,source, Multiply(backdrop, source)); - } + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestOut(backdrop, source, Add(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_SrcOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Add_Clear(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + return Clear(backdrop, source, source); + } - TPixel dest = default; - dest.PackFromVector4(SrcOver(backdropV,sourceV, Multiply(backdropV, sourceV))); - return dest; - } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Xor(backdrop, source, source); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Add_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop,source, Add(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Add_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Add_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcOver(backdropV,sourceV, Add(backdropV, sourceV))); + dest.PackFromVector4(Add_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Add_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop,source, Subtract(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Add_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Add_SrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcOver(backdropV,sourceV, Subtract(backdropV, sourceV))); + dest.PackFromVector4(Add_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Add_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop,source, Screen(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Add_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Add_Dest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcOver(backdropV,sourceV, Screen(backdropV, sourceV))); + dest.PackFromVector4(Add_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Add_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop,source, Darken(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Add_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Add_DestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcOver(backdropV,sourceV, Darken(backdropV, sourceV))); + dest.PackFromVector4(Add_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Add_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop,source, Lighten(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Add_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Add_DestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcOver(backdropV,sourceV, Lighten(backdropV, sourceV))); + dest.PackFromVector4(Add_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Add_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop,source, Overlay(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Add_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Add_Xor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcOver(backdropV,sourceV, Overlay(backdropV, sourceV))); + dest.PackFromVector4(Add_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Subtract_Src(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop,source, HardLight(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop, source, Subtract(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_SrcOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Subtract_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(SrcOver(backdropV,sourceV, HardLight(backdropV, sourceV))); - return dest; - } + return SrcAtop(backdrop, source, Subtract(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return SrcOver(backdrop, source, Subtract(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Subtract_SrcIn(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop,source, Normal(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop, source, Subtract(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_SrcIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Subtract_SrcOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(SrcIn(backdropV,sourceV, Normal(backdropV, sourceV))); - return dest; - } + return SrcOut(backdrop, source, Subtract(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Dest(backdrop, source, Subtract(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Subtract_DestAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop,source, Multiply(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop, source, Subtract(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_SrcIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Subtract_DestOver(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcIn(backdropV,sourceV, Multiply(backdropV, sourceV))); - return dest; - } + return DestOver(backdrop, source, Subtract(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestIn(backdrop, source, Subtract(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Subtract_DestOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop,source, Add(backdrop, source)); - } + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestOut(backdrop, source, Subtract(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_SrcIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Subtract_Clear(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + return Clear(backdrop, source, source); + } - TPixel dest = default; - dest.PackFromVector4(SrcIn(backdropV,sourceV, Add(backdropV, sourceV))); - return dest; - } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Xor(backdrop, source, source); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Subtract_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop,source, Subtract(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Subtract_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel Subtract_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcIn(backdropV,sourceV, Subtract(backdropV, sourceV))); + dest.PackFromVector4(Subtract_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Subtract_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop,source, Screen(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Subtract_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel Subtract_SrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcIn(backdropV,sourceV, Screen(backdropV, sourceV))); + dest.PackFromVector4(Subtract_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Subtract_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop,source, Darken(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Subtract_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel Subtract_Dest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcIn(backdropV,sourceV, Darken(backdropV, sourceV))); + dest.PackFromVector4(Subtract_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Subtract_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop,source, Lighten(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Subtract_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel Subtract_DestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcIn(backdropV,sourceV, Lighten(backdropV, sourceV))); + dest.PackFromVector4(Subtract_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Subtract_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop,source, Overlay(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Subtract_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel Subtract_DestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcIn(backdropV,sourceV, Overlay(backdropV, sourceV))); + dest.PackFromVector4(Subtract_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Subtract_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop,source, HardLight(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Subtract_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel Subtract_Xor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcIn(backdropV,sourceV, HardLight(backdropV, sourceV))); + dest.PackFromVector4(Subtract_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Screen_Src(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop,source, Normal(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop, source, Screen(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_SrcOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Screen_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(SrcOut(backdropV,sourceV, Normal(backdropV, sourceV))); - return dest; - } + return SrcAtop(backdrop, source, Screen(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return SrcOver(backdrop, source, Screen(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Screen_SrcIn(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop,source, Multiply(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop, source, Screen(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_SrcOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Screen_SrcOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(SrcOut(backdropV,sourceV, Multiply(backdropV, sourceV))); - return dest; - } + return SrcOut(backdrop, source, Screen(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Dest(backdrop, source, Screen(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Screen_DestAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop,source, Add(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop, source, Screen(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_SrcOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Screen_DestOver(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcOut(backdropV,sourceV, Add(backdropV, sourceV))); - return dest; - } + return DestOver(backdrop, source, Screen(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestIn(backdrop, source, Screen(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Screen_DestOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop,source, Subtract(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOut(backdrop, source, Screen(backdrop, source)); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop, source, source); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_SrcOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Screen_Xor(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + return Xor(backdrop, source, source); + } - TPixel dest = default; - dest.PackFromVector4(SrcOut(backdropV,sourceV, Subtract(backdropV, sourceV))); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop,source, Screen(backdrop, source)); - } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel Screen_Src(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcOut(backdropV,sourceV, Screen(backdropV, sourceV))); + dest.PackFromVector4(Screen_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop,source, Darken(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel Screen_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcOut(backdropV,sourceV, Darken(backdropV, sourceV))); + dest.PackFromVector4(Screen_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop,source, Lighten(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel Screen_SrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcOut(backdropV,sourceV, Lighten(backdropV, sourceV))); + dest.PackFromVector4(Screen_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop,source, Overlay(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel Screen_SrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcOut(backdropV,sourceV, Overlay(backdropV, sourceV))); + dest.PackFromVector4(Screen_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop,source, HardLight(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel Screen_SrcOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(SrcOut(backdropV,sourceV, HardLight(backdropV, sourceV))); + dest.PackFromVector4(Screen_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop,source, Normal(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel Screen_Dest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Dest(backdropV,sourceV, Normal(backdropV, sourceV))); + dest.PackFromVector4(Screen_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop,source, Multiply(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel Screen_DestAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Dest(backdropV,sourceV, Multiply(backdropV, sourceV))); + dest.PackFromVector4(Screen_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop,source, Add(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel Screen_DestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Dest(backdropV,sourceV, Add(backdropV, sourceV))); + dest.PackFromVector4(Screen_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop,source, Subtract(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel Screen_DestIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Dest(backdropV,sourceV, Subtract(backdropV, sourceV))); + dest.PackFromVector4(Screen_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop,source, Screen(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel Screen_DestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Dest(backdropV,sourceV, Screen(backdropV, sourceV))); + dest.PackFromVector4(Screen_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop,source, Darken(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel Screen_Clear(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Dest(backdropV,sourceV, Darken(backdropV, sourceV))); + dest.PackFromVector4(Screen_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop,source, Lighten(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel Screen_Xor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Dest(backdropV,sourceV, Lighten(backdropV, sourceV))); + dest.PackFromVector4(Screen_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_Dest(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Darken_Src(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop,source, Overlay(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop, source, Darken(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_Dest(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Darken_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Dest(backdropV,sourceV, Overlay(backdropV, sourceV))); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop,source, HardLight(backdrop, source)); + return SrcAtop(backdrop, source, Darken(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_Dest(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Darken_SrcOver(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(Dest(backdropV,sourceV, HardLight(backdropV, sourceV))); - return dest; - } - + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop,source, Normal(backdrop, source)); + return SrcOver(backdrop, source, Darken(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Darken_SrcIn(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestAtop(backdropV,sourceV, Normal(backdropV, sourceV))); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop,source, Multiply(backdrop, source)); + return SrcIn(backdrop, source, Darken(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Darken_SrcOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(DestAtop(backdropV,sourceV, Multiply(backdropV, sourceV))); - return dest; - } + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop,source, Add(backdrop, source)); + return SrcOut(backdrop, source, Darken(backdrop, source)); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_Dest(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(DestAtop(backdropV,sourceV, Add(backdropV, sourceV))); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop,source, Subtract(backdrop, source)); + return Dest(backdrop, source, Darken(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Darken_DestAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(DestAtop(backdropV,sourceV, Subtract(backdropV, sourceV))); - return dest; - } + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop,source, Screen(backdrop, source)); + return DestAtop(backdrop, source, Darken(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Darken_DestOver(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(DestAtop(backdropV,sourceV, Screen(backdropV, sourceV))); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop,source, Darken(backdrop, source)); + return DestOver(backdrop, source, Darken(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Darken_DestIn(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(DestAtop(backdropV,sourceV, Darken(backdropV, sourceV))); - return dest; - } - + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestIn(backdrop, source, Darken(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Darken_DestOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop,source, Lighten(backdrop, source)); - } + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestOut(backdrop, source, Darken(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Darken_Clear(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(DestAtop(backdropV,sourceV, Lighten(backdropV, sourceV))); - return dest; - } - + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Clear(backdrop, source, source); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Darken_Xor(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop,source, Overlay(backdrop, source)); - } + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop, source, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_DestAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel Darken_Src(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestAtop(backdropV,sourceV, Overlay(backdropV, sourceV))); + dest.PackFromVector4(Darken_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop,source, HardLight(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_DestAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel Darken_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestAtop(backdropV,sourceV, HardLight(backdropV, sourceV))); + dest.PackFromVector4(Darken_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop,source, Normal(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Darken_SrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOver(backdropV,sourceV, Normal(backdropV, sourceV))); + dest.PackFromVector4(Darken_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop,source, Multiply(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Darken_SrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOver(backdropV,sourceV, Multiply(backdropV, sourceV))); + dest.PackFromVector4(Darken_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop,source, Add(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Darken_SrcOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOver(backdropV,sourceV, Add(backdropV, sourceV))); + dest.PackFromVector4(Darken_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop,source, Subtract(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Darken_Dest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOver(backdropV,sourceV, Subtract(backdropV, sourceV))); + dest.PackFromVector4(Darken_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop,source, Screen(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Darken_DestAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOver(backdropV,sourceV, Screen(backdropV, sourceV))); + dest.PackFromVector4(Darken_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop,source, Darken(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TPixel Darken_DestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOver(backdropV,sourceV, Darken(backdropV, sourceV))); + dest.PackFromVector4(Darken_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop,source, Lighten(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Darken_DestIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOver(backdropV,sourceV, Lighten(backdropV, sourceV))); + dest.PackFromVector4(Darken_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop,source, Overlay(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Darken_DestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOver(backdropV,sourceV, Overlay(backdropV, sourceV))); + dest.PackFromVector4(Darken_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop,source, HardLight(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel Darken_Clear(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOver(backdropV,sourceV, HardLight(backdropV, sourceV))); + dest.PackFromVector4(Darken_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop,source, Normal(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_DestIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel Darken_Xor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestIn(backdropV,sourceV, Normal(backdropV, sourceV))); + dest.PackFromVector4(Darken_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Lighten_Src(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop,source, Multiply(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop, source, Lighten(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Lighten_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestIn(backdropV,sourceV, Multiply(backdropV, sourceV))); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop,source, Add(backdrop, source)); + return SrcAtop(backdrop, source, Lighten(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Lighten_SrcOver(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(DestIn(backdropV,sourceV, Add(backdropV, sourceV))); - return dest; - } - + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop,source, Subtract(backdrop, source)); + return SrcOver(backdrop, source, Lighten(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Lighten_SrcIn(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestIn(backdropV,sourceV, Subtract(backdropV, sourceV))); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop,source, Screen(backdrop, source)); + return SrcIn(backdrop, source, Lighten(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Lighten_SrcOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(DestIn(backdropV,sourceV, Screen(backdropV, sourceV))); - return dest; - } - + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop,source, Darken(backdrop, source)); + return SrcOut(backdrop, source, Lighten(backdrop, source)); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_Dest(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(DestIn(backdropV,sourceV, Darken(backdropV, sourceV))); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop,source, Lighten(backdrop, source)); + return Dest(backdrop, source, Lighten(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Lighten_DestAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(DestIn(backdropV,sourceV, Lighten(backdropV, sourceV))); - return dest; - } - + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestAtop(backdrop, source, Lighten(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Lighten_DestOver(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop,source, Overlay(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOver(backdrop, source, Lighten(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Lighten_DestIn(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(DestIn(backdropV,sourceV, Overlay(backdropV, sourceV))); - return dest; - } - + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestIn(backdrop, source, Lighten(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Lighten_DestOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop,source, HardLight(backdrop, source)); - } + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestOut(backdrop, source, Lighten(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Lighten_Clear(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(DestIn(backdropV,sourceV, HardLight(backdropV, sourceV))); - return dest; - } - + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Clear(backdrop, source, source); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Lighten_Xor(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop,source, Normal(backdrop, source)); - } + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop, source, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel Lighten_Src(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOut(backdropV,sourceV, Normal(backdropV, sourceV))); + dest.PackFromVector4(Lighten_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_DestOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop,source, Multiply(backdrop, source)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel Lighten_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOut(backdropV,sourceV, Multiply(backdropV, sourceV))); + dest.PackFromVector4(Lighten_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Lighten_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop,source, Add(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Lighten_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel Lighten_SrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOut(backdropV,sourceV, Add(backdropV, sourceV))); + dest.PackFromVector4(Lighten_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Lighten_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop,source, Subtract(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Lighten_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel Lighten_Dest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOut(backdropV,sourceV, Subtract(backdropV, sourceV))); + dest.PackFromVector4(Lighten_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Lighten_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop,source, Screen(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Lighten_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel Lighten_DestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOut(backdropV,sourceV, Screen(backdropV, sourceV))); + dest.PackFromVector4(Lighten_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Lighten_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop,source, Darken(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Lighten_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel Lighten_DestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOut(backdropV,sourceV, Darken(backdropV, sourceV))); + dest.PackFromVector4(Lighten_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Lighten_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop,source, Lighten(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Lighten_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel Lighten_Xor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOut(backdropV,sourceV, Lighten(backdropV, sourceV))); + dest.PackFromVector4(Lighten_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Overlay_Src(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop,source, Overlay(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop, source, Overlay(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_DestOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Overlay_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOut(backdropV,sourceV, Overlay(backdropV, sourceV))); - return dest; - } + return SrcAtop(backdrop, source, Overlay(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return SrcOver(backdrop, source, Overlay(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Overlay_SrcIn(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop,source, HardLight(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop, source, Overlay(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_DestOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Overlay_SrcOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(DestOut(backdropV,sourceV, HardLight(backdropV, sourceV))); - return dest; - } + return SrcOut(backdrop, source, Overlay(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Dest(backdrop, source, Overlay(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Overlay_DestAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop,source, Normal(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop, source, Overlay(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_Clear(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Overlay_DestOver(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(Clear(backdropV,sourceV, Normal(backdropV, sourceV))); - return dest; - } + return DestOver(backdrop, source, Overlay(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestIn(backdrop, source, Overlay(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 Overlay_DestOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop,source, Multiply(backdrop, source)); - } + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestOut(backdrop, source, Overlay(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_Clear(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 Overlay_Clear(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + return Clear(backdrop, source, source); + } - TPixel dest = default; - dest.PackFromVector4(Clear(backdropV,sourceV, Multiply(backdropV, sourceV))); - return dest; - } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Xor(backdrop, source, source); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Overlay_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop,source, Add(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Overlay_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel Overlay_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Clear(backdropV,sourceV, Add(backdropV, sourceV))); + dest.PackFromVector4(Overlay_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Overlay_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop,source, Subtract(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Overlay_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel Overlay_SrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Clear(backdropV,sourceV, Subtract(backdropV, sourceV))); + dest.PackFromVector4(Overlay_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Overlay_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop,source, Screen(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Overlay_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel Overlay_Dest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Clear(backdropV,sourceV, Screen(backdropV, sourceV))); + dest.PackFromVector4(Overlay_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Overlay_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop,source, Darken(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Overlay_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel Overlay_DestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Clear(backdropV,sourceV, Darken(backdropV, sourceV))); + dest.PackFromVector4(Overlay_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Overlay_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop,source, Lighten(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Overlay_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel Overlay_DestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Clear(backdropV,sourceV, Lighten(backdropV, sourceV))); + dest.PackFromVector4(Overlay_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel Overlay_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop,source, Overlay(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(Overlay_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel Overlay_Xor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Clear(backdropV,sourceV, Overlay(backdropV, sourceV))); + dest.PackFromVector4(Overlay_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLight_Src(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop,source, HardLight(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop, source, HardLight(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_Clear(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 HardLight_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Clear(backdropV,sourceV, HardLight(backdropV, sourceV))); - return dest; - } + return SrcAtop(backdrop, source, HardLight(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return SrcOver(backdrop, source, HardLight(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLight_SrcIn(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop,source, Normal(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop, source, HardLight(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_Xor(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 HardLight_SrcOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Xor(backdropV,sourceV, Normal(backdropV, sourceV))); - return dest; - } + return SrcOut(backdrop, source, HardLight(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Dest(backdrop, source, HardLight(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLight_DestAtop(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop,source, Multiply(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop, source, HardLight(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_Xor(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 HardLight_DestOver(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - - TPixel dest = default; - dest.PackFromVector4(Xor(backdropV,sourceV, Multiply(backdropV, sourceV))); - return dest; - } + return DestOver(backdrop, source, HardLight(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestIn(backdrop, source, HardLight(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLight_DestOut(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop,source, Add(backdrop, source)); - } + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return DestOut(backdrop, source, HardLight(backdrop, source)); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_Xor(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 HardLight_Clear(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + return Clear(backdrop, source, source); + } - TPixel dest = default; - dest.PackFromVector4(Xor(backdropV,sourceV, Add(backdropV, sourceV))); - return dest; - } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + return Xor(backdrop, source, source); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel HardLight_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop,source, Subtract(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(HardLight_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLight_SrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Xor(backdropV,sourceV, Subtract(backdropV, sourceV))); + dest.PackFromVector4(HardLight_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel HardLight_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop,source, Screen(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(HardLight_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLight_SrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Xor(backdropV,sourceV, Screen(backdropV, sourceV))); + dest.PackFromVector4(HardLight_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel HardLight_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop,source, Darken(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(HardLight_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLight_Dest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Xor(backdropV,sourceV, Darken(backdropV, sourceV))); + dest.PackFromVector4(HardLight_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel HardLight_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop,source, Lighten(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(HardLight_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLight_DestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Xor(backdropV,sourceV, Lighten(backdropV, sourceV))); + dest.PackFromVector4(HardLight_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel HardLight_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop,source, Overlay(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(HardLight_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLight_DestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Xor(backdropV,sourceV, Overlay(backdropV, sourceV))); + dest.PackFromVector4(HardLight_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } - + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static TPixel HardLight_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop,source, HardLight(backdrop, source)); + TPixel dest = default; + dest.PackFromVector4(HardLight_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TPixel HardLight_Xor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { - opacity = opacity.Clamp(0, 1); - - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; - TPixel dest = default; - dest.PackFromVector4(Xor(backdropV,sourceV, HardLight(backdropV, sourceV))); + dest.PackFromVector4(HardLight_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } + } diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt index 25f1e76487..64608fcfac 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt @@ -21,6 +21,8 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders { internal static partial class PorterDuffFunctions { + + <# void GenerateVectorCompositor(string name, string sourceVar, string destVar, string blendVar) { int a_s = sourceVar == "Vector4.Zero" ? 0 : 1; @@ -45,55 +47,152 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders return xform; } <# } #> -<# void GeneratePixelBlender(string blender, string compositor) { #> + + + + + +<# void GeneratePixelBlenders(string blender) { #> [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_<#=compositor#>(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=blender#>_Src(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return <#=compositor#>(backdrop,source, <#=blender#>(backdrop, source)); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Src(backdrop, source, <#=blender#>(backdrop, source)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel <#=blender#>_<#=compositor#>(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel + public static Vector4 <#=blender#>_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcAtop(backdrop, source, <#=blender#>(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOver(backdrop, source, <#=blender#>(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcIn(backdrop, source, <#=blender#>(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return SrcOut(backdrop, source, <#=blender#>(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Dest(backdrop, source, <#=blender#>(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestAtop(backdrop, source, <#=blender#>(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_DestOver(Vector4 backdrop, Vector4 source, float opacity) { - opacity = opacity.Clamp(0, 1); + opacity = opacity.Clamp(0, 1); + source.W *= opacity; - Vector4 backdropV = backdrop.ToVector4(); - Vector4 sourceV = source.ToVector4(); - sourceV.W *= opacity; + return DestOver(backdrop, source, <#=blender#>(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestIn(backdrop, source, <#=blender#>(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return DestOut(backdrop, source, <#=blender#>(backdrop, source)); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop, source, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop, source, source); + } + +<# } #> + + +<# void GenerateGenericPixelBlender(string blender, string composer) { #> + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel <#=blender#>_<#=composer#>(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { TPixel dest = default; - dest.PackFromVector4(<#=compositor#>(backdropV,sourceV, <#=blender#>(backdropV, sourceV))); + dest.PackFromVector4(<#=blender#>_<#=composer#>(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; - } + } <# } #> - #region Compositors + #region Blenders <# -GenerateVectorCompositor("Src", "source", "Vector4.Zero", "xform"); -GenerateVectorCompositor("SrcAtop", "Vector4.Zero", "backdrop", "xform"); -GenerateVectorCompositor("SrcOver", "source", "backdrop", "xform"); -GenerateVectorCompositor("SrcIn", "Vector4.Zero", "Vector4.Zero", "xform"); -GenerateVectorCompositor("SrcOut", "source", "Vector4.Zero", "Vector4.Zero"); -GenerateVectorCompositor("Dest", "Vector4.Zero", "backdrop", "backdrop"); -GenerateVectorCompositor("DestAtop", "source", "Vector4.Zero", "backdrop"); -GenerateVectorCompositor("DestOver", "source", "backdrop", "backdrop"); -GenerateVectorCompositor("DestIn", "Vector4.Zero", "Vector4.Zero", "backdrop"); -GenerateVectorCompositor("DestOut", "Vector4.Zero", "backdrop", "Vector4.Zero"); -GenerateVectorCompositor("Clear", "Vector4.Zero", "Vector4.Zero", "Vector4.Zero"); -GenerateVectorCompositor("Xor", "source", "backdrop", "Vector4.Zero"); -#> - #endregion +// GenerateVectorCompositor("Src", "source", "Vector4.Zero", "xform"); +GenerateVectorCompositor("SrcAtop", "Vector4.Zero", "backdrop", "xform"); +GenerateVectorCompositor("SrcOver", "source", "backdrop", "xform"); +// GenerateVectorCompositor("SrcIn", "Vector4.Zero", "Vector4.Zero", "xform"); +// GenerateVectorCompositor("SrcOut", "source", "Vector4.Zero", "Vector4.Zero"); +GenerateVectorCompositor("Dest", "Vector4.Zero", "backdrop", "backdrop"); +// GenerateVectorCompositor("DestAtop", "source", "Vector4.Zero", "backdrop"); +// GenerateVectorCompositor("DestOver", "source", "backdrop", "backdrop"); +// GenerateVectorCompositor("DestIn", "Vector4.Zero", "Vector4.Zero", "backdrop"); +GenerateVectorCompositor("DestOut", "Vector4.Zero", "backdrop", "Vector4.Zero"); +// GenerateVectorCompositor("Clear", "Vector4.Zero", "Vector4.Zero", "Vector4.Zero"); +GenerateVectorCompositor("Xor", "source", "backdrop", "Vector4.Zero"); - #region Blenders - -<# string[] composers = new []{ "Src" , "SrcAtop" , @@ -121,14 +220,16 @@ string[] blenders = new []{ "HardLight" }; -foreach(var composer in composers) -{ foreach(var blender in blenders) - { - GeneratePixelBlender(blender,composer); - + { + GeneratePixelBlenders(blender); + + foreach(var composer in composers) + { + GenerateGenericPixelBlender(blender,composer); + } } -} + #> #endregion diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs index 0719b834c6..5738238568 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs @@ -20,11 +20,13 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders /// internal static partial class PorterDuffFunctions { + #region color blenders + /// /// Source over backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Normal(Vector4 backdrop, Vector4 source) @@ -36,7 +38,7 @@ public static Vector4 Normal(Vector4 backdrop, Vector4 source) /// Source multiplied by backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Multiply(Vector4 backdrop, Vector4 source) @@ -48,7 +50,7 @@ public static Vector4 Multiply(Vector4 backdrop, Vector4 source) /// Source added to backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Add(Vector4 backdrop, Vector4 source) @@ -60,7 +62,7 @@ public static Vector4 Add(Vector4 backdrop, Vector4 source) /// Source subtracted from backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Subtract(Vector4 backdrop, Vector4 source) @@ -72,7 +74,7 @@ public static Vector4 Subtract(Vector4 backdrop, Vector4 source) /// Complement of source multiplied by the complement of backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Screen(Vector4 backdrop, Vector4 source) @@ -84,7 +86,7 @@ public static Vector4 Screen(Vector4 backdrop, Vector4 source) /// Per element, chooses the smallest value of source and backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Darken(Vector4 backdrop, Vector4 source) @@ -96,7 +98,7 @@ public static Vector4 Darken(Vector4 backdrop, Vector4 source) /// Per element, chooses the largest value of source and backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Lighten(Vector4 backdrop, Vector4 source) @@ -108,7 +110,7 @@ public static Vector4 Lighten(Vector4 backdrop, Vector4 source) /// Overlays source over backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Overlay(Vector4 backdrop, Vector4 source) @@ -124,7 +126,7 @@ public static Vector4 Overlay(Vector4 backdrop, Vector4 source) /// Hard light effect /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 HardLight(Vector4 backdrop, Vector4 source) @@ -148,6 +150,10 @@ private static float OverlayValueFunction(float backdrop, float source) return backdrop <= 0.5f ? (2 * backdrop * source) : 1 - ((2 * (1 - source)) * (1 - backdrop)); } + #endregion + + #region alpha composers + /// /// General composition function for all modes, with a general solution for alpha channel /// @@ -155,11 +161,8 @@ private static float OverlayValueFunction(float backdrop, float source) /// Original source color /// Desired transformed color, without taking Alpha channel in account /// The final color - /// - /// This is the default compositor for "normal" alpha blending, which matches the generated SrcOver compositor. - /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Vector4 Compose(Vector4 backdrop, Vector4 source, Vector4 xform) + private static Vector4 SrcOver_Reference(Vector4 backdrop, Vector4 source, Vector4 xform) { // calculate weights float xw = backdrop.W * source.W; @@ -175,5 +178,133 @@ private static Vector4 Compose(Vector4 backdrop, Vector4 source, Vector4 xform) return xform; } + + + + + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Src(Vector4 backdrop, Vector4 source, Vector4 xform) + { + // calculate weights + float xw = backdrop.W * source.W; + float bw = backdrop.W - xw; + float sw = source.W - xw; + + // calculate final alpha + float fw = (sw * 1) + (bw * 0) + (xw * 1); + + // calculate final value + xform = ((xform * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; + + return Vector4.Lerp(backdrop, xform, source.W); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 SrcIn(Vector4 backdrop, Vector4 source, Vector4 xform) + { + // calculate weights + float xw = backdrop.W * source.W; + + // calculate final value + xform.W = xw; + + return Vector4.Lerp(backdrop, xform, source.W); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 SrcOut(Vector4 backdrop, Vector4 source, Vector4 xform) + { + // calculate weights + float xw = backdrop.W * source.W; + float bw = backdrop.W - xw; + float sw = source.W - xw; + + // calculate final alpha + float fw = sw; + + // calculate final value + xform = source; + xform.W = fw; + + return Vector4.Lerp(backdrop, xform, source.W); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 DestAtop(Vector4 backdrop, Vector4 source, Vector4 xform) + { + // calculate weights + float xw = backdrop.W * source.W; + float bw = backdrop.W - xw; + float sw = source.W - xw; + + // calculate final alpha + float fw = (sw * 1) + (bw * 0) + (xw * 1); + + // calculate final value + xform = ((backdrop * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; + + return Vector4.Lerp(backdrop, xform, source.W); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 DestOver(Vector4 backdrop, Vector4 source, Vector4 xform) + { + // calculate weights + float xw = backdrop.W * source.W; + float bw = backdrop.W - xw; + float sw = source.W - xw; + + // calculate final alpha + float fw = (sw * 1) + (bw * 1) + (xw * 1); + + // calculate final value + xform = ((backdrop * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; + + return Vector4.Lerp(backdrop, xform, source.W); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 DestIn(Vector4 backdrop, Vector4 source, Vector4 xform) + { + // calculate weights + float xw = backdrop.W * source.W; + float bw = backdrop.W - xw; + float sw = source.W - xw; + + // calculate final alpha + float fw = (sw * 0) + (bw * 0) + (xw * 1); + + // calculate final value + xform = ((backdrop * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); + xform.W = fw; + + return Vector4.Lerp(backdrop, xform, source.W); + } + + /// + /// General composition function for all modes, with a general solution for alpha channel + /// + /// Original Backdrop color + /// Original source color + /// Desired transformed color, without taking Alpha channel in account + /// The final color + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static Vector4 Clear(Vector4 backdrop, Vector4 source, Vector4 xform) + { + return Vector4.Lerp(backdrop, Vector4.Zero, xform.W); + } + + #endregion + + + + + } } \ No newline at end of file From 4bb5f9f45e3074d117b37da641909b2ee5efe498 Mon Sep 17 00:00:00 2001 From: Vicente Penades Date: Mon, 2 Jul 2018 16:10:51 +0200 Subject: [PATCH 04/10] progress on pixel conposer/blender combinations --- .../PorterDuffFunctions.Generated.cs | 4451 ++++++++--------- .../PorterDuffFunctions.Generated.tt | 426 +- .../PixelBlenders/PorterDuffFunctions.cs | 159 +- .../Drawing/SolidFillBlendedShapesTests.cs | 23 +- 4 files changed, 2414 insertions(+), 2645 deletions(-) diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs index 73e1c7f024..b8c3faf4f5 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs @@ -1,2298 +1,2155 @@ - - - - - - - -// Copyright (c) Six Labors and contributors. -// Licensed under the Apache License, Version 2.0. - -// - -using System; -using System.Numerics; -using System.Runtime.CompilerServices; - -namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders -{ - internal static partial class PorterDuffFunctions - { - - - - - - - - - - - - - - #region Blenders - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 SrcAtop(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float fw = (sw * 0) + (bw * 1) + (xw * 1); - - // calculate final value - xform = ((xform * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; - - return xform; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 SrcOver(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float fw = (sw * 1) + (bw * 1) + (xw * 1); - - // calculate final value - xform = ((xform * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; - - return xform; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Dest(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float fw = (sw * 0) + (bw * 1) + (xw * 1); - - // calculate final value - xform = ((backdrop * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; - - return xform; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 DestOut(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float fw = (sw * 0) + (bw * 1) + (xw * 0); - - // calculate final value - xform = ((Vector4.Zero * xw) + (backdrop * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; - - return xform; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Xor(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float fw = (sw * 1) + (bw * 1) + (xw * 0); - - // calculate final value - xform = ((Vector4.Zero * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; - - return xform; - } - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_Src(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop, source, Normal(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop, source, Normal(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_SrcOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop, source, Normal(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_SrcIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop, source, Normal(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop, source, Normal(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop, source, Normal(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop, source, Normal(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop, source, Normal(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop, source, Normal(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_DestOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop, source, Normal(backdrop, source)); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_Clear(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop, source, source); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_Xor(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop, source, source); - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_Src(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Normal_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_SrcAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Normal_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_SrcOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Normal_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_SrcIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Normal_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_SrcOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Normal_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_Dest(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Normal_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Normal_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_DestOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Normal_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Normal_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_DestOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Normal_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_Clear(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Normal_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_Xor(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Normal_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_Src(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop, source, Multiply(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop, source, Multiply(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_SrcOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop, source, Multiply(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_SrcIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop, source, Multiply(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop, source, Multiply(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop, source, Multiply(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop, source, Multiply(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop, source, Multiply(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop, source, Multiply(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_DestOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop, source, Multiply(backdrop, source)); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_Clear(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop, source, source); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_Xor(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop, source, source); - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_Src(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Multiply_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_SrcAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Multiply_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_SrcOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Multiply_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_SrcIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Multiply_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_SrcOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Multiply_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_Dest(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Multiply_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Multiply_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_DestOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Multiply_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Multiply_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_DestOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Multiply_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_Clear(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Multiply_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_Xor(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Multiply_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_Src(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop, source, Add(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop, source, Add(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_SrcOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop, source, Add(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_SrcIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop, source, Add(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop, source, Add(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop, source, Add(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop, source, Add(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop, source, Add(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop, source, Add(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_DestOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop, source, Add(backdrop, source)); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_Clear(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop, source, source); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_Xor(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop, source, source); - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_Src(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Add_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_SrcAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Add_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_SrcOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Add_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_SrcIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Add_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_SrcOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Add_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_Dest(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Add_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Add_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_DestOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Add_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Add_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_DestOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Add_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_Clear(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Add_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_Xor(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Add_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_Src(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop, source, Subtract(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop, source, Subtract(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_SrcOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop, source, Subtract(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_SrcIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop, source, Subtract(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop, source, Subtract(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop, source, Subtract(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop, source, Subtract(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop, source, Subtract(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop, source, Subtract(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_DestOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop, source, Subtract(backdrop, source)); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_Clear(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop, source, source); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_Xor(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop, source, source); - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_Src(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Subtract_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_SrcAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Subtract_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_SrcOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Subtract_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_SrcIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Subtract_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_SrcOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Subtract_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_Dest(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Subtract_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Subtract_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_DestOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Subtract_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Subtract_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_DestOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Subtract_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_Clear(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Subtract_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_Xor(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Subtract_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_Src(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop, source, Screen(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop, source, Screen(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_SrcOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop, source, Screen(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_SrcIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop, source, Screen(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop, source, Screen(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop, source, Screen(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop, source, Screen(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop, source, Screen(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop, source, Screen(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_DestOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop, source, Screen(backdrop, source)); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_Clear(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop, source, source); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_Xor(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop, source, source); - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_Src(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Screen_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_SrcAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Screen_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_SrcOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Screen_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_SrcIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Screen_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_SrcOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Screen_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_Dest(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Screen_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Screen_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_DestOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Screen_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Screen_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_DestOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Screen_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_Clear(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Screen_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_Xor(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Screen_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_Src(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop, source, Darken(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop, source, Darken(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_SrcOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop, source, Darken(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_SrcIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop, source, Darken(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop, source, Darken(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop, source, Darken(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop, source, Darken(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop, source, Darken(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop, source, Darken(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_DestOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop, source, Darken(backdrop, source)); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_Clear(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop, source, source); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_Xor(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop, source, source); - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_Src(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Darken_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_SrcAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Darken_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_SrcOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Darken_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_SrcIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Darken_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_SrcOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Darken_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_Dest(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Darken_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Darken_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_DestOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Darken_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Darken_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_DestOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Darken_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_Clear(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Darken_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_Xor(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Darken_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_Src(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop, source, Lighten(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop, source, Lighten(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_SrcOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop, source, Lighten(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_SrcIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop, source, Lighten(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop, source, Lighten(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop, source, Lighten(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop, source, Lighten(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop, source, Lighten(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop, source, Lighten(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_DestOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop, source, Lighten(backdrop, source)); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_Clear(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop, source, source); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_Xor(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop, source, source); - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_Src(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Lighten_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_SrcAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Lighten_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_SrcOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Lighten_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_SrcIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Lighten_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_SrcOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Lighten_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_Dest(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Lighten_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Lighten_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_DestOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Lighten_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Lighten_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_DestOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Lighten_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_Clear(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Lighten_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_Xor(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Lighten_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_Src(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop, source, Overlay(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop, source, Overlay(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_SrcOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop, source, Overlay(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_SrcIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop, source, Overlay(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop, source, Overlay(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop, source, Overlay(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop, source, Overlay(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop, source, Overlay(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop, source, Overlay(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_DestOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop, source, Overlay(backdrop, source)); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_Clear(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop, source, source); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_Xor(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop, source, source); - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_Src(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Overlay_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_SrcAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Overlay_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_SrcOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Overlay_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_SrcIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Overlay_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_SrcOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Overlay_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_Dest(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Overlay_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Overlay_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_DestOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Overlay_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Overlay_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_DestOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Overlay_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_Clear(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Overlay_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_Xor(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(Overlay_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_Src(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop, source, HardLight(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop, source, HardLight(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_SrcOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop, source, HardLight(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_SrcIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop, source, HardLight(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop, source, HardLight(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop, source, HardLight(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop, source, HardLight(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop, source, HardLight(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop, source, HardLight(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_DestOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop, source, HardLight(backdrop, source)); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_Clear(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop, source, source); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_Xor(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop, source, source); - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_Src(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(HardLight_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_SrcAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(HardLight_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_SrcOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(HardLight_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_SrcIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(HardLight_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_SrcOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(HardLight_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_Dest(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(HardLight_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_DestAtop(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(HardLight_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_DestOver(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(HardLight_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_DestIn(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(HardLight_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_DestOut(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(HardLight_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_Clear(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(HardLight_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_Xor(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(HardLight_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - - - - #endregion - } +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +// + +using System; +using System.Numerics; +using System.Runtime.CompilerServices; + +namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders +{ + internal static partial class PorterDuffFunctions + { + + + + + #region Blenders + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return source; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(backdrop, source, Normal(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(backdrop, source, Normal(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(backdrop, source, Normal(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + return backdrop; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(source, backdrop, Normal(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(source, backdrop, Normal(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(source, backdrop, Normal(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(source, backdrop); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Normal_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop, source); + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Normal_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_SrcAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Normal_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Normal_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Normal_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Normal_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Normal_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Normal_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Normal_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Normal_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Normal_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Normal_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Normal_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Normal_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return source; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(backdrop, source, Multiply(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(backdrop, source, Multiply(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(backdrop, source, Multiply(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + return backdrop; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(source, backdrop, Multiply(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(source, backdrop, Multiply(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(source, backdrop, Multiply(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(source, backdrop); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Multiply_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop, source); + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Multiply_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_SrcAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Multiply_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Multiply_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Multiply_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Multiply_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Multiply_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Multiply_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Multiply_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Multiply_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Multiply_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Multiply_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Multiply_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Multiply_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return source; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(backdrop, source, Add(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(backdrop, source, Add(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(backdrop, source, Add(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + return backdrop; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(source, backdrop, Add(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(source, backdrop, Add(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(source, backdrop, Add(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(source, backdrop); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Add_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop, source); + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Add_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_SrcAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Add_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Add_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Add_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Add_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Add_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Add_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Add_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Add_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Add_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Add_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Add_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Add_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return source; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(backdrop, source, Subtract(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(backdrop, source, Subtract(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(backdrop, source, Subtract(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + return backdrop; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(source, backdrop, Subtract(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(source, backdrop, Subtract(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(source, backdrop, Subtract(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(source, backdrop); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Subtract_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop, source); + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Subtract_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_SrcAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Subtract_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Subtract_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Subtract_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Subtract_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Subtract_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Subtract_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Subtract_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Subtract_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Subtract_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Subtract_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Subtract_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Subtract_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return source; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(backdrop, source, Screen(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(backdrop, source, Screen(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(backdrop, source, Screen(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + return backdrop; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(source, backdrop, Screen(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(source, backdrop, Screen(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(source, backdrop, Screen(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(source, backdrop); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Screen_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop, source); + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Screen_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_SrcAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Screen_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Screen_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Screen_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Screen_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Screen_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Screen_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Screen_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Screen_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Screen_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Screen_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Screen_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Screen_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return source; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(backdrop, source, Darken(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(backdrop, source, Darken(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(backdrop, source, Darken(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + return backdrop; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(source, backdrop, Darken(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(source, backdrop, Darken(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(source, backdrop, Darken(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(source, backdrop); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Darken_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop, source); + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Darken_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_SrcAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Darken_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Darken_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Darken_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Darken_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Darken_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Darken_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Darken_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Darken_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Darken_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Darken_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Darken_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Darken_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return source; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(backdrop, source, Lighten(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(backdrop, source, Lighten(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(backdrop, source, Lighten(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + return backdrop; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(source, backdrop, Lighten(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(source, backdrop, Lighten(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(source, backdrop, Lighten(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(source, backdrop); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Lighten_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop, source); + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Lighten_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_SrcAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Lighten_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Lighten_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Lighten_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Lighten_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Lighten_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Lighten_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Lighten_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Lighten_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Lighten_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Lighten_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Lighten_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Lighten_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return source; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(backdrop, source, Overlay(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(backdrop, source, Overlay(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(backdrop, source, Overlay(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + return backdrop; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(source, backdrop, Overlay(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(source, backdrop, Overlay(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(source, backdrop, Overlay(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(source, backdrop); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 Overlay_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop, source); + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Overlay_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_SrcAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Overlay_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Overlay_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Overlay_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Overlay_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Overlay_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Overlay_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Overlay_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Overlay_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Overlay_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Overlay_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel Overlay_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(Overlay_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return source; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(backdrop, source, HardLight(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(backdrop, source, HardLight(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(backdrop, source, HardLight(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + return backdrop; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(source, backdrop, HardLight(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(source, backdrop, HardLight(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(source, backdrop, HardLight(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(source, backdrop); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 HardLight_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop, source); + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_Src(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(HardLight_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_SrcAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(HardLight_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_SrcOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(HardLight_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_SrcIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(HardLight_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_SrcOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(HardLight_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_Dest(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(HardLight_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_DestAtop(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(HardLight_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_DestOver(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(HardLight_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_DestIn(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(HardLight_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_DestOut(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(HardLight_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_Clear(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(HardLight_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel HardLight_Xor(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(HardLight_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + + + #endregion + } } \ No newline at end of file diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt index 64608fcfac..3045b1e81c 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt @@ -1,237 +1,191 @@ -<# -// Copyright (c) Six Labors and contributors. -// Licensed under the Apache License, Version 2.0. -#> -<#@ 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 and contributors. -// Licensed under the Apache License, Version 2.0. - -// - -using System; -using System.Numerics; -using System.Runtime.CompilerServices; - -namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders -{ - internal static partial class PorterDuffFunctions - { - - -<# void GenerateVectorCompositor(string name, string sourceVar, string destVar, string blendVar) - { - int a_s = sourceVar == "Vector4.Zero" ? 0 : 1; - int a_b = destVar == "Vector4.Zero" ? 0 : 1; - int a_x = blendVar == "Vector4.Zero" ? 0 : 1; -#> - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=name#>(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float fw = (sw * <#=a_s#>) + (bw * <#=a_b#>) + (xw * <#=a_x#>); - - // calculate final value - xform = ((<#=blendVar#> * xw) + (<#=destVar#> * bw) + (<#=sourceVar#> * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; - - return xform; - } -<# } #> - - - - - -<# void GeneratePixelBlenders(string blender) { #> - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_Src(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Src(backdrop, source, <#=blender#>(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcAtop(backdrop, source, <#=blender#>(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_SrcOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOver(backdrop, source, <#=blender#>(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_SrcIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcIn(backdrop, source, <#=blender#>(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_SrcOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return SrcOut(backdrop, source, <#=blender#>(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_Dest(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Dest(backdrop, source, <#=blender#>(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_DestAtop(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestAtop(backdrop, source, <#=blender#>(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_DestOver(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOver(backdrop, source, <#=blender#>(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_DestIn(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestIn(backdrop, source, <#=blender#>(backdrop, source)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_DestOut(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return DestOut(backdrop, source, <#=blender#>(backdrop, source)); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_Clear(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Clear(backdrop, source, source); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_Xor(Vector4 backdrop, Vector4 source, float opacity) - { - opacity = opacity.Clamp(0, 1); - source.W *= opacity; - - return Xor(backdrop, source, source); - } - -<# } #> - - -<# void GenerateGenericPixelBlender(string blender, string composer) { #> - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel <#=blender#>_<#=composer#>(TPixel backdrop, TPixel source, float opacity) - where TPixel : struct, IPixel - { - TPixel dest = default; - dest.PackFromVector4(<#=blender#>_<#=composer#>(backdrop.ToVector4(),source.ToVector4(),opacity)); - return dest; - } - -<# } #> - - #region Blenders -<# - -// GenerateVectorCompositor("Src", "source", "Vector4.Zero", "xform"); -GenerateVectorCompositor("SrcAtop", "Vector4.Zero", "backdrop", "xform"); -GenerateVectorCompositor("SrcOver", "source", "backdrop", "xform"); -// GenerateVectorCompositor("SrcIn", "Vector4.Zero", "Vector4.Zero", "xform"); -// GenerateVectorCompositor("SrcOut", "source", "Vector4.Zero", "Vector4.Zero"); -GenerateVectorCompositor("Dest", "Vector4.Zero", "backdrop", "backdrop"); -// GenerateVectorCompositor("DestAtop", "source", "Vector4.Zero", "backdrop"); -// GenerateVectorCompositor("DestOver", "source", "backdrop", "backdrop"); -// GenerateVectorCompositor("DestIn", "Vector4.Zero", "Vector4.Zero", "backdrop"); -GenerateVectorCompositor("DestOut", "Vector4.Zero", "backdrop", "Vector4.Zero"); -// GenerateVectorCompositor("Clear", "Vector4.Zero", "Vector4.Zero", "Vector4.Zero"); -GenerateVectorCompositor("Xor", "source", "backdrop", "Vector4.Zero"); - -string[] composers = new []{ - "Src" , - "SrcAtop" , - "SrcOver" , - "SrcIn" , - "SrcOut" , - "Dest" , - "DestAtop" , - "DestOver" , - "DestIn" , - "DestOut" , - "Clear" , - "Xor" , -}; - -string[] 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); - } - } - -#> - - #endregion - } +<# +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. +#> +<#@ 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 and contributors. +// Licensed under the Apache License, Version 2.0. + +// + +using System; +using System.Numerics; +using System.Runtime.CompilerServices; + +namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders +{ + internal static partial class PorterDuffFunctions + { + +<# void GeneratePixelBlenders(string blender) { #> + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_Src(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return source; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(backdrop, source, <#=blender#>(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(backdrop, source, <#=blender#>(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(backdrop, source, <#=blender#>(backdrop, source)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_Dest(Vector4 backdrop, Vector4 source, float opacity) + { + return backdrop; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Atop(source, backdrop, <#=blender#>(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_DestOver(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Over(source, backdrop, <#=blender#>(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_DestIn(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return In(source, backdrop, <#=blender#>(source, backdrop)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_DestOut(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Out(source, backdrop); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_Xor(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Xor(backdrop, source); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector4 <#=blender#>_Clear(Vector4 backdrop, Vector4 source, float opacity) + { + opacity = opacity.Clamp(0, 1); + source.W *= opacity; + + return Clear(backdrop, source); + } +<# } #> + + +<# void GenerateGenericPixelBlender(string blender, string composer) { #> + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static TPixel <#=blender#>_<#=composer#>(TPixel backdrop, TPixel source, float opacity) + where TPixel : struct, IPixel + { + TPixel dest = default; + dest.PackFromVector4(<#=blender#>_<#=composer#>(backdrop.ToVector4(),source.ToVector4(),opacity)); + return dest; + } + +<# } #> + + #region Blenders +<# + +string[] composers = new []{ + "Src" , + "SrcAtop" , + "SrcOver" , + "SrcIn" , + "SrcOut" , + "Dest" , + "DestAtop" , + "DestOver" , + "DestIn" , + "DestOut" , + "Clear" , + "Xor" , +}; + +string[] 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); + } + } + +#> + + #endregion + } } \ No newline at end of file diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs index 5738238568..e2c0c85db9 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs @@ -179,125 +179,78 @@ private static Vector4 SrcOver_Reference(Vector4 backdrop, Vector4 source, Vecto return xform; } + public static Vector4 Over(Vector4 dst, Vector4 src, Vector4 blend) + { + // calculate weights + float blendW = dst.W * src.W; + float dstW = dst.W - blendW; + float srcW = src.W - blendW; + // calculate final alpha + float alpha = dstW + srcW + blendW; + // calculate final color + Vector4 color = dst * dstW + src * srcW + blend * blendW; + // unpremultiply + color /= MathF.Max(alpha, Constants.Epsilon); + color.W = alpha; + return color; + } + public static Vector4 Atop(Vector4 dst, Vector4 src, Vector4 blend) + { + // calculate weights + float blendW = dst.W * src.W; + float dstW = dst.W - blendW; - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Src(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float fw = (sw * 1) + (bw * 0) + (xw * 1); - - // calculate final value - xform = ((xform * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; - - return Vector4.Lerp(backdrop, xform, source.W); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 SrcIn(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - - // calculate final value - xform.W = xw; - - return Vector4.Lerp(backdrop, xform, source.W); - } + // calculate final alpha + float alpha = dstW + blendW; + + // calculate final color + Vector4 color = dst * dstW + blend * blendW; + + // unpremultiply + color /= MathF.Max(alpha, Constants.Epsilon); + color.W = alpha; - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 SrcOut(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float fw = sw; - - // calculate final value - xform = source; - xform.W = fw; - - return Vector4.Lerp(backdrop, xform, source.W); + return color; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 DestAtop(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float fw = (sw * 1) + (bw * 0) + (xw * 1); - - // calculate final value - xform = ((backdrop * xw) + (Vector4.Zero * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; - - return Vector4.Lerp(backdrop, xform, source.W); + public static Vector4 In(Vector4 dst, Vector4 src, Vector4 blend) + { + blend.W = dst.W * src.W; + + return blend; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 DestOver(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float fw = (sw * 1) + (bw * 1) + (xw * 1); - - // calculate final value - xform = ((backdrop * xw) + (backdrop * bw) + (source * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; - - return Vector4.Lerp(backdrop, xform, source.W); + public static Vector4 Out(Vector4 dst, Vector4 src) + { + // calculate final alpha + src.W = (1 - dst.W) * src.W; + + return src; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 DestIn(Vector4 backdrop, Vector4 source, Vector4 xform) - { - // calculate weights - float xw = backdrop.W * source.W; - float bw = backdrop.W - xw; - float sw = source.W - xw; - - // calculate final alpha - float fw = (sw * 0) + (bw * 0) + (xw * 1); - - // calculate final value - xform = ((backdrop * xw) + (Vector4.Zero * bw) + (Vector4.Zero * sw)) / MathF.Max(fw, Constants.Epsilon); - xform.W = fw; - - return Vector4.Lerp(backdrop, xform, source.W); + public static Vector4 Xor(Vector4 dst, Vector4 src) + { + float srcW = 1 - dst.W; + float dstW = 1 - src.W; + + float alpha = src.W * srcW + dst.W * dstW; + Vector4 color = src.W * src * srcW + dst.W * dst * dstW; + + // unpremultiply + color /= MathF.Max(alpha, Constants.Epsilon); + color.W = alpha; + + return color; } - /// - /// General composition function for all modes, with a general solution for alpha channel - /// - /// Original Backdrop color - /// Original source color - /// Desired transformed color, without taking Alpha channel in account - /// The final color - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Vector4 Clear(Vector4 backdrop, Vector4 source, Vector4 xform) + private static Vector4 Clear(Vector4 backdrop, Vector4 source) { - return Vector4.Lerp(backdrop, Vector4.Zero, xform.W); + return Vector4.Lerp(backdrop, Vector4.Zero, source.W); } #endregion diff --git a/tests/ImageSharp.Tests/Drawing/SolidFillBlendedShapesTests.cs b/tests/ImageSharp.Tests/Drawing/SolidFillBlendedShapesTests.cs index 7d73d1b650..f43428d492 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidFillBlendedShapesTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidFillBlendedShapesTests.cs @@ -116,21 +116,26 @@ public void _1DarkBlueRect_2BlendHotPinkRect_3BlendSemiTransparentRedEllipse(TestImageProvider provider, PixelBlenderMode mode) where TPixel : struct, IPixel { - using (Image img = provider.GetImage()) + using(Image dstImg = provider.GetImage(), srcImg = provider.GetImage()) { - int scaleX = (img.Width / 100); - int scaleY = (img.Height / 100); - img.Mutate( + int scaleX = (dstImg.Width / 100); + int scaleY = (dstImg.Height / 100); + + dstImg.Mutate( x => x.Fill( NamedColors.DarkBlue, - new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY))); - img.Mutate( + new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY))); + + srcImg.Mutate( x => x.Fill( - new GraphicsOptions(true) { BlenderMode = mode }, NamedColors.Black, - new Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY))); + new Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY))); + + dstImg.Mutate( + x => x.DrawImage(new GraphicsOptions(true) { BlenderMode = mode }, srcImg) + ); - VerifyImage(provider, mode, img); + VerifyImage(provider, mode, dstImg); } } From 8368f1efc9eaa22e3562d9c97fc5c57952666719 Mon Sep 17 00:00:00 2001 From: Vicente Penades Date: Mon, 2 Jul 2018 16:39:41 +0200 Subject: [PATCH 05/10] removed trailing spaces --- .../PixelBlenders/PorterDuffFunctions.cs | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs index e2c0c85db9..200b185fad 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs @@ -26,7 +26,7 @@ internal static partial class PorterDuffFunctions /// Source over backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Normal(Vector4 backdrop, Vector4 source) @@ -38,7 +38,7 @@ public static Vector4 Normal(Vector4 backdrop, Vector4 source) /// Source multiplied by backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Multiply(Vector4 backdrop, Vector4 source) @@ -50,7 +50,7 @@ public static Vector4 Multiply(Vector4 backdrop, Vector4 source) /// Source added to backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Add(Vector4 backdrop, Vector4 source) @@ -62,7 +62,7 @@ public static Vector4 Add(Vector4 backdrop, Vector4 source) /// Source subtracted from backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Subtract(Vector4 backdrop, Vector4 source) @@ -74,7 +74,7 @@ public static Vector4 Subtract(Vector4 backdrop, Vector4 source) /// Complement of source multiplied by the complement of backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Screen(Vector4 backdrop, Vector4 source) @@ -86,7 +86,7 @@ public static Vector4 Screen(Vector4 backdrop, Vector4 source) /// Per element, chooses the smallest value of source and backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Darken(Vector4 backdrop, Vector4 source) @@ -98,7 +98,7 @@ public static Vector4 Darken(Vector4 backdrop, Vector4 source) /// Per element, chooses the largest value of source and backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Lighten(Vector4 backdrop, Vector4 source) @@ -110,7 +110,7 @@ public static Vector4 Lighten(Vector4 backdrop, Vector4 source) /// Overlays source over backdrop /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 Overlay(Vector4 backdrop, Vector4 source) @@ -126,7 +126,7 @@ public static Vector4 Overlay(Vector4 backdrop, Vector4 source) /// Hard light effect /// /// Backdrop color - /// Source color + /// Source color /// Output color [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector4 HardLight(Vector4 backdrop, Vector4 source) @@ -190,7 +190,7 @@ public static Vector4 Over(Vector4 dst, Vector4 src, Vector4 blend) float alpha = dstW + srcW + blendW; // calculate final color - Vector4 color = dst * dstW + src * srcW + blend * blendW; + Vector4 color = (dst * dstW) + (src * srcW) + (blend * blendW); // unpremultiply color /= MathF.Max(alpha, Constants.Epsilon); @@ -209,7 +209,7 @@ public static Vector4 Atop(Vector4 dst, Vector4 src, Vector4 blend) float alpha = dstW + blendW; // calculate final color - Vector4 color = dst * dstW + blend * blendW; + Vector4 color = (dst * dstW) + (blend * blendW); // unpremultiply color /= MathF.Max(alpha, Constants.Epsilon); @@ -238,8 +238,8 @@ public static Vector4 Xor(Vector4 dst, Vector4 src) float srcW = 1 - dst.W; float dstW = 1 - src.W; - float alpha = src.W * srcW + dst.W * dstW; - Vector4 color = src.W * src * srcW + dst.W * dst * dstW; + float alpha = (src.W * srcW) + (dst.W * dstW); + Vector4 color = (src.W * src * srcW) + (dst.W * dst * dstW); // unpremultiply color /= MathF.Max(alpha, Constants.Epsilon); @@ -255,9 +255,5 @@ private static Vector4 Clear(Vector4 backdrop, Vector4 source) #endregion - - - - } } \ No newline at end of file From a9a8ded37fbd52e21ed8f99f38257992b8aacb69 Mon Sep 17 00:00:00 2001 From: Vicente Penades Date: Mon, 2 Jul 2018 16:43:17 +0200 Subject: [PATCH 06/10] removed trailing spaces, regions & cleared code --- .../PixelFormats/PixelBlenders/PorterDuffFunctions.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs index 200b185fad..1a4fd15d3d 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs @@ -20,8 +20,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders /// internal static partial class PorterDuffFunctions { - #region color blenders - /// /// Source over backdrop /// @@ -150,10 +148,6 @@ private static float OverlayValueFunction(float backdrop, float source) return backdrop <= 0.5f ? (2 * backdrop * source) : 1 - ((2 * (1 - source)) * (1 - backdrop)); } - #endregion - - #region alpha composers - /// /// General composition function for all modes, with a general solution for alpha channel /// @@ -252,8 +246,5 @@ private static Vector4 Clear(Vector4 backdrop, Vector4 source) { return Vector4.Lerp(backdrop, Vector4.Zero, source.W); } - - #endregion - } } \ No newline at end of file From 8a59bf7f38fd121697c27b26fc747779c1f3933f Mon Sep 17 00:00:00 2001 From: Vicente Penades Date: Tue, 3 Jul 2018 18:53:13 +0200 Subject: [PATCH 07/10] fixed Clear composition, it essentially returns fully transparent --- .../PixelFormats/PixelBlenders/PorterDuffFunctions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs index 1a4fd15d3d..8b6fbcfb90 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs @@ -244,7 +244,7 @@ public static Vector4 Xor(Vector4 dst, Vector4 src) private static Vector4 Clear(Vector4 backdrop, Vector4 source) { - return Vector4.Lerp(backdrop, Vector4.Zero, source.W); + return Vector4.Zero; } } } \ No newline at end of file From c3a4b673309ed821e94c99090a8420494b942155 Mon Sep 17 00:00:00 2001 From: Vicente Penades Date: Thu, 5 Jul 2018 13:41:28 +0200 Subject: [PATCH 08/10] changed In and Out composition functions to always produce "transparent black" --- .../PixelBlenders/PorterDuffFunctions.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs index 8b6fbcfb90..c84cd9a7b1 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs @@ -214,17 +214,24 @@ public static Vector4 Atop(Vector4 dst, Vector4 src, Vector4 blend) public static Vector4 In(Vector4 dst, Vector4 src, Vector4 blend) { - blend.W = dst.W * src.W; + float alpha = dst.W * src.W; - return blend; + Vector4 color = src * alpha; // premultiply + color /= MathF.Max(alpha, Constants.Epsilon); // unpremultiply + color.W = alpha; + + return color; } public static Vector4 Out(Vector4 dst, Vector4 src) { - // calculate final alpha - src.W = (1 - dst.W) * src.W; + float alpha = (1 - dst.W) * src.W; - return src; + Vector4 color = src * alpha; // premultiply + color /= MathF.Max(alpha, Constants.Epsilon); // unpremultiply + color.W = alpha; + + return color; } public static Vector4 Xor(Vector4 dst, Vector4 src) From 29c01dab6cc4546751efae3374af254ca2d55820 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 4 Aug 2018 12:35:31 +0100 Subject: [PATCH 09/10] No underscores! --- .../Processing/GradientBrushBase{TPixel}.cs | 8 +- .../DefaultPixelBlenders.Generated.cs | 864 +++++++++--------- .../DefaultPixelBlenders.Generated.tt | 52 +- .../PorterDuffFunctions.Generated.cs | 651 +++++++------ .../PorterDuffFunctions.Generated.tt | 71 +- .../PixelBlenders/PorterDuffFunctions.cs | 2 +- .../PixelOperations{TPixel}.PixelBenders.cs | 42 +- .../PixelBlenders/PorterDuffBulkVsPixel.cs | 4 +- .../PixelBlenders/PorterDuffFunctionsTests.cs | 21 +- .../PorterDuffFunctionsTests_TPixel.cs | 113 ++- .../PixelOperationsTests.Blender.cs | 84 +- 11 files changed, 949 insertions(+), 963 deletions(-) diff --git a/src/ImageSharp.Drawing/Processing/GradientBrushBase{TPixel}.cs b/src/ImageSharp.Drawing/Processing/GradientBrushBase{TPixel}.cs index fe997ed7f1..897b3f384f 100644 --- a/src/ImageSharp.Drawing/Processing/GradientBrushBase{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/GradientBrushBase{TPixel}.cs @@ -111,7 +111,7 @@ protected GradientBrushApplicatorBase( throw new ArgumentOutOfRangeException(); } - var (from, to) = this.GetGradientSegment(positionOnCompleteGradient); + (ColorStop from, ColorStop to) = this.GetGradientSegment(positionOnCompleteGradient); if (from.Color.Equals(to.Color)) { @@ -124,7 +124,7 @@ protected GradientBrushApplicatorBase( float onLocalGradient = (positionOnCompleteGradient - from.Ratio) / to.Ratio; // TODO: this should be changeble for different gradienting functions - Vector4 result = PorterDuffFunctions.Normal_SrcOver( + Vector4 result = PorterDuffFunctions.NormalSrcOver( fromAsVector, toAsVector, onLocalGradient); @@ -153,11 +153,11 @@ protected GradientBrushApplicatorBase( private (ColorStop from, ColorStop to) GetGradientSegment( float positionOnCompleteGradient) { - var localGradientFrom = this.colorStops[0]; + ColorStop localGradientFrom = this.colorStops[0]; ColorStop localGradientTo = default; // TODO: ensure colorStops has at least 2 items (technically 1 would be okay, but that's no gradient) - foreach (var colorStop in this.colorStops) + foreach (ColorStop colorStop in this.colorStops) { localGradientTo = colorStop; diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs index 1ee9848d63..b454349d78 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs @@ -24,17 +24,17 @@ internal static class DefaultPixelBlenders where TPixel : struct, IPixel { - internal class Normal_Src : PixelBlender + internal class NormalSrc : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Normal_Src Instance { get; } = new Normal_Src(); + public static NormalSrc Instance { get; } = new NormalSrc(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Normal_Src(background, source, amount); + return PorterDuffFunctions.NormalSrc(background, source, amount); } /// @@ -55,7 +55,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal_Src(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.NormalSrc(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -63,17 +63,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Multiply_Src : PixelBlender + internal class MultiplySrc : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Multiply_Src Instance { get; } = new Multiply_Src(); + public static MultiplySrc Instance { get; } = new MultiplySrc(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Multiply_Src(background, source, amount); + return PorterDuffFunctions.MultiplySrc(background, source, amount); } /// @@ -94,7 +94,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Multiply_Src(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.MultiplySrc(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -102,17 +102,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Add_Src : PixelBlender + internal class AddSrc : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Add_Src Instance { get; } = new Add_Src(); + public static AddSrc Instance { get; } = new AddSrc(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Add_Src(background, source, amount); + return PorterDuffFunctions.AddSrc(background, source, amount); } /// @@ -133,7 +133,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Add_Src(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.AddSrc(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -141,17 +141,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Subtract_Src : PixelBlender + internal class SubtractSrc : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Subtract_Src Instance { get; } = new Subtract_Src(); + public static SubtractSrc Instance { get; } = new SubtractSrc(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Subtract_Src(background, source, amount); + return PorterDuffFunctions.SubtractSrc(background, source, amount); } /// @@ -172,7 +172,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Subtract_Src(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.SubtractSrc(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -180,17 +180,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Screen_Src : PixelBlender + internal class ScreenSrc : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Screen_Src Instance { get; } = new Screen_Src(); + public static ScreenSrc Instance { get; } = new ScreenSrc(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Screen_Src(background, source, amount); + return PorterDuffFunctions.ScreenSrc(background, source, amount); } /// @@ -211,7 +211,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Screen_Src(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.ScreenSrc(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -219,17 +219,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Darken_Src : PixelBlender + internal class DarkenSrc : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Darken_Src Instance { get; } = new Darken_Src(); + public static DarkenSrc Instance { get; } = new DarkenSrc(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Darken_Src(background, source, amount); + return PorterDuffFunctions.DarkenSrc(background, source, amount); } /// @@ -250,7 +250,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Darken_Src(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.DarkenSrc(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -258,17 +258,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Lighten_Src : PixelBlender + internal class LightenSrc : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Lighten_Src Instance { get; } = new Lighten_Src(); + public static LightenSrc Instance { get; } = new LightenSrc(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Lighten_Src(background, source, amount); + return PorterDuffFunctions.LightenSrc(background, source, amount); } /// @@ -289,7 +289,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Lighten_Src(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.LightenSrc(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -297,17 +297,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Overlay_Src : PixelBlender + internal class OverlaySrc : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Overlay_Src Instance { get; } = new Overlay_Src(); + public static OverlaySrc Instance { get; } = new OverlaySrc(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Overlay_Src(background, source, amount); + return PorterDuffFunctions.OverlaySrc(background, source, amount); } /// @@ -328,7 +328,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Overlay_Src(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.OverlaySrc(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -336,17 +336,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class HardLight_Src : PixelBlender + internal class HardLightSrc : PixelBlender { /// /// Gets the static instance of this blender. /// - public static HardLight_Src Instance { get; } = new HardLight_Src(); + public static HardLightSrc Instance { get; } = new HardLightSrc(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.HardLight_Src(background, source, amount); + return PorterDuffFunctions.HardLightSrc(background, source, amount); } /// @@ -367,7 +367,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.HardLight_Src(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.HardLightSrc(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -375,17 +375,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Normal_SrcAtop : PixelBlender + internal class NormalSrcAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Normal_SrcAtop Instance { get; } = new Normal_SrcAtop(); + public static NormalSrcAtop Instance { get; } = new NormalSrcAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Normal_SrcAtop(background, source, amount); + return PorterDuffFunctions.NormalSrcAtop(background, source, amount); } /// @@ -406,7 +406,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.NormalSrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -414,17 +414,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Multiply_SrcAtop : PixelBlender + internal class MultiplySrcAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Multiply_SrcAtop Instance { get; } = new Multiply_SrcAtop(); + public static MultiplySrcAtop Instance { get; } = new MultiplySrcAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Multiply_SrcAtop(background, source, amount); + return PorterDuffFunctions.MultiplySrcAtop(background, source, amount); } /// @@ -445,7 +445,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Multiply_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.MultiplySrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -453,17 +453,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Add_SrcAtop : PixelBlender + internal class AddSrcAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Add_SrcAtop Instance { get; } = new Add_SrcAtop(); + public static AddSrcAtop Instance { get; } = new AddSrcAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Add_SrcAtop(background, source, amount); + return PorterDuffFunctions.AddSrcAtop(background, source, amount); } /// @@ -484,7 +484,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Add_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.AddSrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -492,17 +492,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Subtract_SrcAtop : PixelBlender + internal class SubtractSrcAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Subtract_SrcAtop Instance { get; } = new Subtract_SrcAtop(); + public static SubtractSrcAtop Instance { get; } = new SubtractSrcAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Subtract_SrcAtop(background, source, amount); + return PorterDuffFunctions.SubtractSrcAtop(background, source, amount); } /// @@ -523,7 +523,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Subtract_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.SubtractSrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -531,17 +531,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Screen_SrcAtop : PixelBlender + internal class ScreenSrcAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Screen_SrcAtop Instance { get; } = new Screen_SrcAtop(); + public static ScreenSrcAtop Instance { get; } = new ScreenSrcAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Screen_SrcAtop(background, source, amount); + return PorterDuffFunctions.ScreenSrcAtop(background, source, amount); } /// @@ -562,7 +562,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Screen_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.ScreenSrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -570,17 +570,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Darken_SrcAtop : PixelBlender + internal class DarkenSrcAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Darken_SrcAtop Instance { get; } = new Darken_SrcAtop(); + public static DarkenSrcAtop Instance { get; } = new DarkenSrcAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Darken_SrcAtop(background, source, amount); + return PorterDuffFunctions.DarkenSrcAtop(background, source, amount); } /// @@ -601,7 +601,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Darken_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.DarkenSrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -609,17 +609,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Lighten_SrcAtop : PixelBlender + internal class LightenSrcAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Lighten_SrcAtop Instance { get; } = new Lighten_SrcAtop(); + public static LightenSrcAtop Instance { get; } = new LightenSrcAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Lighten_SrcAtop(background, source, amount); + return PorterDuffFunctions.LightenSrcAtop(background, source, amount); } /// @@ -640,7 +640,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Lighten_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.LightenSrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -648,17 +648,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Overlay_SrcAtop : PixelBlender + internal class OverlaySrcAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Overlay_SrcAtop Instance { get; } = new Overlay_SrcAtop(); + public static OverlaySrcAtop Instance { get; } = new OverlaySrcAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Overlay_SrcAtop(background, source, amount); + return PorterDuffFunctions.OverlaySrcAtop(background, source, amount); } /// @@ -679,7 +679,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Overlay_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.OverlaySrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -687,17 +687,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class HardLight_SrcAtop : PixelBlender + internal class HardLightSrcAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static HardLight_SrcAtop Instance { get; } = new HardLight_SrcAtop(); + public static HardLightSrcAtop Instance { get; } = new HardLightSrcAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.HardLight_SrcAtop(background, source, amount); + return PorterDuffFunctions.HardLightSrcAtop(background, source, amount); } /// @@ -718,7 +718,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.HardLight_SrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.HardLightSrcAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -726,17 +726,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Normal_SrcOver : PixelBlender + internal class NormalSrcOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Normal_SrcOver Instance { get; } = new Normal_SrcOver(); + public static NormalSrcOver Instance { get; } = new NormalSrcOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Normal_SrcOver(background, source, amount); + return PorterDuffFunctions.NormalSrcOver(background, source, amount); } /// @@ -757,7 +757,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.NormalSrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -765,17 +765,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Multiply_SrcOver : PixelBlender + internal class MultiplySrcOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Multiply_SrcOver Instance { get; } = new Multiply_SrcOver(); + public static MultiplySrcOver Instance { get; } = new MultiplySrcOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Multiply_SrcOver(background, source, amount); + return PorterDuffFunctions.MultiplySrcOver(background, source, amount); } /// @@ -796,7 +796,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Multiply_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.MultiplySrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -804,17 +804,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Add_SrcOver : PixelBlender + internal class AddSrcOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Add_SrcOver Instance { get; } = new Add_SrcOver(); + public static AddSrcOver Instance { get; } = new AddSrcOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Add_SrcOver(background, source, amount); + return PorterDuffFunctions.AddSrcOver(background, source, amount); } /// @@ -835,7 +835,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Add_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.AddSrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -843,17 +843,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Subtract_SrcOver : PixelBlender + internal class SubtractSrcOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Subtract_SrcOver Instance { get; } = new Subtract_SrcOver(); + public static SubtractSrcOver Instance { get; } = new SubtractSrcOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Subtract_SrcOver(background, source, amount); + return PorterDuffFunctions.SubtractSrcOver(background, source, amount); } /// @@ -874,7 +874,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Subtract_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.SubtractSrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -882,17 +882,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Screen_SrcOver : PixelBlender + internal class ScreenSrcOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Screen_SrcOver Instance { get; } = new Screen_SrcOver(); + public static ScreenSrcOver Instance { get; } = new ScreenSrcOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Screen_SrcOver(background, source, amount); + return PorterDuffFunctions.ScreenSrcOver(background, source, amount); } /// @@ -913,7 +913,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Screen_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.ScreenSrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -921,17 +921,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Darken_SrcOver : PixelBlender + internal class DarkenSrcOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Darken_SrcOver Instance { get; } = new Darken_SrcOver(); + public static DarkenSrcOver Instance { get; } = new DarkenSrcOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Darken_SrcOver(background, source, amount); + return PorterDuffFunctions.DarkenSrcOver(background, source, amount); } /// @@ -952,7 +952,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Darken_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.DarkenSrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -960,17 +960,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Lighten_SrcOver : PixelBlender + internal class LightenSrcOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Lighten_SrcOver Instance { get; } = new Lighten_SrcOver(); + public static LightenSrcOver Instance { get; } = new LightenSrcOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Lighten_SrcOver(background, source, amount); + return PorterDuffFunctions.LightenSrcOver(background, source, amount); } /// @@ -991,7 +991,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Lighten_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.LightenSrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -999,17 +999,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Overlay_SrcOver : PixelBlender + internal class OverlaySrcOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Overlay_SrcOver Instance { get; } = new Overlay_SrcOver(); + public static OverlaySrcOver Instance { get; } = new OverlaySrcOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Overlay_SrcOver(background, source, amount); + return PorterDuffFunctions.OverlaySrcOver(background, source, amount); } /// @@ -1030,7 +1030,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Overlay_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.OverlaySrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1038,17 +1038,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class HardLight_SrcOver : PixelBlender + internal class HardLightSrcOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static HardLight_SrcOver Instance { get; } = new HardLight_SrcOver(); + public static HardLightSrcOver Instance { get; } = new HardLightSrcOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.HardLight_SrcOver(background, source, amount); + return PorterDuffFunctions.HardLightSrcOver(background, source, amount); } /// @@ -1069,7 +1069,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.HardLight_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.HardLightSrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1077,17 +1077,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Normal_SrcIn : PixelBlender + internal class NormalSrcIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Normal_SrcIn Instance { get; } = new Normal_SrcIn(); + public static NormalSrcIn Instance { get; } = new NormalSrcIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Normal_SrcIn(background, source, amount); + return PorterDuffFunctions.NormalSrcIn(background, source, amount); } /// @@ -1108,7 +1108,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.NormalSrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1116,17 +1116,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Multiply_SrcIn : PixelBlender + internal class MultiplySrcIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Multiply_SrcIn Instance { get; } = new Multiply_SrcIn(); + public static MultiplySrcIn Instance { get; } = new MultiplySrcIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Multiply_SrcIn(background, source, amount); + return PorterDuffFunctions.MultiplySrcIn(background, source, amount); } /// @@ -1147,7 +1147,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Multiply_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.MultiplySrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1155,17 +1155,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Add_SrcIn : PixelBlender + internal class AddSrcIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Add_SrcIn Instance { get; } = new Add_SrcIn(); + public static AddSrcIn Instance { get; } = new AddSrcIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Add_SrcIn(background, source, amount); + return PorterDuffFunctions.AddSrcIn(background, source, amount); } /// @@ -1186,7 +1186,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Add_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.AddSrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1194,17 +1194,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Subtract_SrcIn : PixelBlender + internal class SubtractSrcIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Subtract_SrcIn Instance { get; } = new Subtract_SrcIn(); + public static SubtractSrcIn Instance { get; } = new SubtractSrcIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Subtract_SrcIn(background, source, amount); + return PorterDuffFunctions.SubtractSrcIn(background, source, amount); } /// @@ -1225,7 +1225,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Subtract_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.SubtractSrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1233,17 +1233,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Screen_SrcIn : PixelBlender + internal class ScreenSrcIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Screen_SrcIn Instance { get; } = new Screen_SrcIn(); + public static ScreenSrcIn Instance { get; } = new ScreenSrcIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Screen_SrcIn(background, source, amount); + return PorterDuffFunctions.ScreenSrcIn(background, source, amount); } /// @@ -1264,7 +1264,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Screen_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.ScreenSrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1272,17 +1272,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Darken_SrcIn : PixelBlender + internal class DarkenSrcIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Darken_SrcIn Instance { get; } = new Darken_SrcIn(); + public static DarkenSrcIn Instance { get; } = new DarkenSrcIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Darken_SrcIn(background, source, amount); + return PorterDuffFunctions.DarkenSrcIn(background, source, amount); } /// @@ -1303,7 +1303,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Darken_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.DarkenSrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1311,17 +1311,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Lighten_SrcIn : PixelBlender + internal class LightenSrcIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Lighten_SrcIn Instance { get; } = new Lighten_SrcIn(); + public static LightenSrcIn Instance { get; } = new LightenSrcIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Lighten_SrcIn(background, source, amount); + return PorterDuffFunctions.LightenSrcIn(background, source, amount); } /// @@ -1342,7 +1342,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Lighten_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.LightenSrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1350,17 +1350,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Overlay_SrcIn : PixelBlender + internal class OverlaySrcIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Overlay_SrcIn Instance { get; } = new Overlay_SrcIn(); + public static OverlaySrcIn Instance { get; } = new OverlaySrcIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Overlay_SrcIn(background, source, amount); + return PorterDuffFunctions.OverlaySrcIn(background, source, amount); } /// @@ -1381,7 +1381,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Overlay_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.OverlaySrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1389,17 +1389,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class HardLight_SrcIn : PixelBlender + internal class HardLightSrcIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static HardLight_SrcIn Instance { get; } = new HardLight_SrcIn(); + public static HardLightSrcIn Instance { get; } = new HardLightSrcIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.HardLight_SrcIn(background, source, amount); + return PorterDuffFunctions.HardLightSrcIn(background, source, amount); } /// @@ -1420,7 +1420,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.HardLight_SrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.HardLightSrcIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1428,17 +1428,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Normal_SrcOut : PixelBlender + internal class NormalSrcOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Normal_SrcOut Instance { get; } = new Normal_SrcOut(); + public static NormalSrcOut Instance { get; } = new NormalSrcOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Normal_SrcOut(background, source, amount); + return PorterDuffFunctions.NormalSrcOut(background, source, amount); } /// @@ -1459,7 +1459,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.NormalSrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1467,17 +1467,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Multiply_SrcOut : PixelBlender + internal class MultiplySrcOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Multiply_SrcOut Instance { get; } = new Multiply_SrcOut(); + public static MultiplySrcOut Instance { get; } = new MultiplySrcOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Multiply_SrcOut(background, source, amount); + return PorterDuffFunctions.MultiplySrcOut(background, source, amount); } /// @@ -1498,7 +1498,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Multiply_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.MultiplySrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1506,17 +1506,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Add_SrcOut : PixelBlender + internal class AddSrcOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Add_SrcOut Instance { get; } = new Add_SrcOut(); + public static AddSrcOut Instance { get; } = new AddSrcOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Add_SrcOut(background, source, amount); + return PorterDuffFunctions.AddSrcOut(background, source, amount); } /// @@ -1537,7 +1537,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Add_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.AddSrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1545,17 +1545,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Subtract_SrcOut : PixelBlender + internal class SubtractSrcOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Subtract_SrcOut Instance { get; } = new Subtract_SrcOut(); + public static SubtractSrcOut Instance { get; } = new SubtractSrcOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Subtract_SrcOut(background, source, amount); + return PorterDuffFunctions.SubtractSrcOut(background, source, amount); } /// @@ -1576,7 +1576,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Subtract_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.SubtractSrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1584,17 +1584,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Screen_SrcOut : PixelBlender + internal class ScreenSrcOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Screen_SrcOut Instance { get; } = new Screen_SrcOut(); + public static ScreenSrcOut Instance { get; } = new ScreenSrcOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Screen_SrcOut(background, source, amount); + return PorterDuffFunctions.ScreenSrcOut(background, source, amount); } /// @@ -1615,7 +1615,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Screen_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.ScreenSrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1623,17 +1623,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Darken_SrcOut : PixelBlender + internal class DarkenSrcOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Darken_SrcOut Instance { get; } = new Darken_SrcOut(); + public static DarkenSrcOut Instance { get; } = new DarkenSrcOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Darken_SrcOut(background, source, amount); + return PorterDuffFunctions.DarkenSrcOut(background, source, amount); } /// @@ -1654,7 +1654,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Darken_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.DarkenSrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1662,17 +1662,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Lighten_SrcOut : PixelBlender + internal class LightenSrcOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Lighten_SrcOut Instance { get; } = new Lighten_SrcOut(); + public static LightenSrcOut Instance { get; } = new LightenSrcOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Lighten_SrcOut(background, source, amount); + return PorterDuffFunctions.LightenSrcOut(background, source, amount); } /// @@ -1693,7 +1693,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Lighten_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.LightenSrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1701,17 +1701,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Overlay_SrcOut : PixelBlender + internal class OverlaySrcOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Overlay_SrcOut Instance { get; } = new Overlay_SrcOut(); + public static OverlaySrcOut Instance { get; } = new OverlaySrcOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Overlay_SrcOut(background, source, amount); + return PorterDuffFunctions.OverlaySrcOut(background, source, amount); } /// @@ -1732,7 +1732,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Overlay_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.OverlaySrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1740,17 +1740,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class HardLight_SrcOut : PixelBlender + internal class HardLightSrcOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static HardLight_SrcOut Instance { get; } = new HardLight_SrcOut(); + public static HardLightSrcOut Instance { get; } = new HardLightSrcOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.HardLight_SrcOut(background, source, amount); + return PorterDuffFunctions.HardLightSrcOut(background, source, amount); } /// @@ -1771,7 +1771,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.HardLight_SrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.HardLightSrcOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1779,17 +1779,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Normal_Dest : PixelBlender + internal class NormalDest : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Normal_Dest Instance { get; } = new Normal_Dest(); + public static NormalDest Instance { get; } = new NormalDest(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Normal_Dest(background, source, amount); + return PorterDuffFunctions.NormalDest(background, source, amount); } /// @@ -1810,7 +1810,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.NormalDest(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1818,17 +1818,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Multiply_Dest : PixelBlender + internal class MultiplyDest : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Multiply_Dest Instance { get; } = new Multiply_Dest(); + public static MultiplyDest Instance { get; } = new MultiplyDest(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Multiply_Dest(background, source, amount); + return PorterDuffFunctions.MultiplyDest(background, source, amount); } /// @@ -1849,7 +1849,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Multiply_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.MultiplyDest(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1857,17 +1857,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Add_Dest : PixelBlender + internal class AddDest : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Add_Dest Instance { get; } = new Add_Dest(); + public static AddDest Instance { get; } = new AddDest(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Add_Dest(background, source, amount); + return PorterDuffFunctions.AddDest(background, source, amount); } /// @@ -1888,7 +1888,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Add_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.AddDest(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1896,17 +1896,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Subtract_Dest : PixelBlender + internal class SubtractDest : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Subtract_Dest Instance { get; } = new Subtract_Dest(); + public static SubtractDest Instance { get; } = new SubtractDest(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Subtract_Dest(background, source, amount); + return PorterDuffFunctions.SubtractDest(background, source, amount); } /// @@ -1927,7 +1927,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Subtract_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.SubtractDest(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1935,17 +1935,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Screen_Dest : PixelBlender + internal class ScreenDest : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Screen_Dest Instance { get; } = new Screen_Dest(); + public static ScreenDest Instance { get; } = new ScreenDest(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Screen_Dest(background, source, amount); + return PorterDuffFunctions.ScreenDest(background, source, amount); } /// @@ -1966,7 +1966,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Screen_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.ScreenDest(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -1974,17 +1974,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Darken_Dest : PixelBlender + internal class DarkenDest : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Darken_Dest Instance { get; } = new Darken_Dest(); + public static DarkenDest Instance { get; } = new DarkenDest(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Darken_Dest(background, source, amount); + return PorterDuffFunctions.DarkenDest(background, source, amount); } /// @@ -2005,7 +2005,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Darken_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.DarkenDest(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2013,17 +2013,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Lighten_Dest : PixelBlender + internal class LightenDest : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Lighten_Dest Instance { get; } = new Lighten_Dest(); + public static LightenDest Instance { get; } = new LightenDest(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Lighten_Dest(background, source, amount); + return PorterDuffFunctions.LightenDest(background, source, amount); } /// @@ -2044,7 +2044,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Lighten_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.LightenDest(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2052,17 +2052,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Overlay_Dest : PixelBlender + internal class OverlayDest : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Overlay_Dest Instance { get; } = new Overlay_Dest(); + public static OverlayDest Instance { get; } = new OverlayDest(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Overlay_Dest(background, source, amount); + return PorterDuffFunctions.OverlayDest(background, source, amount); } /// @@ -2083,7 +2083,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Overlay_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.OverlayDest(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2091,17 +2091,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class HardLight_Dest : PixelBlender + internal class HardLightDest : PixelBlender { /// /// Gets the static instance of this blender. /// - public static HardLight_Dest Instance { get; } = new HardLight_Dest(); + public static HardLightDest Instance { get; } = new HardLightDest(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.HardLight_Dest(background, source, amount); + return PorterDuffFunctions.HardLightDest(background, source, amount); } /// @@ -2122,7 +2122,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.HardLight_Dest(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.HardLightDest(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2130,17 +2130,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Normal_DestAtop : PixelBlender + internal class NormalDestAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Normal_DestAtop Instance { get; } = new Normal_DestAtop(); + public static NormalDestAtop Instance { get; } = new NormalDestAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Normal_DestAtop(background, source, amount); + return PorterDuffFunctions.NormalDestAtop(background, source, amount); } /// @@ -2161,7 +2161,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.NormalDestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2169,17 +2169,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Multiply_DestAtop : PixelBlender + internal class MultiplyDestAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Multiply_DestAtop Instance { get; } = new Multiply_DestAtop(); + public static MultiplyDestAtop Instance { get; } = new MultiplyDestAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Multiply_DestAtop(background, source, amount); + return PorterDuffFunctions.MultiplyDestAtop(background, source, amount); } /// @@ -2200,7 +2200,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Multiply_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.MultiplyDestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2208,17 +2208,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Add_DestAtop : PixelBlender + internal class AddDestAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Add_DestAtop Instance { get; } = new Add_DestAtop(); + public static AddDestAtop Instance { get; } = new AddDestAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Add_DestAtop(background, source, amount); + return PorterDuffFunctions.AddDestAtop(background, source, amount); } /// @@ -2239,7 +2239,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Add_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.AddDestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2247,17 +2247,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Subtract_DestAtop : PixelBlender + internal class SubtractDestAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Subtract_DestAtop Instance { get; } = new Subtract_DestAtop(); + public static SubtractDestAtop Instance { get; } = new SubtractDestAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Subtract_DestAtop(background, source, amount); + return PorterDuffFunctions.SubtractDestAtop(background, source, amount); } /// @@ -2278,7 +2278,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Subtract_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.SubtractDestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2286,17 +2286,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Screen_DestAtop : PixelBlender + internal class ScreenDestAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Screen_DestAtop Instance { get; } = new Screen_DestAtop(); + public static ScreenDestAtop Instance { get; } = new ScreenDestAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Screen_DestAtop(background, source, amount); + return PorterDuffFunctions.ScreenDestAtop(background, source, amount); } /// @@ -2317,7 +2317,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Screen_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.ScreenDestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2325,17 +2325,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Darken_DestAtop : PixelBlender + internal class DarkenDestAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Darken_DestAtop Instance { get; } = new Darken_DestAtop(); + public static DarkenDestAtop Instance { get; } = new DarkenDestAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Darken_DestAtop(background, source, amount); + return PorterDuffFunctions.DarkenDestAtop(background, source, amount); } /// @@ -2356,7 +2356,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Darken_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.DarkenDestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2364,17 +2364,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Lighten_DestAtop : PixelBlender + internal class LightenDestAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Lighten_DestAtop Instance { get; } = new Lighten_DestAtop(); + public static LightenDestAtop Instance { get; } = new LightenDestAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Lighten_DestAtop(background, source, amount); + return PorterDuffFunctions.LightenDestAtop(background, source, amount); } /// @@ -2395,7 +2395,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Lighten_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.LightenDestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2403,17 +2403,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Overlay_DestAtop : PixelBlender + internal class OverlayDestAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Overlay_DestAtop Instance { get; } = new Overlay_DestAtop(); + public static OverlayDestAtop Instance { get; } = new OverlayDestAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Overlay_DestAtop(background, source, amount); + return PorterDuffFunctions.OverlayDestAtop(background, source, amount); } /// @@ -2434,7 +2434,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Overlay_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.OverlayDestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2442,17 +2442,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class HardLight_DestAtop : PixelBlender + internal class HardLightDestAtop : PixelBlender { /// /// Gets the static instance of this blender. /// - public static HardLight_DestAtop Instance { get; } = new HardLight_DestAtop(); + public static HardLightDestAtop Instance { get; } = new HardLightDestAtop(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.HardLight_DestAtop(background, source, amount); + return PorterDuffFunctions.HardLightDestAtop(background, source, amount); } /// @@ -2473,7 +2473,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.HardLight_DestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.HardLightDestAtop(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2481,17 +2481,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Normal_DestOver : PixelBlender + internal class NormalDestOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Normal_DestOver Instance { get; } = new Normal_DestOver(); + public static NormalDestOver Instance { get; } = new NormalDestOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Normal_DestOver(background, source, amount); + return PorterDuffFunctions.NormalDestOver(background, source, amount); } /// @@ -2512,7 +2512,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.NormalDestOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2520,17 +2520,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Multiply_DestOver : PixelBlender + internal class MultiplyDestOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Multiply_DestOver Instance { get; } = new Multiply_DestOver(); + public static MultiplyDestOver Instance { get; } = new MultiplyDestOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Multiply_DestOver(background, source, amount); + return PorterDuffFunctions.MultiplyDestOver(background, source, amount); } /// @@ -2551,7 +2551,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Multiply_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.MultiplyDestOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2559,17 +2559,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Add_DestOver : PixelBlender + internal class AddDestOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Add_DestOver Instance { get; } = new Add_DestOver(); + public static AddDestOver Instance { get; } = new AddDestOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Add_DestOver(background, source, amount); + return PorterDuffFunctions.AddDestOver(background, source, amount); } /// @@ -2590,7 +2590,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Add_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.AddDestOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2598,17 +2598,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Subtract_DestOver : PixelBlender + internal class SubtractDestOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Subtract_DestOver Instance { get; } = new Subtract_DestOver(); + public static SubtractDestOver Instance { get; } = new SubtractDestOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Subtract_DestOver(background, source, amount); + return PorterDuffFunctions.SubtractDestOver(background, source, amount); } /// @@ -2629,7 +2629,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Subtract_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.SubtractDestOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2637,17 +2637,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Screen_DestOver : PixelBlender + internal class ScreenDestOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Screen_DestOver Instance { get; } = new Screen_DestOver(); + public static ScreenDestOver Instance { get; } = new ScreenDestOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Screen_DestOver(background, source, amount); + return PorterDuffFunctions.ScreenDestOver(background, source, amount); } /// @@ -2668,7 +2668,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Screen_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.ScreenDestOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2676,17 +2676,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Darken_DestOver : PixelBlender + internal class DarkenDestOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Darken_DestOver Instance { get; } = new Darken_DestOver(); + public static DarkenDestOver Instance { get; } = new DarkenDestOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Darken_DestOver(background, source, amount); + return PorterDuffFunctions.DarkenDestOver(background, source, amount); } /// @@ -2707,7 +2707,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Darken_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.DarkenDestOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2715,17 +2715,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Lighten_DestOver : PixelBlender + internal class LightenDestOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Lighten_DestOver Instance { get; } = new Lighten_DestOver(); + public static LightenDestOver Instance { get; } = new LightenDestOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Lighten_DestOver(background, source, amount); + return PorterDuffFunctions.LightenDestOver(background, source, amount); } /// @@ -2746,7 +2746,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Lighten_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.LightenDestOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2754,17 +2754,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Overlay_DestOver : PixelBlender + internal class OverlayDestOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Overlay_DestOver Instance { get; } = new Overlay_DestOver(); + public static OverlayDestOver Instance { get; } = new OverlayDestOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Overlay_DestOver(background, source, amount); + return PorterDuffFunctions.OverlayDestOver(background, source, amount); } /// @@ -2785,7 +2785,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Overlay_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.OverlayDestOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2793,17 +2793,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class HardLight_DestOver : PixelBlender + internal class HardLightDestOver : PixelBlender { /// /// Gets the static instance of this blender. /// - public static HardLight_DestOver Instance { get; } = new HardLight_DestOver(); + public static HardLightDestOver Instance { get; } = new HardLightDestOver(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.HardLight_DestOver(background, source, amount); + return PorterDuffFunctions.HardLightDestOver(background, source, amount); } /// @@ -2824,7 +2824,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.HardLight_DestOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.HardLightDestOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2832,17 +2832,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Normal_DestIn : PixelBlender + internal class NormalDestIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Normal_DestIn Instance { get; } = new Normal_DestIn(); + public static NormalDestIn Instance { get; } = new NormalDestIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Normal_DestIn(background, source, amount); + return PorterDuffFunctions.NormalDestIn(background, source, amount); } /// @@ -2863,7 +2863,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.NormalDestIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2871,17 +2871,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Multiply_DestIn : PixelBlender + internal class MultiplyDestIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Multiply_DestIn Instance { get; } = new Multiply_DestIn(); + public static MultiplyDestIn Instance { get; } = new MultiplyDestIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Multiply_DestIn(background, source, amount); + return PorterDuffFunctions.MultiplyDestIn(background, source, amount); } /// @@ -2902,7 +2902,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Multiply_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.MultiplyDestIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2910,17 +2910,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Add_DestIn : PixelBlender + internal class AddDestIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Add_DestIn Instance { get; } = new Add_DestIn(); + public static AddDestIn Instance { get; } = new AddDestIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Add_DestIn(background, source, amount); + return PorterDuffFunctions.AddDestIn(background, source, amount); } /// @@ -2941,7 +2941,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Add_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.AddDestIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2949,17 +2949,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Subtract_DestIn : PixelBlender + internal class SubtractDestIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Subtract_DestIn Instance { get; } = new Subtract_DestIn(); + public static SubtractDestIn Instance { get; } = new SubtractDestIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Subtract_DestIn(background, source, amount); + return PorterDuffFunctions.SubtractDestIn(background, source, amount); } /// @@ -2980,7 +2980,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Subtract_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.SubtractDestIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -2988,17 +2988,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Screen_DestIn : PixelBlender + internal class ScreenDestIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Screen_DestIn Instance { get; } = new Screen_DestIn(); + public static ScreenDestIn Instance { get; } = new ScreenDestIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Screen_DestIn(background, source, amount); + return PorterDuffFunctions.ScreenDestIn(background, source, amount); } /// @@ -3019,7 +3019,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Screen_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.ScreenDestIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3027,17 +3027,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Darken_DestIn : PixelBlender + internal class DarkenDestIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Darken_DestIn Instance { get; } = new Darken_DestIn(); + public static DarkenDestIn Instance { get; } = new DarkenDestIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Darken_DestIn(background, source, amount); + return PorterDuffFunctions.DarkenDestIn(background, source, amount); } /// @@ -3058,7 +3058,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Darken_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.DarkenDestIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3066,17 +3066,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Lighten_DestIn : PixelBlender + internal class LightenDestIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Lighten_DestIn Instance { get; } = new Lighten_DestIn(); + public static LightenDestIn Instance { get; } = new LightenDestIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Lighten_DestIn(background, source, amount); + return PorterDuffFunctions.LightenDestIn(background, source, amount); } /// @@ -3097,7 +3097,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Lighten_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.LightenDestIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3105,17 +3105,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Overlay_DestIn : PixelBlender + internal class OverlayDestIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Overlay_DestIn Instance { get; } = new Overlay_DestIn(); + public static OverlayDestIn Instance { get; } = new OverlayDestIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Overlay_DestIn(background, source, amount); + return PorterDuffFunctions.OverlayDestIn(background, source, amount); } /// @@ -3136,7 +3136,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Overlay_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.OverlayDestIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3144,17 +3144,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class HardLight_DestIn : PixelBlender + internal class HardLightDestIn : PixelBlender { /// /// Gets the static instance of this blender. /// - public static HardLight_DestIn Instance { get; } = new HardLight_DestIn(); + public static HardLightDestIn Instance { get; } = new HardLightDestIn(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.HardLight_DestIn(background, source, amount); + return PorterDuffFunctions.HardLightDestIn(background, source, amount); } /// @@ -3175,7 +3175,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.HardLight_DestIn(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.HardLightDestIn(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3183,17 +3183,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Normal_DestOut : PixelBlender + internal class NormalDestOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Normal_DestOut Instance { get; } = new Normal_DestOut(); + public static NormalDestOut Instance { get; } = new NormalDestOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Normal_DestOut(background, source, amount); + return PorterDuffFunctions.NormalDestOut(background, source, amount); } /// @@ -3214,7 +3214,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.NormalDestOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3222,17 +3222,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Multiply_DestOut : PixelBlender + internal class MultiplyDestOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Multiply_DestOut Instance { get; } = new Multiply_DestOut(); + public static MultiplyDestOut Instance { get; } = new MultiplyDestOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Multiply_DestOut(background, source, amount); + return PorterDuffFunctions.MultiplyDestOut(background, source, amount); } /// @@ -3253,7 +3253,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Multiply_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.MultiplyDestOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3261,17 +3261,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Add_DestOut : PixelBlender + internal class AddDestOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Add_DestOut Instance { get; } = new Add_DestOut(); + public static AddDestOut Instance { get; } = new AddDestOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Add_DestOut(background, source, amount); + return PorterDuffFunctions.AddDestOut(background, source, amount); } /// @@ -3292,7 +3292,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Add_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.AddDestOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3300,17 +3300,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Subtract_DestOut : PixelBlender + internal class SubtractDestOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Subtract_DestOut Instance { get; } = new Subtract_DestOut(); + public static SubtractDestOut Instance { get; } = new SubtractDestOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Subtract_DestOut(background, source, amount); + return PorterDuffFunctions.SubtractDestOut(background, source, amount); } /// @@ -3331,7 +3331,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Subtract_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.SubtractDestOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3339,17 +3339,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Screen_DestOut : PixelBlender + internal class ScreenDestOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Screen_DestOut Instance { get; } = new Screen_DestOut(); + public static ScreenDestOut Instance { get; } = new ScreenDestOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Screen_DestOut(background, source, amount); + return PorterDuffFunctions.ScreenDestOut(background, source, amount); } /// @@ -3370,7 +3370,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Screen_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.ScreenDestOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3378,17 +3378,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Darken_DestOut : PixelBlender + internal class DarkenDestOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Darken_DestOut Instance { get; } = new Darken_DestOut(); + public static DarkenDestOut Instance { get; } = new DarkenDestOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Darken_DestOut(background, source, amount); + return PorterDuffFunctions.DarkenDestOut(background, source, amount); } /// @@ -3409,7 +3409,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Darken_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.DarkenDestOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3417,17 +3417,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Lighten_DestOut : PixelBlender + internal class LightenDestOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Lighten_DestOut Instance { get; } = new Lighten_DestOut(); + public static LightenDestOut Instance { get; } = new LightenDestOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Lighten_DestOut(background, source, amount); + return PorterDuffFunctions.LightenDestOut(background, source, amount); } /// @@ -3448,7 +3448,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Lighten_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.LightenDestOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3456,17 +3456,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Overlay_DestOut : PixelBlender + internal class OverlayDestOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Overlay_DestOut Instance { get; } = new Overlay_DestOut(); + public static OverlayDestOut Instance { get; } = new OverlayDestOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Overlay_DestOut(background, source, amount); + return PorterDuffFunctions.OverlayDestOut(background, source, amount); } /// @@ -3487,7 +3487,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Overlay_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.OverlayDestOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3495,17 +3495,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class HardLight_DestOut : PixelBlender + internal class HardLightDestOut : PixelBlender { /// /// Gets the static instance of this blender. /// - public static HardLight_DestOut Instance { get; } = new HardLight_DestOut(); + public static HardLightDestOut Instance { get; } = new HardLightDestOut(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.HardLight_DestOut(background, source, amount); + return PorterDuffFunctions.HardLightDestOut(background, source, amount); } /// @@ -3526,7 +3526,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.HardLight_DestOut(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.HardLightDestOut(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3534,17 +3534,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Normal_Clear : PixelBlender + internal class NormalClear : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Normal_Clear Instance { get; } = new Normal_Clear(); + public static NormalClear Instance { get; } = new NormalClear(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Normal_Clear(background, source, amount); + return PorterDuffFunctions.NormalClear(background, source, amount); } /// @@ -3565,7 +3565,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.NormalClear(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3573,17 +3573,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Multiply_Clear : PixelBlender + internal class MultiplyClear : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Multiply_Clear Instance { get; } = new Multiply_Clear(); + public static MultiplyClear Instance { get; } = new MultiplyClear(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Multiply_Clear(background, source, amount); + return PorterDuffFunctions.MultiplyClear(background, source, amount); } /// @@ -3604,7 +3604,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Multiply_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.MultiplyClear(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3612,17 +3612,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Add_Clear : PixelBlender + internal class AddClear : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Add_Clear Instance { get; } = new Add_Clear(); + public static AddClear Instance { get; } = new AddClear(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Add_Clear(background, source, amount); + return PorterDuffFunctions.AddClear(background, source, amount); } /// @@ -3643,7 +3643,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Add_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.AddClear(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3651,17 +3651,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Subtract_Clear : PixelBlender + internal class SubtractClear : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Subtract_Clear Instance { get; } = new Subtract_Clear(); + public static SubtractClear Instance { get; } = new SubtractClear(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Subtract_Clear(background, source, amount); + return PorterDuffFunctions.SubtractClear(background, source, amount); } /// @@ -3682,7 +3682,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Subtract_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.SubtractClear(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3690,17 +3690,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Screen_Clear : PixelBlender + internal class ScreenClear : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Screen_Clear Instance { get; } = new Screen_Clear(); + public static ScreenClear Instance { get; } = new ScreenClear(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Screen_Clear(background, source, amount); + return PorterDuffFunctions.ScreenClear(background, source, amount); } /// @@ -3721,7 +3721,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Screen_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.ScreenClear(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3729,17 +3729,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Darken_Clear : PixelBlender + internal class DarkenClear : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Darken_Clear Instance { get; } = new Darken_Clear(); + public static DarkenClear Instance { get; } = new DarkenClear(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Darken_Clear(background, source, amount); + return PorterDuffFunctions.DarkenClear(background, source, amount); } /// @@ -3760,7 +3760,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Darken_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.DarkenClear(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3768,17 +3768,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Lighten_Clear : PixelBlender + internal class LightenClear : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Lighten_Clear Instance { get; } = new Lighten_Clear(); + public static LightenClear Instance { get; } = new LightenClear(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Lighten_Clear(background, source, amount); + return PorterDuffFunctions.LightenClear(background, source, amount); } /// @@ -3799,7 +3799,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Lighten_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.LightenClear(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3807,17 +3807,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Overlay_Clear : PixelBlender + internal class OverlayClear : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Overlay_Clear Instance { get; } = new Overlay_Clear(); + public static OverlayClear Instance { get; } = new OverlayClear(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Overlay_Clear(background, source, amount); + return PorterDuffFunctions.OverlayClear(background, source, amount); } /// @@ -3838,7 +3838,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Overlay_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.OverlayClear(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3846,17 +3846,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class HardLight_Clear : PixelBlender + internal class HardLightClear : PixelBlender { /// /// Gets the static instance of this blender. /// - public static HardLight_Clear Instance { get; } = new HardLight_Clear(); + public static HardLightClear Instance { get; } = new HardLightClear(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.HardLight_Clear(background, source, amount); + return PorterDuffFunctions.HardLightClear(background, source, amount); } /// @@ -3877,7 +3877,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.HardLight_Clear(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.HardLightClear(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3885,17 +3885,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Normal_Xor : PixelBlender + internal class NormalXor : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Normal_Xor Instance { get; } = new Normal_Xor(); + public static NormalXor Instance { get; } = new NormalXor(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Normal_Xor(background, source, amount); + return PorterDuffFunctions.NormalXor(background, source, amount); } /// @@ -3916,7 +3916,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.NormalXor(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3924,17 +3924,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Multiply_Xor : PixelBlender + internal class MultiplyXor : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Multiply_Xor Instance { get; } = new Multiply_Xor(); + public static MultiplyXor Instance { get; } = new MultiplyXor(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Multiply_Xor(background, source, amount); + return PorterDuffFunctions.MultiplyXor(background, source, amount); } /// @@ -3955,7 +3955,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Multiply_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.MultiplyXor(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -3963,17 +3963,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Add_Xor : PixelBlender + internal class AddXor : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Add_Xor Instance { get; } = new Add_Xor(); + public static AddXor Instance { get; } = new AddXor(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Add_Xor(background, source, amount); + return PorterDuffFunctions.AddXor(background, source, amount); } /// @@ -3994,7 +3994,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Add_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.AddXor(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -4002,17 +4002,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Subtract_Xor : PixelBlender + internal class SubtractXor : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Subtract_Xor Instance { get; } = new Subtract_Xor(); + public static SubtractXor Instance { get; } = new SubtractXor(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Subtract_Xor(background, source, amount); + return PorterDuffFunctions.SubtractXor(background, source, amount); } /// @@ -4033,7 +4033,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Subtract_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.SubtractXor(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -4041,17 +4041,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Screen_Xor : PixelBlender + internal class ScreenXor : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Screen_Xor Instance { get; } = new Screen_Xor(); + public static ScreenXor Instance { get; } = new ScreenXor(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Screen_Xor(background, source, amount); + return PorterDuffFunctions.ScreenXor(background, source, amount); } /// @@ -4072,7 +4072,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Screen_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.ScreenXor(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -4080,17 +4080,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Darken_Xor : PixelBlender + internal class DarkenXor : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Darken_Xor Instance { get; } = new Darken_Xor(); + public static DarkenXor Instance { get; } = new DarkenXor(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Darken_Xor(background, source, amount); + return PorterDuffFunctions.DarkenXor(background, source, amount); } /// @@ -4111,7 +4111,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Darken_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.DarkenXor(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -4119,17 +4119,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Lighten_Xor : PixelBlender + internal class LightenXor : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Lighten_Xor Instance { get; } = new Lighten_Xor(); + public static LightenXor Instance { get; } = new LightenXor(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Lighten_Xor(background, source, amount); + return PorterDuffFunctions.LightenXor(background, source, amount); } /// @@ -4150,7 +4150,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Lighten_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.LightenXor(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -4158,17 +4158,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class Overlay_Xor : PixelBlender + internal class OverlayXor : PixelBlender { /// /// Gets the static instance of this blender. /// - public static Overlay_Xor Instance { get; } = new Overlay_Xor(); + public static OverlayXor Instance { get; } = new OverlayXor(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.Overlay_Xor(background, source, amount); + return PorterDuffFunctions.OverlayXor(background, source, amount); } /// @@ -4189,7 +4189,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Overlay_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.OverlayXor(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -4197,17 +4197,17 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati } } - internal class HardLight_Xor : PixelBlender + internal class HardLightXor : PixelBlender { /// /// Gets the static instance of this blender. /// - public static HardLight_Xor Instance { get; } = new HardLight_Xor(); + public static HardLightXor Instance { get; } = new HardLightXor(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.HardLight_Xor(background, source, amount); + return PorterDuffFunctions.HardLightXor(background, source, amount); } /// @@ -4228,7 +4228,7 @@ public override void Blend(MemoryAllocator memoryManager, Span destinati for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.HardLight_Xor(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.HardLightXor(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt index e60d8ca90a..34fe4d4cda 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt +++ b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt @@ -36,51 +36,49 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders <# string[] composers = new []{ - "Src" , - "SrcAtop" , - "SrcOver" , - "SrcIn" , - "SrcOut" , - "Dest" , - "DestAtop" , - "DestOver" , - "DestIn" , - "DestOut" , - "Clear" , - "Xor" , + "Src", + "SrcAtop", + "SrcOver", + "SrcIn", + "SrcOut", + "Dest", + "DestAtop", + "DestOver", + "DestIn", + "DestOut", + "Clear", + "Xor", }; string[] blenders = new []{ - "Normal" , - "Multiply" , - "Add" , - "Subtract" , - "Screen" , - "Darken" , - "Lighten" , - "Overlay" , + "Normal", + "Multiply", + "Add", + "Subtract", + "Screen", + "Darken", + "Lighten", + "Overlay", "HardLight" }; - - foreach(var composer in composers) { foreach(var blender in blenders) { - string blender_composer= $"{blender}_{composer}"; + string blender_composer= $"{blender}{composer}"; #> - internal class <#= blender_composer#> : PixelBlender + internal class <#= blender_composer#> : PixelBlender { /// /// Gets the static instance of this blender. /// - public static <#= blender_composer#> Instance { get; } = new <#= blender_composer#>(); + public static <#=blender_composer#> Instance { get; } = new <#=blender_composer#>(); /// public override TPixel Blend(TPixel background, TPixel source, float amount) { - return PorterDuffFunctions.<#= blender_composer#>(background, source, amount); + return PorterDuffFunctions.<#=blender_composer#>(background, source, amount); } /// @@ -101,7 +99,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.<#= blender_composer#>(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.<#=blender_composer#>(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs index b8c3faf4f5..4b0ffdd485 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs @@ -15,10 +15,9 @@ internal static partial class PorterDuffFunctions - #region Blenders [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 NormalSrc(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -27,7 +26,7 @@ public static Vector4 Normal_Src(Vector4 backdrop, Vector4 source, float opacity } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 NormalSrcAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -36,7 +35,7 @@ public static Vector4 Normal_SrcAtop(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 NormalSrcOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -45,7 +44,7 @@ public static Vector4 Normal_SrcOver(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 NormalSrcIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -54,7 +53,7 @@ public static Vector4 Normal_SrcIn(Vector4 backdrop, Vector4 source, float opaci } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 NormalSrcOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -63,13 +62,13 @@ public static Vector4 Normal_SrcOut(Vector4 backdrop, Vector4 source, float opac } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_Dest(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 NormalDest(Vector4 backdrop, Vector4 source, float opacity) { return backdrop; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 NormalDestAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -78,7 +77,7 @@ public static Vector4 Normal_DestAtop(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_DestOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 NormalDestOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -87,7 +86,7 @@ public static Vector4 Normal_DestOver(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 NormalDestIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -96,7 +95,7 @@ public static Vector4 Normal_DestIn(Vector4 backdrop, Vector4 source, float opac } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 NormalDestOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -105,7 +104,7 @@ public static Vector4 Normal_DestOut(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 NormalXor(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -114,7 +113,7 @@ public static Vector4 Normal_Xor(Vector4 backdrop, Vector4 source, float opacity } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Normal_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 NormalClear(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -124,138 +123,138 @@ public static Vector4 Normal_Clear(Vector4 backdrop, Vector4 source, float opaci [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel NormalSrc(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Normal_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(NormalSrc(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel NormalSrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Normal_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(NormalSrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel NormalSrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Normal_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(NormalSrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel NormalSrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Normal_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(NormalSrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel NormalSrcOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Normal_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(NormalSrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel NormalDest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Normal_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(NormalDest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_DestAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel NormalDestAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Normal_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(NormalDestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel NormalDestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Normal_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(NormalDestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_DestIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel NormalDestIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Normal_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(NormalDestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel NormalDestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Normal_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(NormalDestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel NormalClear(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Normal_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(NormalClear(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Normal_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel NormalXor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Normal_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(NormalXor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 MultiplySrc(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -264,7 +263,7 @@ public static Vector4 Multiply_Src(Vector4 backdrop, Vector4 source, float opaci } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 MultiplySrcAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -273,7 +272,7 @@ public static Vector4 Multiply_SrcAtop(Vector4 backdrop, Vector4 source, float o } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 MultiplySrcOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -282,7 +281,7 @@ public static Vector4 Multiply_SrcOver(Vector4 backdrop, Vector4 source, float o } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 MultiplySrcIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -291,7 +290,7 @@ public static Vector4 Multiply_SrcIn(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 MultiplySrcOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -300,13 +299,13 @@ public static Vector4 Multiply_SrcOut(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_Dest(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 MultiplyDest(Vector4 backdrop, Vector4 source, float opacity) { return backdrop; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 MultiplyDestAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -315,7 +314,7 @@ public static Vector4 Multiply_DestAtop(Vector4 backdrop, Vector4 source, float } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_DestOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 MultiplyDestOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -324,7 +323,7 @@ public static Vector4 Multiply_DestOver(Vector4 backdrop, Vector4 source, float } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 MultiplyDestIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -333,7 +332,7 @@ public static Vector4 Multiply_DestIn(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 MultiplyDestOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -342,7 +341,7 @@ public static Vector4 Multiply_DestOut(Vector4 backdrop, Vector4 source, float o } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 MultiplyXor(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -351,7 +350,7 @@ public static Vector4 Multiply_Xor(Vector4 backdrop, Vector4 source, float opaci } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Multiply_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 MultiplyClear(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -361,138 +360,138 @@ public static Vector4 Multiply_Clear(Vector4 backdrop, Vector4 source, float opa [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel MultiplySrc(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Multiply_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(MultiplySrc(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel MultiplySrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Multiply_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(MultiplySrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel MultiplySrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Multiply_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(MultiplySrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel MultiplySrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Multiply_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(MultiplySrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel MultiplySrcOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Multiply_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(MultiplySrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel MultiplyDest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Multiply_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(MultiplyDest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_DestAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel MultiplyDestAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Multiply_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(MultiplyDestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel MultiplyDestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Multiply_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(MultiplyDestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_DestIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel MultiplyDestIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Multiply_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(MultiplyDestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel MultiplyDestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Multiply_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(MultiplyDestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel MultiplyClear(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Multiply_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(MultiplyClear(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Multiply_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel MultiplyXor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Multiply_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(MultiplyXor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 AddSrc(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -501,7 +500,7 @@ public static Vector4 Add_Src(Vector4 backdrop, Vector4 source, float opacity) } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 AddSrcAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -510,7 +509,7 @@ public static Vector4 Add_SrcAtop(Vector4 backdrop, Vector4 source, float opacit } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 AddSrcOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -519,7 +518,7 @@ public static Vector4 Add_SrcOver(Vector4 backdrop, Vector4 source, float opacit } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 AddSrcIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -528,7 +527,7 @@ public static Vector4 Add_SrcIn(Vector4 backdrop, Vector4 source, float opacity) } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 AddSrcOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -537,13 +536,13 @@ public static Vector4 Add_SrcOut(Vector4 backdrop, Vector4 source, float opacity } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_Dest(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 AddDest(Vector4 backdrop, Vector4 source, float opacity) { return backdrop; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 AddDestAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -552,7 +551,7 @@ public static Vector4 Add_DestAtop(Vector4 backdrop, Vector4 source, float opaci } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_DestOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 AddDestOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -561,7 +560,7 @@ public static Vector4 Add_DestOver(Vector4 backdrop, Vector4 source, float opaci } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 AddDestIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -570,7 +569,7 @@ public static Vector4 Add_DestIn(Vector4 backdrop, Vector4 source, float opacity } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 AddDestOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -579,7 +578,7 @@ public static Vector4 Add_DestOut(Vector4 backdrop, Vector4 source, float opacit } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 AddXor(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -588,7 +587,7 @@ public static Vector4 Add_Xor(Vector4 backdrop, Vector4 source, float opacity) } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Add_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 AddClear(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -598,138 +597,138 @@ public static Vector4 Add_Clear(Vector4 backdrop, Vector4 source, float opacity) [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel AddSrc(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Add_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(AddSrc(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel AddSrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Add_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(AddSrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel AddSrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Add_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(AddSrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel AddSrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Add_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(AddSrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel AddSrcOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Add_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(AddSrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel AddDest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Add_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(AddDest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_DestAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel AddDestAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Add_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(AddDestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel AddDestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Add_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(AddDestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_DestIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel AddDestIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Add_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(AddDestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel AddDestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Add_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(AddDestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel AddClear(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Add_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(AddClear(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Add_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel AddXor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Add_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(AddXor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SubtractSrc(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -738,7 +737,7 @@ public static Vector4 Subtract_Src(Vector4 backdrop, Vector4 source, float opaci } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SubtractSrcAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -747,7 +746,7 @@ public static Vector4 Subtract_SrcAtop(Vector4 backdrop, Vector4 source, float o } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SubtractSrcOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -756,7 +755,7 @@ public static Vector4 Subtract_SrcOver(Vector4 backdrop, Vector4 source, float o } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SubtractSrcIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -765,7 +764,7 @@ public static Vector4 Subtract_SrcIn(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SubtractSrcOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -774,13 +773,13 @@ public static Vector4 Subtract_SrcOut(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_Dest(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SubtractDest(Vector4 backdrop, Vector4 source, float opacity) { return backdrop; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SubtractDestAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -789,7 +788,7 @@ public static Vector4 Subtract_DestAtop(Vector4 backdrop, Vector4 source, float } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_DestOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SubtractDestOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -798,7 +797,7 @@ public static Vector4 Subtract_DestOver(Vector4 backdrop, Vector4 source, float } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SubtractDestIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -807,7 +806,7 @@ public static Vector4 Subtract_DestIn(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SubtractDestOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -816,7 +815,7 @@ public static Vector4 Subtract_DestOut(Vector4 backdrop, Vector4 source, float o } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SubtractXor(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -825,7 +824,7 @@ public static Vector4 Subtract_Xor(Vector4 backdrop, Vector4 source, float opaci } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Subtract_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 SubtractClear(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -835,138 +834,138 @@ public static Vector4 Subtract_Clear(Vector4 backdrop, Vector4 source, float opa [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel SubtractSrc(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Subtract_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(SubtractSrc(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel SubtractSrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Subtract_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(SubtractSrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel SubtractSrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Subtract_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(SubtractSrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel SubtractSrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Subtract_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(SubtractSrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel SubtractSrcOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Subtract_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(SubtractSrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel SubtractDest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Subtract_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(SubtractDest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_DestAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel SubtractDestAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Subtract_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(SubtractDestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel SubtractDestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Subtract_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(SubtractDestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_DestIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel SubtractDestIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Subtract_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(SubtractDestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel SubtractDestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Subtract_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(SubtractDestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel SubtractClear(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Subtract_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(SubtractClear(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Subtract_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel SubtractXor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Subtract_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(SubtractXor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 ScreenSrc(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -975,7 +974,7 @@ public static Vector4 Screen_Src(Vector4 backdrop, Vector4 source, float opacity } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 ScreenSrcAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -984,7 +983,7 @@ public static Vector4 Screen_SrcAtop(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 ScreenSrcOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -993,7 +992,7 @@ public static Vector4 Screen_SrcOver(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 ScreenSrcIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1002,7 +1001,7 @@ public static Vector4 Screen_SrcIn(Vector4 backdrop, Vector4 source, float opaci } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 ScreenSrcOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1011,13 +1010,13 @@ public static Vector4 Screen_SrcOut(Vector4 backdrop, Vector4 source, float opac } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_Dest(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 ScreenDest(Vector4 backdrop, Vector4 source, float opacity) { return backdrop; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 ScreenDestAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1026,7 +1025,7 @@ public static Vector4 Screen_DestAtop(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_DestOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 ScreenDestOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1035,7 +1034,7 @@ public static Vector4 Screen_DestOver(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 ScreenDestIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1044,7 +1043,7 @@ public static Vector4 Screen_DestIn(Vector4 backdrop, Vector4 source, float opac } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 ScreenDestOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1053,7 +1052,7 @@ public static Vector4 Screen_DestOut(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 ScreenXor(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1062,7 +1061,7 @@ public static Vector4 Screen_Xor(Vector4 backdrop, Vector4 source, float opacity } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Screen_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 ScreenClear(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1072,138 +1071,138 @@ public static Vector4 Screen_Clear(Vector4 backdrop, Vector4 source, float opaci [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel ScreenSrc(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Screen_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(ScreenSrc(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel ScreenSrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Screen_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(ScreenSrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel ScreenSrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Screen_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(ScreenSrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel ScreenSrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Screen_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(ScreenSrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel ScreenSrcOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Screen_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(ScreenSrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel ScreenDest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Screen_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(ScreenDest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_DestAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel ScreenDestAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Screen_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(ScreenDestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel ScreenDestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Screen_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(ScreenDestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_DestIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel ScreenDestIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Screen_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(ScreenDestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel ScreenDestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Screen_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(ScreenDestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel ScreenClear(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Screen_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(ScreenClear(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Screen_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel ScreenXor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Screen_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(ScreenXor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DarkenSrc(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1212,7 +1211,7 @@ public static Vector4 Darken_Src(Vector4 backdrop, Vector4 source, float opacity } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DarkenSrcAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1221,7 +1220,7 @@ public static Vector4 Darken_SrcAtop(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DarkenSrcOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1230,7 +1229,7 @@ public static Vector4 Darken_SrcOver(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DarkenSrcIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1239,7 +1238,7 @@ public static Vector4 Darken_SrcIn(Vector4 backdrop, Vector4 source, float opaci } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DarkenSrcOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1248,13 +1247,13 @@ public static Vector4 Darken_SrcOut(Vector4 backdrop, Vector4 source, float opac } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_Dest(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DarkenDest(Vector4 backdrop, Vector4 source, float opacity) { return backdrop; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DarkenDestAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1263,7 +1262,7 @@ public static Vector4 Darken_DestAtop(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_DestOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DarkenDestOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1272,7 +1271,7 @@ public static Vector4 Darken_DestOver(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DarkenDestIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1281,7 +1280,7 @@ public static Vector4 Darken_DestIn(Vector4 backdrop, Vector4 source, float opac } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DarkenDestOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1290,7 +1289,7 @@ public static Vector4 Darken_DestOut(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DarkenXor(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1299,7 +1298,7 @@ public static Vector4 Darken_Xor(Vector4 backdrop, Vector4 source, float opacity } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Darken_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 DarkenClear(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1309,138 +1308,138 @@ public static Vector4 Darken_Clear(Vector4 backdrop, Vector4 source, float opaci [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel DarkenSrc(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Darken_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(DarkenSrc(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel DarkenSrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Darken_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(DarkenSrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel DarkenSrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Darken_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(DarkenSrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel DarkenSrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Darken_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(DarkenSrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel DarkenSrcOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Darken_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(DarkenSrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel DarkenDest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Darken_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(DarkenDest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_DestAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel DarkenDestAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Darken_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(DarkenDestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel DarkenDestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Darken_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(DarkenDestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_DestIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel DarkenDestIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Darken_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(DarkenDestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel DarkenDestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Darken_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(DarkenDestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel DarkenClear(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Darken_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(DarkenClear(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Darken_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel DarkenXor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Darken_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(DarkenXor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 LightenSrc(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1449,7 +1448,7 @@ public static Vector4 Lighten_Src(Vector4 backdrop, Vector4 source, float opacit } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 LightenSrcAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1458,7 +1457,7 @@ public static Vector4 Lighten_SrcAtop(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 LightenSrcOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1467,7 +1466,7 @@ public static Vector4 Lighten_SrcOver(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 LightenSrcIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1476,7 +1475,7 @@ public static Vector4 Lighten_SrcIn(Vector4 backdrop, Vector4 source, float opac } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 LightenSrcOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1485,13 +1484,13 @@ public static Vector4 Lighten_SrcOut(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_Dest(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 LightenDest(Vector4 backdrop, Vector4 source, float opacity) { return backdrop; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 LightenDestAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1500,7 +1499,7 @@ public static Vector4 Lighten_DestAtop(Vector4 backdrop, Vector4 source, float o } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_DestOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 LightenDestOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1509,7 +1508,7 @@ public static Vector4 Lighten_DestOver(Vector4 backdrop, Vector4 source, float o } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 LightenDestIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1518,7 +1517,7 @@ public static Vector4 Lighten_DestIn(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 LightenDestOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1527,7 +1526,7 @@ public static Vector4 Lighten_DestOut(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 LightenXor(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1536,7 +1535,7 @@ public static Vector4 Lighten_Xor(Vector4 backdrop, Vector4 source, float opacit } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Lighten_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 LightenClear(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1546,138 +1545,138 @@ public static Vector4 Lighten_Clear(Vector4 backdrop, Vector4 source, float opac [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel LightenSrc(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Lighten_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(LightenSrc(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel LightenSrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Lighten_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(LightenSrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel LightenSrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Lighten_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(LightenSrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel LightenSrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Lighten_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(LightenSrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel LightenSrcOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Lighten_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(LightenSrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel LightenDest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Lighten_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(LightenDest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_DestAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel LightenDestAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Lighten_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(LightenDestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel LightenDestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Lighten_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(LightenDestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_DestIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel LightenDestIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Lighten_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(LightenDestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel LightenDestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Lighten_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(LightenDestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel LightenClear(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Lighten_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(LightenClear(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Lighten_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel LightenXor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Lighten_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(LightenXor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 OverlaySrc(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1686,7 +1685,7 @@ public static Vector4 Overlay_Src(Vector4 backdrop, Vector4 source, float opacit } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 OverlaySrcAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1695,7 +1694,7 @@ public static Vector4 Overlay_SrcAtop(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 OverlaySrcOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1704,7 +1703,7 @@ public static Vector4 Overlay_SrcOver(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 OverlaySrcIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1713,7 +1712,7 @@ public static Vector4 Overlay_SrcIn(Vector4 backdrop, Vector4 source, float opac } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 OverlaySrcOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1722,13 +1721,13 @@ public static Vector4 Overlay_SrcOut(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_Dest(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 OverlayDest(Vector4 backdrop, Vector4 source, float opacity) { return backdrop; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 OverlayDestAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1737,7 +1736,7 @@ public static Vector4 Overlay_DestAtop(Vector4 backdrop, Vector4 source, float o } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_DestOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 OverlayDestOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1746,7 +1745,7 @@ public static Vector4 Overlay_DestOver(Vector4 backdrop, Vector4 source, float o } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 OverlayDestIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1755,7 +1754,7 @@ public static Vector4 Overlay_DestIn(Vector4 backdrop, Vector4 source, float opa } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 OverlayDestOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1764,7 +1763,7 @@ public static Vector4 Overlay_DestOut(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 OverlayXor(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1773,7 +1772,7 @@ public static Vector4 Overlay_Xor(Vector4 backdrop, Vector4 source, float opacit } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 Overlay_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 OverlayClear(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1783,138 +1782,138 @@ public static Vector4 Overlay_Clear(Vector4 backdrop, Vector4 source, float opac [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel OverlaySrc(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Overlay_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(OverlaySrc(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel OverlaySrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Overlay_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(OverlaySrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel OverlaySrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Overlay_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(OverlaySrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel OverlaySrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Overlay_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(OverlaySrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel OverlaySrcOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Overlay_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(OverlaySrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel OverlayDest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Overlay_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(OverlayDest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_DestAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel OverlayDestAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Overlay_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(OverlayDestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel OverlayDestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Overlay_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(OverlayDestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_DestIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel OverlayDestIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Overlay_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(OverlayDestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel OverlayDestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Overlay_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(OverlayDestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel OverlayClear(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Overlay_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(OverlayClear(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel Overlay_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel OverlayXor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(Overlay_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(OverlayXor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLightSrc(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1923,7 +1922,7 @@ public static Vector4 HardLight_Src(Vector4 backdrop, Vector4 source, float opac } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLightSrcAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1932,7 +1931,7 @@ public static Vector4 HardLight_SrcAtop(Vector4 backdrop, Vector4 source, float } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLightSrcOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1941,7 +1940,7 @@ public static Vector4 HardLight_SrcOver(Vector4 backdrop, Vector4 source, float } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLightSrcIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1950,7 +1949,7 @@ public static Vector4 HardLight_SrcIn(Vector4 backdrop, Vector4 source, float op } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLightSrcOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1959,13 +1958,13 @@ public static Vector4 HardLight_SrcOut(Vector4 backdrop, Vector4 source, float o } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_Dest(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLightDest(Vector4 backdrop, Vector4 source, float opacity) { return backdrop; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLightDestAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1974,7 +1973,7 @@ public static Vector4 HardLight_DestAtop(Vector4 backdrop, Vector4 source, float } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_DestOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLightDestOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1983,7 +1982,7 @@ public static Vector4 HardLight_DestOver(Vector4 backdrop, Vector4 source, float } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLightDestIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -1992,7 +1991,7 @@ public static Vector4 HardLight_DestIn(Vector4 backdrop, Vector4 source, float o } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLightDestOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -2001,7 +2000,7 @@ public static Vector4 HardLight_DestOut(Vector4 backdrop, Vector4 source, float } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLightXor(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -2010,7 +2009,7 @@ public static Vector4 HardLight_Xor(Vector4 backdrop, Vector4 source, float opac } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 HardLight_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 HardLightClear(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -2020,136 +2019,134 @@ public static Vector4 HardLight_Clear(Vector4 backdrop, Vector4 source, float op [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_Src(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLightSrc(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(HardLight_Src(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(HardLightSrc(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_SrcAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLightSrcAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(HardLight_SrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(HardLightSrcAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_SrcOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLightSrcOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(HardLight_SrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(HardLightSrcOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_SrcIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLightSrcIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(HardLight_SrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(HardLightSrcIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_SrcOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLightSrcOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(HardLight_SrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(HardLightSrcOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_Dest(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLightDest(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(HardLight_Dest(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(HardLightDest(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_DestAtop(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLightDestAtop(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(HardLight_DestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(HardLightDestAtop(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_DestOver(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLightDestOver(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(HardLight_DestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(HardLightDestOver(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_DestIn(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLightDestIn(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(HardLight_DestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(HardLightDestIn(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_DestOut(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLightDestOut(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(HardLight_DestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(HardLightDestOut(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_Clear(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLightClear(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(HardLight_Clear(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(HardLightClear(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel HardLight_Xor(TPixel backdrop, TPixel source, float opacity) + public static TPixel HardLightXor(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(HardLight_Xor(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(HardLightXor(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } - - #endregion } } \ No newline at end of file diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt index 3045b1e81c..5e46a89a85 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.tt @@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders <# void GeneratePixelBlenders(string blender) { #> [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_Src(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=blender#>Src(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -34,7 +34,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_SrcAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=blender#>SrcAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -43,7 +43,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_SrcOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=blender#>SrcOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -52,7 +52,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_SrcIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=blender#>SrcIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_SrcOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=blender#>SrcOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -70,13 +70,13 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_Dest(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=blender#>Dest(Vector4 backdrop, Vector4 source, float opacity) { return backdrop; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_DestAtop(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=blender#>DestAtop(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -85,7 +85,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_DestOver(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=blender#>DestOver(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -94,7 +94,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_DestIn(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=blender#>DestIn(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -103,7 +103,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_DestOut(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=blender#>DestOut(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -112,7 +112,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_Xor(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=blender#>Xor(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -121,7 +121,7 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vector4 <#=blender#>_Clear(Vector4 backdrop, Vector4 source, float opacity) + public static Vector4 <#=blender#>Clear(Vector4 backdrop, Vector4 source, float opacity) { opacity = opacity.Clamp(0, 1); source.W *= opacity; @@ -134,43 +134,42 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders <# void GenerateGenericPixelBlender(string blender, string composer) { #> [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TPixel <#=blender#>_<#=composer#>(TPixel backdrop, TPixel source, float opacity) + public static TPixel <#=blender#><#=composer#>(TPixel backdrop, TPixel source, float opacity) where TPixel : struct, IPixel { TPixel dest = default; - dest.PackFromVector4(<#=blender#>_<#=composer#>(backdrop.ToVector4(),source.ToVector4(),opacity)); + dest.PackFromVector4(<#=blender#><#=composer#>(backdrop.ToVector4(),source.ToVector4(),opacity)); return dest; } <# } #> - #region Blenders <# string[] composers = new []{ - "Src" , - "SrcAtop" , - "SrcOver" , - "SrcIn" , - "SrcOut" , - "Dest" , - "DestAtop" , - "DestOver" , - "DestIn" , - "DestOut" , - "Clear" , - "Xor" , + "Src", + "SrcAtop", + "SrcOver", + "SrcIn", + "SrcOut", + "Dest", + "DestAtop", + "DestOver", + "DestIn", + "DestOut", + "Clear", + "Xor", }; string[] blenders = new []{ - "Normal" , - "Multiply" , - "Add" , - "Subtract" , - "Screen" , - "Darken" , - "Lighten" , - "Overlay" , + "Normal", + "Multiply", + "Add", + "Subtract", + "Screen", + "Darken", + "Lighten", + "Overlay", "HardLight" }; @@ -185,7 +184,5 @@ string[] blenders = new []{ } #> - - #endregion } } \ No newline at end of file diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs index c84cd9a7b1..e10c8fe918 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.cs @@ -156,7 +156,7 @@ private static float OverlayValueFunction(float backdrop, float source) /// Desired transformed color, without taking Alpha channel in account /// The final color [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Vector4 SrcOver_Reference(Vector4 backdrop, Vector4 source, Vector4 xform) + private static Vector4 SrcOverReference(Vector4 backdrop, Vector4 source, Vector4 xform) { // calculate weights float xw = backdrop.W * source.W; diff --git a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.PixelBenders.cs b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.PixelBenders.cs index ad9366bc52..ca6a28192d 100644 --- a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.PixelBenders.cs +++ b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.PixelBenders.cs @@ -20,30 +20,30 @@ internal virtual PixelBlender GetPixelBlender(PixelBlenderMode mode) { switch (mode) { - case PixelBlenderMode.Multiply: return DefaultPixelBlenders.Multiply_SrcOver.Instance; - case PixelBlenderMode.Add: return DefaultPixelBlenders.Add_SrcOver.Instance; - case PixelBlenderMode.Subtract: return DefaultPixelBlenders.Subtract_SrcOver.Instance; - case PixelBlenderMode.Screen: return DefaultPixelBlenders.Screen_SrcOver.Instance; - case PixelBlenderMode.Darken: return DefaultPixelBlenders.Darken_SrcOver.Instance; - case PixelBlenderMode.Lighten: return DefaultPixelBlenders.Lighten_SrcOver.Instance; - case PixelBlenderMode.Overlay: return DefaultPixelBlenders.Overlay_SrcOver.Instance; - case PixelBlenderMode.HardLight: return DefaultPixelBlenders.HardLight_SrcOver.Instance; - case PixelBlenderMode.Src: return DefaultPixelBlenders.Normal_Src.Instance; - case PixelBlenderMode.Atop: return DefaultPixelBlenders.Normal_SrcAtop.Instance; - case PixelBlenderMode.Over: return DefaultPixelBlenders.Normal_SrcOver.Instance; - case PixelBlenderMode.In: return DefaultPixelBlenders.Normal_SrcIn.Instance; - case PixelBlenderMode.Out: return DefaultPixelBlenders.Normal_SrcOut.Instance; - case PixelBlenderMode.Dest: return DefaultPixelBlenders.Normal_Dest.Instance; - case PixelBlenderMode.DestAtop: return DefaultPixelBlenders.Normal_DestAtop.Instance; - case PixelBlenderMode.DestOver: return DefaultPixelBlenders.Normal_DestOver.Instance; - case PixelBlenderMode.DestIn: return DefaultPixelBlenders.Normal_DestIn.Instance; - case PixelBlenderMode.DestOut: return DefaultPixelBlenders.Normal_DestOut.Instance; - case PixelBlenderMode.Clear: return DefaultPixelBlenders.Normal_Clear.Instance; - case PixelBlenderMode.Xor: return DefaultPixelBlenders.Normal_Xor.Instance; + case PixelBlenderMode.Multiply: return DefaultPixelBlenders.MultiplySrcOver.Instance; + case PixelBlenderMode.Add: return DefaultPixelBlenders.AddSrcOver.Instance; + case PixelBlenderMode.Subtract: return DefaultPixelBlenders.SubtractSrcOver.Instance; + case PixelBlenderMode.Screen: return DefaultPixelBlenders.ScreenSrcOver.Instance; + case PixelBlenderMode.Darken: return DefaultPixelBlenders.DarkenSrcOver.Instance; + case PixelBlenderMode.Lighten: return DefaultPixelBlenders.LightenSrcOver.Instance; + case PixelBlenderMode.Overlay: return DefaultPixelBlenders.OverlaySrcOver.Instance; + case PixelBlenderMode.HardLight: return DefaultPixelBlenders.HardLightSrcOver.Instance; + case PixelBlenderMode.Src: return DefaultPixelBlenders.NormalSrc.Instance; + case PixelBlenderMode.Atop: return DefaultPixelBlenders.NormalSrcAtop.Instance; + case PixelBlenderMode.Over: return DefaultPixelBlenders.NormalSrcOver.Instance; + case PixelBlenderMode.In: return DefaultPixelBlenders.NormalSrcIn.Instance; + case PixelBlenderMode.Out: return DefaultPixelBlenders.NormalSrcOut.Instance; + case PixelBlenderMode.Dest: return DefaultPixelBlenders.NormalDest.Instance; + case PixelBlenderMode.DestAtop: return DefaultPixelBlenders.NormalDestAtop.Instance; + case PixelBlenderMode.DestOver: return DefaultPixelBlenders.NormalDestOver.Instance; + case PixelBlenderMode.DestIn: return DefaultPixelBlenders.NormalDestIn.Instance; + case PixelBlenderMode.DestOut: return DefaultPixelBlenders.NormalDestOut.Instance; + case PixelBlenderMode.Clear: return DefaultPixelBlenders.NormalClear.Instance; + case PixelBlenderMode.Xor: return DefaultPixelBlenders.NormalXor.Instance; case PixelBlenderMode.Normal: default: - return DefaultPixelBlenders.Normal_SrcOver.Instance; + return DefaultPixelBlenders.NormalSrcOver.Instance; } } } diff --git a/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs b/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs index a70d9fc11e..3133e0b366 100644 --- a/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs +++ b/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs @@ -37,7 +37,7 @@ private void BulkVectorConvert(Span destination, Span ba for (int i = 0; i < destination.Length; i++) { - destinationSpan[i] = PorterDuffFunctions.Normal_SrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); + destinationSpan[i] = PorterDuffFunctions.NormalSrcOver(backgroundSpan[i], sourceSpan[i], amount[i]); } PixelOperations.Instance.PackFromVector4(destinationSpan, destination, destination.Length); @@ -52,7 +52,7 @@ private void BulkPixelConvert(Span destination, Span bac for (int i = 0; i < destination.Length; i++) { - destination[i] = PorterDuffFunctions.Normal_SrcOver(destination[i], source[i], amount[i]); + destination[i] = PorterDuffFunctions.NormalSrcOver(destination[i], source[i], amount[i]); } } diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs index c34bdc56e4..9a196d9d5b 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs @@ -1,10 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using System; -using System.Collections.Generic; using System.Numerics; -using System.Text; using SixLabors.ImageSharp.PixelFormats.PixelBlenders; using SixLabors.ImageSharp.Tests.TestUtilities; using Xunit; @@ -22,7 +19,7 @@ public class PorterDuffFunctionsTests [MemberData(nameof(NormalBlendFunctionData))] public void NormalBlendFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Normal_SrcOver((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.NormalSrcOver((Vector4)back, source, amount); Assert.Equal(expected, actual); } @@ -41,7 +38,7 @@ public void NormalBlendFunction(TestVector4 back, TestVector4 source, float amou [MemberData(nameof(MultiplyFunctionData))] public void MultiplyFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Multiply_SrcOver((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.MultiplySrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -60,7 +57,7 @@ public void MultiplyFunction(TestVector4 back, TestVector4 source, float amount, [MemberData(nameof(AddFunctionData))] public void AddFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Multiply_SrcOver((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.MultiplySrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -79,7 +76,7 @@ public void AddFunction(TestVector4 back, TestVector4 source, float amount, Test [MemberData(nameof(SubstractFunctionData))] public void SubstractFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Subtract_SrcOver((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.SubtractSrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -98,7 +95,7 @@ public void SubstractFunction(TestVector4 back, TestVector4 source, float amount [MemberData(nameof(ScreenFunctionData))] public void ScreenFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Screen_SrcOver((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.ScreenSrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -117,7 +114,7 @@ public void ScreenFunction(TestVector4 back, TestVector4 source, float amount, T [MemberData(nameof(DarkenFunctionData))] public void DarkenFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Darken_SrcOver((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.DarkenSrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -136,7 +133,7 @@ public void DarkenFunction(TestVector4 back, TestVector4 source, float amount, T [MemberData(nameof(LightenFunctionData))] public void LightenFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Lighten_SrcOver((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.LightenSrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -155,7 +152,7 @@ public void LightenFunction(TestVector4 back, TestVector4 source, float amount, [MemberData(nameof(OverlayFunctionData))] public void OverlayFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.Overlay_SrcOver((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.OverlaySrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } @@ -174,7 +171,7 @@ public void OverlayFunction(TestVector4 back, TestVector4 source, float amount, [MemberData(nameof(HardLightFunctionData))] public void HardLightFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) { - Vector4 actual = PorterDuffFunctions.HardLight_SrcOver((Vector4)back, source, amount); + Vector4 actual = PorterDuffFunctions.HardLightSrcOver((Vector4)back, source, amount); VectorAssert.Equal(expected, actual, 5); } } diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs index a53591dbc2..3ea9bcad40 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs @@ -2,9 +2,6 @@ // Licensed under the Apache License, Version 2.0. using System; -using System.Collections.Generic; -using System.Numerics; -using System.Text; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats.PixelBlenders; using SixLabors.ImageSharp.Tests.TestUtilities; @@ -14,7 +11,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders { using SixLabors.Memory; - public class PorterDuffFunctionsTests_TPixel + public class PorterDuffFunctionsTestsTPixel { private static Span AsSpan(T value) where T : struct @@ -34,26 +31,26 @@ private static Span AsSpan(T value) public void NormalBlendFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Normal_SrcOver((TPixel)(TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.NormalSrcOver((TPixel)(TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(NormalBlendFunctionData))] - public void NormalBlendFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void NormalBlendFunctionBlender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Normal_SrcOver().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.NormalSrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(NormalBlendFunctionData))] - public void NormalBlendFunction_Blender_Bulk(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void NormalBlendFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Normal_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + var dest = new Span(new TPixel[1]); + new DefaultPixelBlenders.NormalSrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -73,26 +70,26 @@ public void NormalBlendFunction_Blender_Bulk(TestPixel back, Tes public void MultiplyFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Multiply_SrcOver((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.MultiplySrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(MultiplyFunctionData))] - public void MultiplyFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void MultiplyFunctionBlender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Multiply_SrcOver().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.MultiplySrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(MultiplyFunctionData))] - public void MultiplyFunction_Blender_Bulk(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void MultiplyFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Multiply_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + var dest = new Span(new TPixel[1]); + new DefaultPixelBlenders.MultiplySrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -112,26 +109,26 @@ public void MultiplyFunction_Blender_Bulk(TestPixel back, TestPi public void AddFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Add_SrcOver((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.AddSrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(AddFunctionData))] - public void AddFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void AddFunctionBlender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Add_SrcOver().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.AddSrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(AddFunctionData))] - public void AddFunction_Blender_Bulk(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void AddFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Add_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + var dest = new Span(new TPixel[1]); + new DefaultPixelBlenders.AddSrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -151,26 +148,26 @@ public void AddFunction_Blender_Bulk(TestPixel back, TestPixel(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Subtract_SrcOver((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.SubtractSrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(SubstractFunctionData))] - public void SubstractFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void SubstractFunctionBlender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Subtract_SrcOver().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.SubtractSrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(SubstractFunctionData))] - public void SubstractFunction_Blender_Bulk(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void SubstractFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Subtract_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + var dest = new Span(new TPixel[1]); + new DefaultPixelBlenders.SubtractSrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -190,26 +187,26 @@ public void SubstractFunction_Blender_Bulk(TestPixel back, TestP public void ScreenFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Screen_SrcOver((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.ScreenSrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(ScreenFunctionData))] - public void ScreenFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void ScreenFunctionBlender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Screen_SrcOver().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.ScreenSrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(ScreenFunctionData))] - public void ScreenFunction_Blender_Bulk(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void ScreenFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Screen_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + var dest = new Span(new TPixel[1]); + new DefaultPixelBlenders.ScreenSrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -229,26 +226,26 @@ public void ScreenFunction_Blender_Bulk(TestPixel back, TestPixe public void DarkenFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Darken_SrcOver((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.DarkenSrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(DarkenFunctionData))] - public void DarkenFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void DarkenFunctionBlender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Darken_SrcOver().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.DarkenSrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(DarkenFunctionData))] - public void DarkenFunction_Blender_Bulk(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void DarkenFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Darken_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + var dest = new Span(new TPixel[1]); + new DefaultPixelBlenders.DarkenSrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -268,26 +265,26 @@ public void DarkenFunction_Blender_Bulk(TestPixel back, TestPixe public void LightenFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Lighten_SrcOver((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.LightenSrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(LightenFunctionData))] - public void LightenFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void LightenFunctionBlender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Lighten_SrcOver().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.LightenSrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(LightenFunctionData))] - public void LightenFunction_Blender_Bulk(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void LightenFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Lighten_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + var dest = new Span(new TPixel[1]); + new DefaultPixelBlenders.LightenSrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -307,26 +304,26 @@ public void LightenFunction_Blender_Bulk(TestPixel back, TestPix public void OverlayFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.Overlay_SrcOver((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.OverlaySrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(OverlayFunctionData))] - public void OverlayFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void OverlayFunctionBlender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.Overlay_SrcOver().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.OverlaySrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(OverlayFunctionData))] - public void OverlayFunction_Blender_Bulk(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void OverlayFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.Overlay_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + var dest = new Span(new TPixel[1]); + new DefaultPixelBlenders.OverlaySrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } @@ -346,26 +343,26 @@ public void OverlayFunction_Blender_Bulk(TestPixel back, TestPix public void HardLightFunction(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = PorterDuffFunctions.HardLight_SrcOver((TPixel)back, source, amount); + TPixel actual = PorterDuffFunctions.HardLightSrcOver((TPixel)back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(HardLightFunctionData))] - public void HardLightFunction_Blender(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void HardLightFunctionBlender(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - TPixel actual = new DefaultPixelBlenders.HardLight_SrcOver().Blend(back, source, amount); + TPixel actual = new DefaultPixelBlenders.HardLightSrcOver().Blend(back, source, amount); VectorAssert.Equal(expected, actual, 2); } [Theory] [MemberData(nameof(HardLightFunctionData))] - public void HardLightFunction_Blender_Bulk(TestPixel back, TestPixel source, float amount, TestPixel expected) + public void HardLightFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : struct, IPixel { - Span dest = new Span(new TPixel[1]); - new DefaultPixelBlenders.HardLight_SrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); + var dest = new Span(new TPixel[1]); + new DefaultPixelBlenders.HardLightSrcOver().Blend(this.MemoryAllocator, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected, dest[0], 2); } } diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.Blender.cs b/tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.Blender.cs index 1a4121c974..3923a56752 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.Blender.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.Blender.cs @@ -17,50 +17,50 @@ public class PixelBlenderTests public static TheoryData BlenderMappings = new TheoryData() { - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcOver), PixelBlenderMode.Normal }, - { new TestPixel(), typeof(DefaultPixelBlenders.Screen_SrcOver), PixelBlenderMode.Screen }, - { new TestPixel(), typeof(DefaultPixelBlenders.HardLight_SrcOver), PixelBlenderMode.HardLight }, - { new TestPixel(), typeof(DefaultPixelBlenders.Overlay_SrcOver), PixelBlenderMode.Overlay }, - { new TestPixel(), typeof(DefaultPixelBlenders.Darken_SrcOver), PixelBlenderMode.Darken }, - { new TestPixel(), typeof(DefaultPixelBlenders.Lighten_SrcOver), PixelBlenderMode.Lighten }, - { new TestPixel(), typeof(DefaultPixelBlenders.Add_SrcOver), PixelBlenderMode.Add }, - { new TestPixel(), typeof(DefaultPixelBlenders.Subtract_SrcOver), PixelBlenderMode.Subtract }, - { new TestPixel(), typeof(DefaultPixelBlenders.Multiply_SrcOver), PixelBlenderMode.Multiply }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalSrcOver), PixelBlenderMode.Normal }, + { new TestPixel(), typeof(DefaultPixelBlenders.ScreenSrcOver), PixelBlenderMode.Screen }, + { new TestPixel(), typeof(DefaultPixelBlenders.HardLightSrcOver), PixelBlenderMode.HardLight }, + { new TestPixel(), typeof(DefaultPixelBlenders.OverlaySrcOver), PixelBlenderMode.Overlay }, + { new TestPixel(), typeof(DefaultPixelBlenders.DarkenSrcOver), PixelBlenderMode.Darken }, + { new TestPixel(), typeof(DefaultPixelBlenders.LightenSrcOver), PixelBlenderMode.Lighten }, + { new TestPixel(), typeof(DefaultPixelBlenders.AddSrcOver), PixelBlenderMode.Add }, + { new TestPixel(), typeof(DefaultPixelBlenders.SubtractSrcOver), PixelBlenderMode.Subtract }, + { new TestPixel(), typeof(DefaultPixelBlenders.MultiplySrcOver), PixelBlenderMode.Multiply }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Src), PixelBlenderMode.Src }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcAtop), PixelBlenderMode.Atop }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcOver), PixelBlenderMode.Over }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcIn), PixelBlenderMode.In }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcOut), PixelBlenderMode.Out }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Dest), PixelBlenderMode.Dest }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestAtop), PixelBlenderMode.DestAtop }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestOver), PixelBlenderMode.DestOver }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestIn), PixelBlenderMode.DestIn }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestOut), PixelBlenderMode.DestOut }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Clear), PixelBlenderMode.Clear }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Xor), PixelBlenderMode.Xor }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalSrc), PixelBlenderMode.Src }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalSrcAtop), PixelBlenderMode.Atop }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalSrcOver), PixelBlenderMode.Over }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalSrcIn), PixelBlenderMode.In }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalSrcOut), PixelBlenderMode.Out }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalDest), PixelBlenderMode.Dest }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalDestAtop), PixelBlenderMode.DestAtop }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalDestOver), PixelBlenderMode.DestOver }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalDestIn), PixelBlenderMode.DestIn }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalDestOut), PixelBlenderMode.DestOut }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalClear), PixelBlenderMode.Clear }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalXor), PixelBlenderMode.Xor }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcOver), PixelBlenderMode.Normal }, - { new TestPixel(), typeof(DefaultPixelBlenders.Screen_SrcOver), PixelBlenderMode.Screen }, - { new TestPixel(), typeof(DefaultPixelBlenders.HardLight_SrcOver), PixelBlenderMode.HardLight }, - { new TestPixel(), typeof(DefaultPixelBlenders.Overlay_SrcOver), PixelBlenderMode.Overlay }, - { new TestPixel(), typeof(DefaultPixelBlenders.Darken_SrcOver), PixelBlenderMode.Darken }, - { new TestPixel(), typeof(DefaultPixelBlenders.Lighten_SrcOver), PixelBlenderMode.Lighten }, - { new TestPixel(), typeof(DefaultPixelBlenders.Add_SrcOver), PixelBlenderMode.Add }, - { new TestPixel(), typeof(DefaultPixelBlenders.Subtract_SrcOver), PixelBlenderMode.Subtract }, - { new TestPixel(), typeof(DefaultPixelBlenders.Multiply_SrcOver), PixelBlenderMode.Multiply }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Src), PixelBlenderMode.Src }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcAtop), PixelBlenderMode.Atop }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcOver), PixelBlenderMode.Over }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcIn), PixelBlenderMode.In }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_SrcOut), PixelBlenderMode.Out }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Dest), PixelBlenderMode.Dest }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestAtop), PixelBlenderMode.DestAtop }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestOver), PixelBlenderMode.DestOver }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestIn), PixelBlenderMode.DestIn }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_DestOut), PixelBlenderMode.DestOut }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Clear), PixelBlenderMode.Clear }, - { new TestPixel(), typeof(DefaultPixelBlenders.Normal_Xor), PixelBlenderMode.Xor }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalSrcOver), PixelBlenderMode.Normal }, + { new TestPixel(), typeof(DefaultPixelBlenders.ScreenSrcOver), PixelBlenderMode.Screen }, + { new TestPixel(), typeof(DefaultPixelBlenders.HardLightSrcOver), PixelBlenderMode.HardLight }, + { new TestPixel(), typeof(DefaultPixelBlenders.OverlaySrcOver), PixelBlenderMode.Overlay }, + { new TestPixel(), typeof(DefaultPixelBlenders.DarkenSrcOver), PixelBlenderMode.Darken }, + { new TestPixel(), typeof(DefaultPixelBlenders.LightenSrcOver), PixelBlenderMode.Lighten }, + { new TestPixel(), typeof(DefaultPixelBlenders.AddSrcOver), PixelBlenderMode.Add }, + { new TestPixel(), typeof(DefaultPixelBlenders.SubtractSrcOver), PixelBlenderMode.Subtract }, + { new TestPixel(), typeof(DefaultPixelBlenders.MultiplySrcOver), PixelBlenderMode.Multiply }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalSrc), PixelBlenderMode.Src }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalSrcAtop), PixelBlenderMode.Atop }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalSrcOver), PixelBlenderMode.Over }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalSrcIn), PixelBlenderMode.In }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalSrcOut), PixelBlenderMode.Out }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalDest), PixelBlenderMode.Dest }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalDestAtop), PixelBlenderMode.DestAtop }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalDestOver), PixelBlenderMode.DestOver }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalDestIn), PixelBlenderMode.DestIn }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalDestOut), PixelBlenderMode.DestOut }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalClear), PixelBlenderMode.Clear }, + { new TestPixel(), typeof(DefaultPixelBlenders.NormalXor), PixelBlenderMode.Xor }, }; From 74a16f1083b8cb1578f4e16920eda1c665fa83ff Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sun, 19 Aug 2018 10:09:26 +0100 Subject: [PATCH 10/10] Update refs and fix line endings --- .../Drawing/SolidFillBlendedShapesTests.cs | 302 +++++++++--------- tests/Images/External | 2 +- 2 files changed, 152 insertions(+), 152 deletions(-) diff --git a/tests/ImageSharp.Tests/Drawing/SolidFillBlendedShapesTests.cs b/tests/ImageSharp.Tests/Drawing/SolidFillBlendedShapesTests.cs index 7ec63c4397..b31a18ac45 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidFillBlendedShapesTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidFillBlendedShapesTests.cs @@ -1,158 +1,158 @@ -// Copyright (c) Six Labors and contributors. -// Licensed under the Apache License, Version 2.0. -using System; -using System.Collections.Generic; -using System.Linq; -using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; -using SixLabors.Primitives; -using Xunit; - -// ReSharper disable InconsistentNaming -namespace SixLabors.ImageSharp.Tests.Drawing -{ - [GroupOutput("Drawing")] - public class SolidFillBlendedShapesTests - { - public static IEnumerable modes = - ((PixelBlenderMode[])Enum.GetValues(typeof(PixelBlenderMode))).Select(x => new object[] { x }); - - [Theory] - [WithBlankImages(nameof(modes), 250, 250, PixelTypes.Rgba32)] - public void _1DarkBlueRect_2BlendHotPinkRect( - TestImageProvider provider, - PixelBlenderMode mode) - where TPixel : struct, IPixel - { - using (Image img = provider.GetImage()) - { - int scaleX = img.Width / 100; - int scaleY = img.Height / 100; - img.Mutate( - x => x.Fill( - NamedColors.DarkBlue, - new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY) - ) - .Fill(new GraphicsOptions(true) { BlenderMode = mode }, - NamedColors.HotPink, - new Rectangle(20 * scaleX, 0 * scaleY, 30 * scaleX, 100 * scaleY)) - ); - - VerifyImage(provider, mode, img); - } - } - - [Theory] - [WithBlankImages(nameof(modes), 250, 250, PixelTypes.Rgba32)] - public void _1DarkBlueRect_2BlendHotPinkRect_3BlendTransparentEllipse( - TestImageProvider provider, - PixelBlenderMode mode) - where TPixel : struct, IPixel - { - using (Image img = provider.GetImage()) - { - int scaleX = img.Width / 100; - int scaleY = img.Height / 100; - img.Mutate( - x => x.Fill( - NamedColors.DarkBlue, - new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY))); - img.Mutate( - x => x.Fill( - new GraphicsOptions(true) { BlenderMode = mode }, - NamedColors.HotPink, - new Rectangle(20 * scaleX, 0 * scaleY, 30 * scaleX, 100 * scaleY))); - img.Mutate( - x => x.Fill( - new GraphicsOptions(true) { BlenderMode = mode }, - NamedColors.Transparent, - new Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY)) - ); - - VerifyImage(provider, mode, img); - } - } - - [Theory] - [WithBlankImages(nameof(modes), 250, 250, PixelTypes.Rgba32)] - public void _1DarkBlueRect_2BlendHotPinkRect_3BlendSemiTransparentRedEllipse( - TestImageProvider provider, - PixelBlenderMode mode) - where TPixel : struct, IPixel - { - using (Image img = provider.GetImage()) - { - int scaleX = (img.Width / 100); - int scaleY = (img.Height / 100); - img.Mutate( - x => x.Fill( - NamedColors.DarkBlue, - new Rectangle(0 * scaleX, 40, 100 * scaleX, 20 * scaleY))); - img.Mutate( - x => x.Fill( - new GraphicsOptions(true) { BlenderMode = mode }, - NamedColors.HotPink, - new Rectangle(20 * scaleX, 0, 30 * scaleX, 100 * scaleY))); - var c = NamedColors.Red.ToVector4(); - c.W *= 0.5f; - var pixel = default(TPixel); - pixel.PackFromVector4(c); - - img.Mutate( - x => x.Fill( - new GraphicsOptions(true) { BlenderMode = mode }, - pixel, - new Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY)) - ); - - VerifyImage(provider, mode, img); ; - } - } - - [Theory] - [WithBlankImages(nameof(modes), 250, 250, PixelTypes.Rgba32)] - public void _1DarkBlueRect_2BlendBlackEllipse(TestImageProvider provider, PixelBlenderMode mode) - where TPixel : struct, IPixel - { - using(Image dstImg = provider.GetImage(), srcImg = provider.GetImage()) - { - int scaleX = (dstImg.Width / 100); +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. +using System; +using System.Collections.Generic; +using System.Linq; +using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; +using SixLabors.Primitives; +using Xunit; + +// ReSharper disable InconsistentNaming +namespace SixLabors.ImageSharp.Tests.Drawing +{ + [GroupOutput("Drawing")] + public class SolidFillBlendedShapesTests + { + public static IEnumerable modes = + ((PixelBlenderMode[])Enum.GetValues(typeof(PixelBlenderMode))).Select(x => new object[] { x }); + + [Theory] + [WithBlankImages(nameof(modes), 250, 250, PixelTypes.Rgba32)] + public void _1DarkBlueRect_2BlendHotPinkRect( + TestImageProvider provider, + PixelBlenderMode mode) + where TPixel : struct, IPixel + { + using (Image img = provider.GetImage()) + { + int scaleX = img.Width / 100; + int scaleY = img.Height / 100; + img.Mutate( + x => x.Fill( + NamedColors.DarkBlue, + new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY) + ) + .Fill(new GraphicsOptions(true) { BlenderMode = mode }, + NamedColors.HotPink, + new Rectangle(20 * scaleX, 0 * scaleY, 30 * scaleX, 100 * scaleY)) + ); + + VerifyImage(provider, mode, img); + } + } + + [Theory] + [WithBlankImages(nameof(modes), 250, 250, PixelTypes.Rgba32)] + public void _1DarkBlueRect_2BlendHotPinkRect_3BlendTransparentEllipse( + TestImageProvider provider, + PixelBlenderMode mode) + where TPixel : struct, IPixel + { + using (Image img = provider.GetImage()) + { + int scaleX = img.Width / 100; + int scaleY = img.Height / 100; + img.Mutate( + x => x.Fill( + NamedColors.DarkBlue, + new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY))); + img.Mutate( + x => x.Fill( + new GraphicsOptions(true) { BlenderMode = mode }, + NamedColors.HotPink, + new Rectangle(20 * scaleX, 0 * scaleY, 30 * scaleX, 100 * scaleY))); + img.Mutate( + x => x.Fill( + new GraphicsOptions(true) { BlenderMode = mode }, + NamedColors.Transparent, + new Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY)) + ); + + VerifyImage(provider, mode, img); + } + } + + [Theory] + [WithBlankImages(nameof(modes), 250, 250, PixelTypes.Rgba32)] + public void _1DarkBlueRect_2BlendHotPinkRect_3BlendSemiTransparentRedEllipse( + TestImageProvider provider, + PixelBlenderMode mode) + where TPixel : struct, IPixel + { + using (Image img = provider.GetImage()) + { + int scaleX = (img.Width / 100); + int scaleY = (img.Height / 100); + img.Mutate( + x => x.Fill( + NamedColors.DarkBlue, + new Rectangle(0 * scaleX, 40, 100 * scaleX, 20 * scaleY))); + img.Mutate( + x => x.Fill( + new GraphicsOptions(true) { BlenderMode = mode }, + NamedColors.HotPink, + new Rectangle(20 * scaleX, 0, 30 * scaleX, 100 * scaleY))); + var c = NamedColors.Red.ToVector4(); + c.W *= 0.5f; + var pixel = default(TPixel); + pixel.PackFromVector4(c); + + img.Mutate( + x => x.Fill( + new GraphicsOptions(true) { BlenderMode = mode }, + pixel, + new Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY)) + ); + + VerifyImage(provider, mode, img); ; + } + } + + [Theory] + [WithBlankImages(nameof(modes), 250, 250, PixelTypes.Rgba32)] + public void _1DarkBlueRect_2BlendBlackEllipse(TestImageProvider provider, PixelBlenderMode mode) + where TPixel : struct, IPixel + { + using(Image dstImg = provider.GetImage(), srcImg = provider.GetImage()) + { + int scaleX = (dstImg.Width / 100); int scaleY = (dstImg.Height / 100); - - dstImg.Mutate( - x => x.Fill( - NamedColors.DarkBlue, + + dstImg.Mutate( + x => x.Fill( + NamedColors.DarkBlue, new Rectangle(0 * scaleX, 40 * scaleY, 100 * scaleX, 20 * scaleY))); - - srcImg.Mutate( - x => x.Fill( - NamedColors.Black, + + srcImg.Mutate( + x => x.Fill( + NamedColors.Black, new Shapes.EllipsePolygon(40 * scaleX, 50 * scaleY, 50 * scaleX, 50 * scaleY))); dstImg.Mutate( x => x.DrawImage(new GraphicsOptions(true) { BlenderMode = mode }, srcImg) - ); - - VerifyImage(provider, mode, dstImg); - } - } - - private static void VerifyImage(TestImageProvider provider, PixelBlenderMode mode, Image img) - where TPixel : struct, IPixel - { - img.DebugSave( - provider, - new { mode }, - appendPixelTypeToFileName: false, - appendSourceFileOrDescription: false); - - var comparer = ImageComparer.TolerantPercentage(0.01f, 3); - img.CompareFirstFrameToReferenceOutput(comparer, - provider, - new { mode }, - appendPixelTypeToFileName: false, - appendSourceFileOrDescription: false); - } - } + ); + + VerifyImage(provider, mode, dstImg); + } + } + + private static void VerifyImage(TestImageProvider provider, PixelBlenderMode mode, Image img) + where TPixel : struct, IPixel + { + img.DebugSave( + provider, + new { mode }, + appendPixelTypeToFileName: false, + appendSourceFileOrDescription: false); + + var comparer = ImageComparer.TolerantPercentage(0.01f, 3); + img.CompareFirstFrameToReferenceOutput(comparer, + provider, + new { mode }, + appendPixelTypeToFileName: false, + appendSourceFileOrDescription: false); + } + } } \ No newline at end of file diff --git a/tests/Images/External b/tests/Images/External index 98fb7e2e4d..825220cdc4 160000 --- a/tests/Images/External +++ b/tests/Images/External @@ -1 +1 @@ -Subproject commit 98fb7e2e4d5935b1c733bd2b206b6145b71ef378 +Subproject commit 825220cdc4e9d1b4b3b474c63139e18e1cdb800e