image1view.cpp

来自「本程序基于Visual C++6.0环境编写」· C++ 代码 · 共 81 行

CPP
81
字号
// Image1View.cpp : implementation file
//

#include "stdafx.h"
#include "wavelets.h"
#include "Image1View.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CImage1View

IMPLEMENT_DYNCREATE(CImage1View, CView)

CImage1View::CImage1View()
{
}

CImage1View::~CImage1View()
{
}


BEGIN_MESSAGE_MAP(CImage1View, CView)
	//{{AFX_MSG_MAP(CImage1View)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CImage1View drawing

void CImage1View::OnDraw(CDC* pDC)
{
	//CDocument* pDoc = GetDocument();

    CWvltDoc* pDoc =(CWvltDoc*) GetDocument();
     unsigned char*	 pBitmap = pDoc -> m_pTransfered1;

	LPBITMAPINFO lpBitmapInfo = (LPBITMAPINFO)(pBitmap + 14);
	unsigned char* pBitmapData = pBitmap + ((LPBITMAPFILEHEADER)pBitmap)->bfOffBits;
	unsigned long biHeight = ((LPBITMAPINFOHEADER)lpBitmapInfo)->biHeight;
	unsigned long biWidth = ((LPBITMAPINFOHEADER)lpBitmapInfo)->biWidth;

	CRect rect;
	GetClientRect(&rect);
	long originx =0;
	long originy =0;
	if((unsigned long)(rect.Width()) > biWidth)
		originx = (rect.Width() - biWidth)>>1;
	if((unsigned long)(rect.Height()) > biHeight)
		originy = (rect.Height() - biHeight)>>1;
	SetDIBitsToDevice(pDC->m_hDC, originx, originy, biWidth, biHeight, 0, 0, 0, biHeight, pBitmapData, 
							lpBitmapInfo, DIB_RGB_COLORS);


	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CImage1View diagnostics

#ifdef _DEBUG
void CImage1View::AssertValid() const
{
	CView::AssertValid();
}

void CImage1View::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CImage1View message handlers

⌨️ 快捷键说明

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