Calculate Color Chromaticity - CSharp System.Drawing

CSharp examples for System.Drawing:Color

Description

Calculate Color Chromaticity

Demo Code


using System.Drawing;
using System;/*w ww .  ja va 2s .  c o m*/

public class Main{
        public static float CalculateChromaticity(this Color fc)
        {
            var rg = Math.Abs(fc.R - fc.G);
            var gb = Math.Abs(fc.G - fc.B);
            var rb = Math.Abs(fc.R - fc.B);
            return Math.Max(rg, Math.Max(gb, rb)) / 255.0f;
        }
}

Related Tutorials