/*
 * Image.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 IMAGE_H
#define IMAGE_H

#include "ImageDataSink.h"
#define USE_FIXED_POINT
#include "fixed.h"

/**
  *@author Thorsten Scheuermann
  */

class QDirectPainter;

class Image : public ImageDataSink
{
public:
	Image();
	Image(int width, int height);
	virtual ~Image();

	inline int width();
	inline int height();

  void paint(QDirectPainter *painter, int screenXOff, int screenYOff,
             int imgXOff, int imgYOff);

	virtual void setImageDimension(int w, int h);
	virtual void setNumImageChannels(int c);
	virtual void startImage();
	virtual void endImage();
	virtual void imageRow(unsigned char *rowData);
	virtual void imageRow(fixed *rowData);

  void imageRow(int row, unsigned char *rowData);
  void imageRow(int row, fixed *rowData);
  void imageRowReverse(int row, unsigned char *rowData);
  void imageRowReverse(int row, fixed *rowData);

  void imageColumn(int col, unsigned char *colData);
  void imageColumn(int col, fixed *colData);
  void imageColumnReverse(int col, unsigned char *colData);
  void imageColumnReverse(int col, fixed *colData);

protected:
	int w;
	int h;
	int rowSize;
	int newWidth;
	int newHeight;
	int rowCounter;
	int columnCounter;
	unsigned short *imgData;
};

inline int Image::width()
{
	return w;
}

inline int Image::height()
{
	return h;
}

#endif
