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); }
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; }
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); } }