#ifndef _CV_FLOAT_IMAGE_H
#define _CV_FLOAT_IMAGE_H


#include "ofMain.h"
#include "ofCvConstants.h"


class ofCvColorImage;			// forward declaration
class ofCvGrayscaleImage;

//------------------------------------
class ofCvFloatImage {

	public:

		ofCvFloatImage();
		void allocate(int _w, int _h);
		void clear();
		void setFromPixels(unsigned char * _pixels, int w, int h);
		void setFromGrayscaleImage(ofCvGrayscaleImage & mom);

		void copySubImageIntoMe( ofCvGrayscaleImage & mom, int x, int y, int w, int h);
		
		void setGrayscaleImage(ofCvGrayscaleImage & mom);
		
		// singular (internal) operations:
		void set(int value);
		
		void blur();
	    void addWeighted( ofCvGrayscaleImage mom, float f);
	    
		// operators ------------------------------
		void operator =		( ofCvFloatImage & mom );
		void operator -=	( ofCvFloatImage & mom );
		void operator +=	( ofCvFloatImage & mom );
		void operator +=	( ofCvGrayscaleImage & mom );
		void operator *=	( ofCvFloatImage & mom );

		void operator -=	( float scalar );
		void operator +=	( float scalar );
		
		
		// ----------------------------------------

		
		unsigned char 	* getPixels();
		IplImage 		* getCvImage(){ return cvImage;};

		void 			draw(float x, float y);

		int 			width, height;

	private:

		//----------------------------
		// internal functionality
		// we will use two iplImages internally, since many of the
		// operations expect a "src" and a "swap"
		//----------------------------

		IplImage		* 	cvImage;
		IplImage		* 	cvImageTemp;
		void 			swapTemp();		// make the "dst" image the current "src" image

		unsigned char 	* 	pixels;		// not width stepped
		ofTexture 			tex;		// internal tex

};



#endif
