/*
 * class JpgWriter
 *
 * $Date$
 * $Revision$
 *
 */

#ifndef JPG_WRITER_HH__
#define JPG_WRITER_HH__

#include "WImage/PixmapWriter.hh"

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

/**
 * A JPG image file writer. Dimensions are known from the {\em Image}
 * object. Only JPG version 6 is supported.
 */
class 
JpgWriter: public PixmapWriter
{
public:
  
  /** Constructor. Only calls the mother class' constructor to initialize
   * the {\em ImageArray} reference and set the offset if necessary. 
   * @param name
   * the file name
   * @param images
   * the array of greyscale images for the values  
   * @param colors 
   * the number of colors
   * @param quality 
   * the JPEG quality */
  JpgWriter (char const *name, Image *images[], 
             int colors = 3, int quality = 90)
    : PixmapWriter (name, images, colors) { m_quality = quality; }

protected: 
  /** Write a JPG image file. This is the method that does the actual
   * work. It will be called by the {\em write ()} method.
   * @return 
   * 0 if successful, -1 on write error. */
  virtual int writefmt (void);
  /** The JPEG quality factor */
  int m_quality;
  
}; /* class JpgWriter */

/** @} */

#endif /* JPG_WRITER_HH__ */
