package yi.iu.processor.color;

import java.util.*;
import java.io.Serializable;

public class DS_DominantColor implements Serializable{
  /**
   * Dominant Colors in Lab color space
   */
  ArrayList m_dominantColors;
  /**
   * Pixel-Dominant Color mapping.  If a pixel can't be mapped, it takes the
   * "length of m_colorMap".  (because m_colorMap is 0 based, so no dominant
   * color corresponds to "length of m_colorMap"
   */
  int[]    m_colorMap;
  /**
   * image width
   */
  int      m_width;
  /**
   * image height
   */
  int      m_height;

  public DS_DominantColor() {};

  public DS_DominantColor(double[][] dominant_colors,
    int[] color_map, int width, int height) {
      m_colorMap = color_map;
      m_width = width;
      m_height = height;
      m_dominantColors = new ArrayList(dominant_colors.length);
      for (int i=0; i<dominant_colors.length; i++) {
        m_dominantColors.add(new CIELab(dominant_colors[i][0],
          dominant_colors[i][1],dominant_colors[i][2]));
      }
  }

  public int[] getColorMap() {
    return m_colorMap;
  }

  public Collection getDominantColors() {
    return m_dominantColors;
  }

  public void setDominantColors(Collection a) {
    m_dominantColors = (ArrayList)a;
  }
}