www.pudn.com > Gimcrack-v0.0051-Source.zip > bitmap.h


#ifndef _GCBITMAP_H_ 
#define _GCBITMAP_H_ 
 
#include "loader.h" 
 
/* NOTE: The screenBpp does nothing in this loader, */ 
/* it's just the for compability with CTarga		*/ 
 
class GcBitmap : public GcLoader 
{ 
public: 
	// Constructor/Destructor 
	GcBitmap(); 
	~GcBitmap(); 
 
	// Load bitmap from file 
	bool Load(char *fileName); 
 
	// Write bitmap to file 
	bool Write(char *fileName, uint width, uint height, uint screenBpp = 0); 
 
	// Take a screenshot 
	/* WARNING! DO NOT USE THIS IF THE BITMAP ARE TO BE USED FURTHER ON */ 
	void Screenshot(char *fileName, uint winWidth, uint winHeight, uint screenBpp = 0); 
 
	// Draw the bitmap 
	void Draw(uint xPos, uint yPos); 
 
	// Height/Width/Size 
	uint Height() { return bitmapInfoHeader.biHeight; } 
	uint Width()  { return bitmapInfoHeader.biWidth; } 
	byte Bpp()	  { return (byte)bitmapInfoHeader.biBitCount; }		 
	uint Size()	  { return bitmapInfoHeader.biSizeImage; } 
 
	// Image 
	byte *Image() { return bitmapImage; } 
	byte Image(int index) { return bitmapImage[index]; } 
 
	// Destroy 
	void Destroy(); 
 
private: 
	BITMAPFILEHEADER	bitmapFileHeader;	// Bitmap file header 
	BITMAPINFOHEADER	bitmapInfoHeader;	// Bitmpa info header 
	byte				*bitmapImage;		// The image 
	int					colorMode;			// 1 == 8 bit, 2 == 16, 3 == RGB 4 == RGBA 
	byte				tempRGB;			// Swap variable 
}; 
 
#endif