private void createColorMap()
  {
    colors = new HashMap<Integer, Color>();

    if (input != null)
    {
      int height = input.getHeight(),
          width = input.getWidth();

      for (int y = 0; y < height; y++)
      {
        for (int x = 0; x < width; x++)
        {
          int color = input.getRGB(x, y);

          if (!colors.containsKey(color))
            colors.put(color, new Color(color));
        }
      }
    }
  }