#ifndef _OF_IMAGE_H_
#define _OF_IMAGE_H_

#include "ofConstants.h"
#include "ofTexture.h"
#include "ofGraphics.h"
#include "ofUtils.h"

#define OF_IMAGE_GRAYSCALE		0x00
#define OF_IMAGE_COLOR			0x01
#define OF_IMAGE_COLOR_ALPHA	0x02
#define OF_IMAGE_UNDEFINED		0x03

//-------------------------
// forward class declaration, something 
// we will need in order to compile "OF" as a lib
// so that you don't need freeImage, quicktime, etc..
class 	freeImageBitmap;
//-------------------------

class 	ofImage {

	public :
		
		ofImage();
				
		void 				loadImage(char * fileName);
		void 				saveImage(char * fileName);
		void 				allocate(int w, int h, int type); 
		
		unsigned char * 	getPixels();			// up to you to get this right	
		void 				setImageType(int type);
		void 				resize(int newWidth, int newHeight);
		void 				grabScreen(int x, int y, int w, int h);		// grab pixels from opengl, using glreadpixels
		
		int 				type;			// what type of image it is (as above)
		int 				width, height, bpp;		// w,h, bits per pixel
		
		void 				setUseTexture(bool bUse);
		void 				draw(float x, float y, float w, float h);	
		void 				draw(float x, float y);	
		
	private:	
		
		void 				swapChannels(bool bAlpha);
		void 				update();
		freeImageBitmap 	* IMG;	
		ofTexture 			tex;
		bool				bUseTexture;	
		bool				bAllocatedPixels;
		
}; 



#endif
