⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graphdib.h

📁 读写位图文件的
💻 H
字号:
// GraphDIB.h: interface for the CGraphDIB class.
// 作者:董希华
// 日期:2004年11月05日
// 联系方式: sddongxh@hotmail.com
// 说明:本例程曾参考多人的代码,在此致谢!
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GRAPHDIB_H__2BDDE204_6C03_4313_A313_7D26C43391DA__INCLUDED_)
#define AFX_GRAPHDIB_H__2BDDE204_6C03_4313_A313_7D26C43391DA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CGraphDIB : public CObject  
{
	DECLARE_SERIAL(CGraphDIB)
public:
	CGraphDIB();
	CGraphDIB(const CGraphDIB&s);           //拷贝构造函数,可以用来复制一个位图
	virtual ~CGraphDIB();
    //
	void Draw(CDC* pDC);                     //显示位图
	bool LoadBmp(const char* lpszFileName);  //通过文件名读取位图
	bool LoadBmp(CFile& File);               //通过文件读取位图
	bool WriteToFile(CFile &file);           //写当前位图到文件中
	void Serialize(CArchive &ar);

protected:

	int GetBmpDataSize() const;       //获取象素数据的大小
	int GetBmpInfoSize() const;       //获取位图信息的大小 
	int Height() const;               //获取位图的高
	int Width()const;                 //获取位图的宽
    int GetPalEntries();              //获取调色板项目数

private:
	HBITMAP      m_hBmp;              //位图句柄         
	BITMAPINFO*  m_pBmpInfo;          //位图信息 
	BYTE*        m_pPixels;           //象素数据区入口 
	CRect        m_rectBound;         //显示时的外接矩形,缺省即为本来大小


};

#endif // !defined(AFX_GRAPHDIB_H__2BDDE204_6C03_4313_A313_7D26C43391DA__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -