www.pudn.com > dither.rar > bitmap.h


// bitmap.h: interface for the Cbitmap class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_BITMAP_H__FF54C51C_27E5_4F31_B254_911D0A67E93A__INCLUDED_) 
#define AFX_BITMAP_H__FF54C51C_27E5_4F31_B254_911D0A67E93A__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
#include "windows.h" 
#include "stdio.h" 
#include "iostream" 
using namespace std; 
#define SafeDelArray(p) {if(p)delete[]p;p=NULL;} 
 
class Cbitmap   
{ 
public: 
	Cbitmap(); 
	virtual ~Cbitmap(); 
public: 
	void rgb2gray(); 
	int Dither(); 
	int SaveBmp(const char*); 
	int LoadBmp(const char*); 
	BITMAPFILEHEADER m_bmfheader;						//文件头 
	BITMAPINFOHEADER m_bmiheader;						//信息头 
	RGBQUAD *m_prgbquad;								//调色板的首地址索引值 
	unsigned char *m_pSrcBits;							//24位数据区的首地址 
	unsigned char *m_pGray;								//转化成灰度图后的数据 
	int m_PalleteSize;								//调色板索引数 
	int m_width;										//图像的宽度 
	int m_height;										//图像的高度 
}; 
 
#endif // !defined(AFX_BITMAP_H__FF54C51C_27E5_4F31_B254_911D0A67E93A__INCLUDED_)