/*
 * class PixmapFile
 *
 * $Date$
 * $Revision$
 *
 */

#ifndef PIXMAP_FILE_HH__
#define PIXMAP_FILE_HH__

#include "WImage/Image.hh"
#include "WImage/miscdefs.h"

/**
 * @addtogroup WImage
 * @{ */

/**
 * An abstract image file. A framework to create readers and writers on
 * any color images.
 */
/*abstract*/
class
PixmapFile
{
public:

  /** Constructor. Initializes internal fields and gets an {\em ImageArray}
   * object that may already contain an image or will get one later.
   * @param name
   * the file name
   * @param images
   * the array of greyscale images for the values
   * @param channels
   * the number of colors */
  PixmapFile (char const *name, Image *images[], int channels);

  /** Destructor. Releases some memory. */
  virtual ~PixmapFile (void);

  /** Returns the current color model.
   * @return the current color model */
  inline clrmodel colormodel (void) { return m_cmodel; }
  /** Sets a new color model.
   * @param cm the new color model */
  inline void colormodel (clrmodel cm) { m_cmodel = cm; }

  /** Return the number of channels.
   * @return the number of channels */
  inline int channels (void) const { return m_channels; }

protected:

  /** The color channels. */
  Image **m_images;
  /** The number of channels (usually: colors). */
  int m_channels;
  /** The file name. The name of the file associated with this object. */
  char const * m_fname;
  /* The way the current image's colors are encoded. */
  clrmodel m_cmodel;

  /** internal initialization */
  void init (Image *images[]);
}; /* class PixmapFile */

/** @} */

#endif /* PIXMAP_FILE_HH__ */
