资源简介

在图像的空间域上嵌入水印,从而实现图像真伪鉴定的一种方法。

资源截图

代码片段和文件信息

// 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();
return 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     196662  1998-02-03 17:48  NNewReadBmp\Apple.bmp

     文件       4425  2009-04-05 16:47  NNewReadBmp\Dib.cpp

     文件        967  2009-04-05 16:47  NNewReadBmp\dib.h

     文件      49206  2009-04-06 16:21  NNewReadBmp\frogs_2bit__.bmp

     文件     138514  2002-11-29 19:41  NNewReadBmp\lena.bmp

     文件      23610  2006-08-10 13:18  NNewReadBmp\MarkWater.bmp

     文件      21624  2009-04-21 21:56  NNewReadBmp\NewReadBmp.aps

     文件       1348  2009-04-21 22:00  NNewReadBmp\NewReadBmp.clw

     文件       2119  2009-04-06 14:56  NNewReadBmp\NewReadBmp.cpp

     文件       4353  2009-04-06 15:33  NNewReadBmp\NewReadBmp.dsp

     文件        526  2009-04-06 14:56  NNewReadBmp\NewReadBmp.dsw

     文件       1368  2009-04-06 14:56  NNewReadBmp\NewReadBmp.h

     文件     115712  2009-04-21 22:00  NNewReadBmp\NewReadBmp.ncb

     文件        254  2009-04-21 22:00  NNewReadBmp\NewReadBmp.plg

     文件       5933  2009-04-09 21:16  NNewReadBmp\NewReadBmp.rc

     文件       2576  2009-04-09 13:59  NNewReadBmp\NewReadBmpDlg.h

     文件     177356  2003-04-28 09:46  NNewReadBmp\plane24.bmp

     文件       3651  2009-04-06 14:56  NNewReadBmp\ReadMe.txt

     文件        964  2009-04-09 10:38  NNewReadBmp\resource.h

     文件        212  2009-04-06 14:56  NNewReadBmp\StdAfx.cpp

     文件       1054  2009-04-06 14:56  NNewReadBmp\StdAfx.h

     文件     262912  2009-04-09 11:20  NNewReadBmp\宿主图像嵌入水印后的数据显示.txt

     文件     262912  2009-04-09 11:20  NNewReadBmp\宿主图像的数据显示.txt

     文件     237300  2009-04-09 11:20  NNewReadBmp\水印图像的数据显示.txt

     文件     196662  2009-04-07 10:33  NNewReadBmp\未标题1.bmp

     文件     196662  2009-04-08 10:33  NNewReadBmp\未标题0.bmp

     文件     196662  2009-04-07 10:33  NNewReadBmp\未标题3.bmp

     文件     196662  2009-04-07 10:36  NNewReadBmp\未标题4.bmp

     文件     196662  2009-04-07 10:40  NNewReadBmp\未标题5.bmp

     文件     196662  2009-04-07 11:05  NNewReadBmp\未标题new.bmp

............此处省略60个文件信息

评论

共有 条评论