#ifndef _CV_COLOR_ALPHA_IMAGE_H
#define _CV_COLOR_ALPHA_IMAGE_H


//----------------
#include "ofMain.h"
#include "ofCvConstants.h"

class ofCvColorImage;			// forward declaration
class ofCvGrayscaleImage;


//------------------------------------
class ofCvColorAlphaImage {

	public:

		ofCvColorAlphaImage();
		
		
		void allocate(int _w, int _h);
		void clear();
		void setFromPixels(unsigned char * _pixels, int w, int h);
		
		// access
		unsigned char 	* getPixels();
		IplImage 		* getCvImage(){ return cvImage;};

		// set
		//void set			(unsigned char value [4]);
		void set			(ofCvColorImage mom, ofCvGrayscaleImage momsAlpha);
		void setAlpha		(ofCvGrayscaleImage momsAlpha);
		
		// copy
		void copyWithMask	(ofCvColorAlphaImage mom, ofCvGrayscaleImage momsMask);
		void copyChannelTo  (int channel, ofCvGrayscaleImage mom);
		
		// operators
		void operator =		( const ofCvColorAlphaImage & mom );
		void operator =		( ofCvGrayscaleImage 		& mom );
		void operator =		( ofCvColorImage 			& mom );
		
		
		// other transformations
		void scale					(ofCvColorAlphaImage & mom);
		void blur					();	
		//void blend			(ofCvColorAlphaImage & mom,  IppiAlphaType alphaType);
		
		
		// draw
		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
