Ejemplo n.º 1
0
        public static int Compare(Lab a, IColorSpaceComparison comp, List <Lab> cols, float threshold = Int32.MaxValue)
        {
            int Minimum = 0;

            double min  = comp.Compare(a, cols[0]);
            double temp = Int32.MaxValue;

            for (int z = 1; z < cols.Count; z++)
            {
                temp = comp.Compare(cols[z], a);
                if (min > temp)
                {
                    min     = temp;
                    Minimum = z;
                }
            }

            //if (min > threshold) MessageBox.Show("Der Grenzwert von " + threshold + "wurde überschritten (" + min + "). \nFarbwert im Originalbild: (" + original.R + "; " + original.G + "; " + original.B + "), "
            //    + "\nNächste Farbe: Farbname: " + farben.Einstellung[Minimum].Farbname + ", Farbwert: (" + farben.Einstellung[Minimum].RGBwert.R + "; " + farben.Einstellung[Minimum].RGBwert.G + "; " +
            //    farben.Einstellung[Minimum].RGBwert.B + ").");
            return(Minimum);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Convienience method for comparing any IColorSpace
 /// </summary>
 /// <param name="compareToValue"></param>
 /// <param name="comparer"></param>
 /// <returns>Single number representing the difference between two colors</returns>
 public double Compare(IColorSpace compareToValue, IColorSpaceComparison comparer)
 {
     return(comparer.Compare(this, compareToValue));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Convienience method for comparing any IColorSpace
 /// </summary>
 /// <param name="compareToValue"></param>
 /// <param name="comparer"></param>
 /// <returns>Single number representing the difference between two colors</returns>
 public double Compare(IColorSpace compareToValue, IColorSpaceComparison comparer)
 {
     return(comparer.Compare(this.To <Lab>(), compareToValue.To <Lab>()));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Convienience method for comparing any IColorSpace
 /// </summary>
 /// <param name="compareToValue"></param>
 /// <param name="comparer"></param>
 /// <returns>Single number representing the difference between two colors</returns>
 public static double Compare(this IColorSpace space, IColorSpace compareToValue, IColorSpaceComparison comparer)
 {
     return(comparer.Compare(space, compareToValue));
 }