Ejemplo n.º 1
0
        private Swatch GetMaxScoredSwatchForTarget(Target target)
        {
            float  maxScore       = 0;
            Swatch maxScoreSwatch = null;

            for (int i = 0, count = mSwatches.Count; i < count; i++)
            {
                Swatch swatch = mSwatches[i];
                if (ShouldBeScoredForTarget(swatch, target))
                {
                    float score = GenerateScore(swatch, target);
                    if (maxScoreSwatch == null || score > maxScore)
                    {
                        maxScoreSwatch = swatch;
                        maxScore       = score;
                    }
                }
            }
            return(maxScoreSwatch);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the selected color for the given target from the palette as an RGB packed int.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="defaultColor"></param>
        /// <returns></returns>
        public int GetColorForTarget(Target target, int defaultColor = DefaultColorValue)
        {
            Swatch swatch = GetSwatchForTarget(target);

            return(swatch != null?swatch.GetRgb() : defaultColor);
        }
Ejemplo n.º 3
0
 private bool ShouldIgnoreColor(Swatch color)
 {
     return(ShouldIgnoreColor(color.GetRgb(), color.GetHsl()));
 }