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

📄 cdib.h

📁 《数字图象工程案例》原码
💻 H
字号:
//CDib.h
//for new class added to current project is required,it is essential before building 
//to add the head file of the new class to the executive file(.cpp) of the project,
//to the head file(.cpp) of the project,and to the executive file(.cpp) of the class 
//where a object of the new class is constructed.
////////////////////////////////////////////////////////////////////////////

#ifndef _INSIDE_VISUAL_CPP_CDIB //could be changed?
#define _INSIDE_VISUAL_CPP_CDIB

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

class CDib:public CObject
{
public:
	enum Alloc{noAlloc,crtAlloc,heapAlloc};
	DECLARE_SERIAL(CDib)

public:
	LPVOID m_lpvColorTable;
	HBITMAP m_hBitmap;
	LPBYTE m_lpImage;
	LPBITMAPINFOHEADER m_lpBMIH;
	HGLOBAL m_hGlobal;
	Alloc m_nBmihAlloc;
	Alloc m_nImageAlloc;
	DWORD m_dwSizeImage;
	int m_nColorTableEntries;
	HANDLE m_hFile;
	HANDLE m_hMap;
	LPVOID m_lpvFile;
	HPALETTE m_hPalette;

public:
	RGBQUAD GetPixel(int x,int y);
	LONG GetPixelOffset(int x,int y);
	CSize GetDibSaveDim();
	CSize GetDimension();
	WORD PaletteSize();
	BOOL IsEmpty();
//	WORD PaletteSize();
	CDib();
	CDib(CSize size,int nBitCount);
	~CDib();
	int GetSizeImage(){return m_dwSizeImage;}
	int GetSizeHeader()
	{return sizeof(BITMAPINFOHEADER)+sizeof(RGBQUAD)*m_nColorTableEntries;}
	
//	BOOL AttachMapFile(const char* strPathname,BOOL bShare=FALSE);
//	BOOL CopyToMapFile(const char* strPathname);
//	BOOL AttachMemory(LPVOID lpvMem,BOOL bMustDelete=FALSE,HGLOBAL hGlobal=NULL);
	BOOL Draw(CDC *pDC,CPoint origin,CSize size);
	
//	HBITMAP CreateSection(CDC* pDC=NULL);
	UINT UsePalette(CDC* pDC,BOOL bBackground=FALSE);
	BOOL MakePalette();
	BOOL SetSystemPalette(CDC* pDC);
//	BOOL Compress(CDC *pDC,BOOL bCompress=TRUE);
//	HBITMAP CreateBitmap(CDC* pDC);
	BOOL Read(CFile *pFile);
	BOOL ReadSection(CFile *pFile,CDC* pDC=NULL);
	BOOL Write(CFile *pFile);

	void Serialize(CArchive& ar);
	void Empty();
	void ComputePaletteSize(int nBitCount);

private:
	void DetachMapFile();
	void ComputeMetrics();

};

#endif//_INSIDE_VISUAL_CPP_CDIB

⌨️ 快捷键说明

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