www.pudn.com > 毕业留念册.rar > Dib.h


// Dib.h: interface for the CDib class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_DIB_H__CB411887_24E6_4B66_87FF_1D7063FB8CD7__INCLUDED_) 
#define AFX_DIB_H__CB411887_24E6_4B66_87FF_1D7063FB8CD7__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#define HDIB HANDLE 
#define DIB_HEADER_MARKER   ((WORD) ('M' << 8) | 'B') 
#define   IS_WIN30_DIB(lpbi) \ 
		((*(LPDWORD)(lpbi)) == sizeof(BITMAPINFOHEADER)) 
#define PALVERSION   0x300 
#define RECTWIDTH(lpRect)     ((lpRect)->right - (lpRect)->left) 
#define RECTHEIGHT(lpRect)    ((lpRect)->bottom - (lpRect)->top) 
#define DIB_HEADER_MARKER   ((WORD) ('M' << 8) | 'B') 
#define WIDTHBYTES(bits)    (((bits) + 31) / 32 * 4) 
class CDib : public CObject   
{ 
public: 
	CDib(); 
	virtual ~CDib(); 
// 属性函数 
public: 
	CArraym_Picture; 
	CString m_Path; 
	WORD PaletteSize(LPSTR lpbi); 
	LPSTR FindDIBBits(LPSTR lpbi);	 
	WORD DIBNumColors(LPSTR lpDIB); 
	DWORD GetHeight(); 
	DWORD GetWidth(); 
	DWORD BytesPerLine(HDIB hDIB); 
// 操作函数 
	BOOL BuildPalette();	 
	BOOL Read(CFile *pFile); 
	HDIB Detach(); 
	 
// 显示位图 
	BOOL PaintDIB(HDC hDC,LPRECT  lpDCRect,LPRECT  lpDIBRect); 
private: 
	 
	HPALETTE CreateDIBPalette(LPBITMAPINFOHEADER lpbi); 
	DWORD DIBHeight(LPSTR lpDIB); 
	DWORD DIBWidth(LPSTR lpDIB); 
public: 
// 显示特效函数 
	int m_Index; 
	void Window(CDC *pDC, int nLeft, int nTop, int nWidth, int nHeight); 
	void WindowLine(CDC *pDC, int nLeft, int nTop, int nWidth, int nHeight); 
	void Grid(CDC *pDC, int nLeft, int nTop, int nWidth, int nHeight); 
	void Masic(CDC *pDC, int nLeft, int nTop, int nWidth, int nHeight); 
	void MoveDown(CDC *pDC, int nLeft, int nTop, int nWidth, int nHeight); 
	void Scan(CDC *pDC, int nLeft, int nTop, int nWidth, int nHeight); 
	void ZoomPicture(CDC *pDC, int nLeft, int nTop, int nWidth, int nHeight); 
	void MoveUp(CDC *pDC, int nLeft, int nTop, int nWidth, int nHeight); 
	void Delay(); 
public: 
	BOOL Read(LPCTSTR lpszPathName); 
	void ShutOff(CDC *pDC, int nLeft, int nTop, int nWidth, int nHeight); 
	void GetPicture(); 
	void GetNextPicture(); 
	void GetFronPicture(); 
	 
	BOOL Read(); 
	 
	BOOL Zoom(int nWidth,int nHeight); 
	HDIB ChangeDIBSize(HDIB hDIB, int nWidth, int nHeight); 
	void Show(CDC *pDC,CRect  rect,int type); 
	void ShowFrame(CDC* pDC,int x,int y,CRect rect,int styFrame); 
	 
	CPalette* m_pPalette; 
	HDIB      m_hDib; 
}; 
 
#endif // !defined(AFX_DIB_H__CB411887_24E6_4B66_87FF_1D7063FB8CD7__INCLUDED_)