/*
 * class PixmapReader
 *
 * $Date$
 * $Revision$
 *
 */

#ifndef PIXMAP_READER_HH__
#define PIXMAP_READER_HH__

#include "WImage/PixmapFile.hh"
#include <fstream>

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

/**
 * An abstract color image reader. The image is being read putting its
 * color channels into separate greyscale image objects.
 */
/*abstract*/
class
PixmapReader: public PixmapFile
{
public:

  /** Constructor. Only calls the mother class' constructor to initialize
   * the {\em ImageArray} reference.
   * @param name
   * the file name
   * @param images
   * the array of greyscale images for the values
   * @param channels
   * the number of colors */
  PixmapReader (char const *name, Image *images[], int channels)
    : PixmapFile (name, images, channels) {}

  /** Destructor - does nothing. */
  virtual ~PixmapReader (void) {}

  /** Read the image. All steps independent of the file format will be
   * performed, like testing for file readability etc.
   * @exception invalid_argument
   * invalid file format
   * @exception ios_base::failure
   * a read error has occured [not supported by all libraries, so eventually
   * {\em invalid_argument} instead] */
  virtual void read (void);

protected:
  /** Read different file formats (abstract). This is the method to be
   * implemented for every image file format. It will be called by the
   * {\em read ()} method.
   * @return
   * 0 if successful, -1 on read error, -2 on file format error. */
  virtual int readfmt (void) = 0;

}; /* class PixmapReader */

/** @} */

#endif /* PIXMAP_READER_HH__ */
