예제 #1
0
파일: SxzColor.cs 프로젝트: jubalh/Sxz
        public static double GetColorDistance(SxzColor source, SxzColor target)
        {
            if (source.Equals(target)) {
                return 0.0d;
            }

            double red = source.Red - target.Red;
            double green = source.Green - target.Green;
            double blue = source.Blue - target.Blue;
            return Math.Sqrt(red * red + blue * blue + green * green);
        }
예제 #2
0
        private double FindNearestDistance(SxzColor target)
        {
            double result = double.MaxValue;
            foreach (SxzColor color in Colors)
            {
                if (target.Equals(color))
                {
                    continue;
                }

                double distance = SxzColor.GetColorDistance(target, color);
                if (distance < result)
                {
                    result = distance;
                }
            }

            return result;
        }
예제 #3
0
 public void SetColor(SxzColor color, int x, int y)
 {
     if (color.Equals(Black))
     {
         BitPlane.UnDrawLocation(x - Origin.X, y - Origin.Y);
     }
     else
     {
         BitPlane.DrawLocation(x - Origin.X, y - Origin.Y);
     }
 }