package yi.iu.ft;

/**
 * <p>Title: Color Image Feature</p>
 * <p>Description: A color Image Feature can be the mean color of an image or of
 * a image region.  It is in the format of (R,G,B)</p>
 * <p>Copyright: Copyright (c) 2002</p>
 * <p>Company: University of Washington</p>
 * @author Yi Li
 * @version 1.0
 */

public class IFColor extends ImageFeature {

  int m_rgb;

  public IFColor(int rgb) {
    m_rgb = rgb;
  }

  public IFColor(int r, int g, int b) {
    m_rgb = 0xff000000 | r << 16 | g << 8 | b;
  }

  /**
   * Return a interger to represent the Color in RGB format
   *
   * @return
   */
  public int getRGB() {
    return m_rgb;
  }

  public String toString() {
    return new String(
      "<IFColor R=\"" + (m_rgb >> 16 & 0xff) +
            "\" G=\"" + (m_rgb >>  8 & 0xff) +
            "\" B=\"" + (m_rgb & 0xff) +
            "\"/>\n");
  }
}