/*
 * JPEGReader.h
 *
 * (c) 2002 by Thorsten Scheuermann <tscheuermann@gmx.net>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifndef JPEGREADER_H
#define JPEGREADER_H

#include "ImageReader.h"

#include <stdio.h>
extern "C" {
#define XMD_H   // get around typedef mismatch between libjpeg and Qt
#include <jpeglib.h>
#ifdef const
#undef const
#endif
}

/**
  *@author Thorsten Scheuermann
  */

class JPEGReader : public ImageReader
{
public:
	JPEGReader(const char *fileName);
	virtual ~JPEGReader();

	virtual const char *type();
	virtual int imageWidth();
  virtual int imageHeight();
	virtual void readImageData();

	void setScaling(int denom);
	
protected:
	FILE *jpegFile;
	struct jpeg_decompress_struct cinfo;
	struct jpeg_error_mgr jerr;
	int scaleDenom;
};

#endif
