public static int DoFullCompare(int R1, int G1, int B1, int R2, int G2, int B2) { ColorFormulas oColor1 = new ColorFormulas(R1, G1, B1); ColorFormulas oColor2 = new ColorFormulas(R2, G2, B2); return(oColor1.CompareTo(oColor2)); }
/// /// The smaller the number returned by this, the closer the colors are /// /// /// public int CompareTo(ColorFormulas oComparisionColor) { // Based upon the Delta-E (1976) formula at easyrgb.com (http://www.easyrgb.com/index.php?X=DELT&H=03#text3) //double DeltaE = Math.Sqrt(Math.Pow((CieL - oComparisionColor.CieL), 2) + Math.Pow((CieA - oComparisionColor.CieA), 2) + Math.Pow((CieB - oComparisionColor.CieB), 2)); double DeltaE = Math.Pow((CieL - oComparisionColor.CieL), 2) + Math.Pow((CieA - oComparisionColor.CieA), 2) + Math.Pow((CieB - oComparisionColor.CieB), 2); return(Convert.ToInt32(Math.Round(DeltaE))); }