aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/Colourful/Implementation/Conversion/HunterLab/XYZAndHunterLabConverterBase.cs
blob: 2193ff75d231c21cec2ea8e35a098ba0bbd12a51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
namespace Colourful.Implementation.Conversion
{
    /// <summary>
    /// Base class for converters between XYZ and Hunter Lab
    /// </summary>
    public abstract class XYZAndHunterLabConverterBase
    {
        /// <summary>
        /// Computes the Ka parameter
        /// </summary>
        protected static double ComputeKa(XYZColor whitePoint)
        {
            if (whitePoint == Illuminants.C)
                return 175;

            var Ka = 100 * (175 / 198.04) * (whitePoint.X + whitePoint.Y);
            return Ka;
        }

        /// <summary>
        /// Computes the Kb parameter
        /// </summary>
        protected static double ComputeKb(XYZColor whitePoint)
        {
            if (whitePoint == Illuminants.C)
                return 70;

            var Ka = 100 * (70 / 218.11) * (whitePoint.Y + whitePoint.Z);
            return Ka;
        }
    }
}