资源简介
如题,内容主要也就是dib.h和dib.cpp两个文件,之前看到其他人传的不是很全,加上dib.cpp就是这样

代码片段和文件信息
// Dib.cpp: implementation of the CDib class.
//
//////////////////////////////////////////////////////////////////////
#include “StdAfx.h“
#include “Dib.h“
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CDib::CDib()
{
m_hDrawDib=NULL;
m_pDib=NULL;
}
CDib::~CDib()
{
Close();
}
void CDib::Draw(CDC *pDCint nWidth int nHeight)
{
if(m_pDib!=NULL)
{
ASSERT(IsValid());
DrawDibRealize(m_hDrawDibpDC->GetSafeHdc()TRUE);
DrawDibDraw(m_hDrawDibpDC->GetSafeHdc()
0 //desktop left
0 //desktop top
nWidth
nHeight
(BITMAPINFOHEADER *)m_pDib
(LPVOID) GetBits()
0 //source left
0 //source top
((BITMAPINFOHEADER *)m_pDib)->biWidth
((BITMAPINFOHEADER *)m_pDib)->biHeight
DDF_BACKGROUNDPAL);
}
}
CSize CDib::GetSize()
{
return CSize(((BITMAPINFOHEADER *)m_pDib)->biWidth
((BITMAPINFOHEADER *)m_pDib)->biHeight);
}
LONG CDib::GetWidth()
{
return ((BITMAPINFOHEADER *)m_pDib)->biWidth;
}
LONG CDib::GetHeight()
{
return ((BITMAPINFOHEADER *)m_pDib)->biHeight;
}
void CDib::Close()
{
if(m_hDrawDib!=NULL)
{
DrawDibClose(m_hDrawDib);
m_hDrawDib=NULL;
}
if(m_pDib!=NULL)
{
delete m_pDib;
m_pDib=NULL;
}
}
BOOL CDib::Open(const char * pzFileName)
{
// BITMAPFILEHEADER bmpFileHeader;
CFile file;
int nBmpFileHeaderSize;
Close();
//drawdibopen initialize the diradib library and
//returns a handle for all drawdib operations
if(!(m_hDrawDib=DrawDibOpen()))
goto exit;
//open and read the DIB file header
nBmpFileHeaderSize=sizeof(BITMAPFILEHEADER);
if(!file.Open(pzFileNameCFile::modeRead | CFile::typeBinary))
goto exit;
if(file.Read((void *)&bmpFileHeadernBmpFileHeaderSize)!=(UINT)nBmpFileHeaderSize)
goto failure;
//validate the DIB file header by checking the first
//two characters for the signature “BM“
if(bmpFileHeader.bfType!=*((WORD *)“BM“))
goto failure;
//allocate a big chuck of global memory to store the DIB
m_pDib=(BYTE *)new char [bmpFileHeader.bfSize-nBmpFileHeaderSize];
//allocate memory fail
if(!m_pDib)
goto failure;
//read the dib into the buffer at a time using ReadHuge
file.ReadHuge(m_pDibbmpFileHeader.bfSize-nBmpFileHeaderSize);
if(((BITMAPINFOHEADER *)m_pDib)->biSizeImage==0)
{
//the application that create this bitmap didn‘t fill
//in the biSizeImage field. Let‘s fill it
//in even though the DrawDib * functions don‘t need it.
BITMAPINFOHEADER *pDib=(BITMAPINFOHEADER *)m_pDib;
//scan lines must be DWord aligned hence the strange bit stuff
pDib->biSizeImage=((((pDib->biWidth*pDib->biBitCount)+31)&~31)>>3)*pDib->biHeight;
}
m_pDibBits=GetBits();
file.Close();
ret
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4429 2012-07-12 17:19 dib.cpp
文件 964 2012-07-12 17:19 dib.h
----------- --------- ---------- ----- ----
5393 2
相关资源
- RadioButton控件
- Dibrugarh地区牛场土壤中潜在的益生菌
- Synthesis Characterization and in vitro Antitu
- 大型强子对撞机的狄博森diboson起源和
- 高能dibson过程中的电弱精度测试
- dlib 32位库 19.10.0_release_32bit_msvc1913.l
- 深度图以及基于DIBR的2D转3D资料
- DIBR源码
- DIBR程序代码,基于左右图
- Incredibuild5.0crack+正确破解方法.zip
- 虚拟视点绘制技术dibr源代码
- incredibuild7_31.exe
- 博客-DIB的读入、保存和显示
- dibazhang.sln
- 虚拟视点绘制DIBR源码
- cdib类包含头文件和源文件
评论
共有 条评论