diff --git a/src/ImageSharp/Colors/Vector4BlendTransforms.cs b/src/ImageSharp/Colors/Vector4BlendTransforms.cs index 870d653888..ad69f7bcbe 100644 --- a/src/ImageSharp/Colors/Vector4BlendTransforms.cs +++ b/src/ImageSharp/Colors/Vector4BlendTransforms.cs @@ -7,6 +7,7 @@ namespace ImageSharp { using System; using System.Numerics; + using Common; /// /// Transform algorithms that match the equations defined in the W3C Compositing and Blending Level 1 specification. @@ -14,11 +15,6 @@ namespace ImageSharp /// public class Vector4BlendTransforms { - /// - /// The epsilon for comparing floating point numbers. - /// - private const float Epsilon = 0.0001F; - /// /// The blending formula simply selects the source vector. /// @@ -203,13 +199,13 @@ namespace ImageSharp amount = amount.Clamp(0, 1); // Santize on zero alpha - if (Math.Abs(backdrop.W) < Epsilon) + if (Math.Abs(backdrop.W) < Constants.Epsilon) { source.W *= amount; return source; } - if (Math.Abs(source.W) < Epsilon) + if (Math.Abs(source.W) < Constants.Epsilon) { return backdrop; } @@ -266,7 +262,7 @@ namespace ImageSharp /// private static float BlendDodge(float b, float s) { - return Math.Abs(s - 1F) < Epsilon ? s : Math.Min(b / (1F - s), 1F); + return Math.Abs(s - 1F) < Constants.Epsilon ? s : Math.Min(b / (1F - s), 1F); } /// @@ -279,7 +275,7 @@ namespace ImageSharp /// private static float BlendBurn(float b, float s) { - return Math.Abs(s) < Epsilon ? s : Math.Max(1F - ((1F - b) / s), 0F); + return Math.Abs(s) < Constants.Epsilon ? s : Math.Max(1F - ((1F - b) / s), 0F); } ///