• 大小: 1.04MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-29
  • 语言: C/C++
  • 标签:

资源简介

// WaterMark.h : main header file for the WATERMARK application // #if !defined(AFX_WATERMARK_H__6895B557_4450_4088_810E_A87674673BCB__INCLUDED_) #define AFX_WATERMARK_H__6895B557_4450_4088_810E_A87674673BCB__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH #endif #include "resource.h" // main symbols ///////////////////////////////////////////////////////////////////////////// // CWaterMarkApp: // See WaterMark.cpp for the implementation of this class // class CWaterMarkApp : public CWinApp { public: CWaterMarkApp(); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CWaterMarkApp) public: virtual BOOL InitInstance(); //}}AFX_VIRTUAL // Implementation //{{AFX_MSG(CWaterMarkApp) // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_WATERMARK_H__6895B557_4450_4088_810E_A87674673BCB__INCLUDED_)

资源截图

代码片段和文件信息

// 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  2006-03-29 18:54  数字水印的嵌入和提取(vc)\Dib.cpp

     文件        964  2006-03-29 18:16  数字水印的嵌入和提取(vc)\Dib.h

     文件      23610  2006-08-10 13:15  数字水印的嵌入和提取(vc)\Pic\11.bmp

     文件     196662  1998-02-03 17:48  数字水印的嵌入和提取(vc)\Pic\Apple.bmp

     文件     447390  1999-03-16 03:57  数字水印的嵌入和提取(vc)\Pic\BoatCake.BMP

     文件     921654  1999-03-16 03:46  数字水印的嵌入和提取(vc)\Pic\Fruit.BMP

     文件     138514  2002-11-29 19:41  数字水印的嵌入和提取(vc)\Pic\lena.bmp

     文件      23610  2006-08-10 13:18  数字水印的嵌入和提取(vc)\Pic\MarkWater.bmp

     文件     177356  2003-04-28 09:46  数字水印的嵌入和提取(vc)\Pic\plane24.bmp

     文件     113334  2000-07-09 20:11  数字水印的嵌入和提取(vc)\Pic\street.bmp

    ..A.SH.    125952  2006-08-15 11:03  数字水印的嵌入和提取(vc)\Pic\Thumbs.db

     文件       1078  2006-04-01 12:48  数字水印的嵌入和提取(vc)\res\FACE.ICO

    ..A.SH.     10240  2006-08-15 11:03  数字水印的嵌入和提取(vc)\res\Thumbs.db

     文件       1078  2006-03-20 22:23  数字水印的嵌入和提取(vc)\res\WaterMark.ico

     文件        401  2006-03-20 22:23  数字水印的嵌入和提取(vc)\res\WaterMark.rc2

     文件       1101  2006-04-02 20:34  数字水印的嵌入和提取(vc)\Resource.h

     文件        211  2006-03-20 22:23  数字水印的嵌入和提取(vc)\StdAfx.cpp

     文件       1054  2006-03-20 22:23  数字水印的嵌入和提取(vc)\StdAfx.h

     文件      21304  2006-08-11 15:58  数字水印的嵌入和提取(vc)\WaterMark.aps

     文件       1483  2006-08-12 14:11  数字水印的嵌入和提取(vc)\WaterMark.clw

     文件       2105  2006-03-20 22:23  数字水印的嵌入和提取(vc)\WaterMark.cpp

     文件       4421  2006-04-01 14:03  数字水印的嵌入和提取(vc)\WaterMark.dsp

     文件        541  2006-03-20 22:23  数字水印的嵌入和提取(vc)\WaterMark.dsw

     文件       1357  2006-03-20 22:23  数字水印的嵌入和提取(vc)\WaterMark.h

     文件      58368  2006-08-12 14:11  数字水印的嵌入和提取(vc)\WaterMark.ncb

     文件      53760  2006-08-12 14:11  数字水印的嵌入和提取(vc)\WaterMark.opt

     文件       1800  2006-08-11 16:17  数字水印的嵌入和提取(vc)\WaterMark.plg

     文件       5971  2006-04-02 20:48  数字水印的嵌入和提取(vc)\WaterMark.rc

     文件      21348  2006-04-02 21:58  数字水印的嵌入和提取(vc)\WaterMarkDlg.cpp

     文件       2855  2006-04-02 21:33  数字水印的嵌入和提取(vc)\WaterMarkDlg.h

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

评论

共有 条评论

相关资源