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

📄 bitmaploadview.cpp

📁 本原码主要介绍了如何在arm处理器上针对24位真彩位图的处理的方法
💻 CPP
字号:
// bitmaploadView.cpp : implementation of the CBitmaploadView class
//

#include "stdafx.h"
#include "bitmapload.h"

#include "bitmaploadDoc.h"
#include "bitmaploadView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CBitmaploadView

IMPLEMENT_DYNCREATE(CBitmaploadView, CView)

BEGIN_MESSAGE_MAP(CBitmaploadView, CView)
	//{{AFX_MSG_MAP(CBitmaploadView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBitmaploadView construction/destruction

CBitmaploadView::CBitmaploadView()
{
	// TODO: add construction code here
	bDDRawReady = FALSE;
}

CBitmaploadView::~CBitmaploadView()
{
	bDDRawReady = FALSE;
}

BOOL CBitmaploadView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CBitmaploadView drawing

void CBitmaploadView::OnDraw(CDC* pDC)
{
	CBitmaploadDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here

	int w, h;
	pDoc->GetDimension(w, h);
	WORD * pTemp = pDoc->GetPixels();
	POINT x = {0, 0};

	if (w > 0 && h > 0 && pTemp != NULL)
	{
		if (bDDRawReady == TRUE)
		{
			dd_obj.Clear();
			dd_obj.Render1(x, pTemp, w, h);
			dd_obj.Display();
		}
	}
}

/////////////////////////////////////////////////////////////////////////////
// CBitmaploadView diagnostics

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

void CBitmaploadView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CBitmaploadDoc* CBitmaploadView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CBitmaploadDoc)));
	return (CBitmaploadDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CBitmaploadView message handlers

void CBitmaploadView::OnInitialUpdate() 
{
	CView::OnInitialUpdate();
	
	// TODO: Add your specialized code here and/or call the base class
	BOOL ret_code = dd_obj.Init(GetSafeHwnd());
	if (!ret_code)
	{
		AfxMessageBox("Cannot initialize DirectDraw.");
		bDDRawReady = FALSE;
	}
	else
		bDDRawReady = TRUE;
}

void CBitmaploadView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	// TODO: Add your specialized code here and/or call the base class
	CBitmaploadDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	int w, h;
	pDoc->GetDimension(w, h);
	WORD * pTemp = pDoc->GetPixels();
	POINT x = {0, 0};

	TRACE2("%d %d\n", w, h);
	if (w > 0 && h > 0 && pTemp != NULL)
	{
		TRACE0("entered!\n");
		if (bDDRawReady == TRUE)
		{
			dd_obj.Clear();
			dd_obj.Render1(x, pTemp, w, h);
			dd_obj.Display();
		}
	}
}

⌨️ 快捷键说明

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