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

📄 showdataimagedoc.cpp

📁 该算法用来显示数据图像
💻 CPP
字号:
// ShowDataImageDoc.cpp : implementation of the CShowDataImageDoc class
//

#include "stdafx.h"
#include "ShowDataImage.h"

#include "ShowDataImageDoc.h"

#include "ImageSize.h"

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

/////////////////////////////////////////////////////////////////////////////
// CShowDataImageDoc

IMPLEMENT_DYNCREATE(CShowDataImageDoc, CDocument)

BEGIN_MESSAGE_MAP(CShowDataImageDoc, CDocument)
	//{{AFX_MSG_MAP(CShowDataImageDoc)
		// 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()

/////////////////////////////////////////////////////////////////////////////
// CShowDataImageDoc construction/destruction

CShowDataImageDoc::CShowDataImageDoc()
{
	// TODO: add one-time construction code here

}

CShowDataImageDoc::~CShowDataImageDoc()
{
}

BOOL CShowDataImageDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CShowDataImageDoc serialization

void CShowDataImageDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CShowDataImageDoc diagnostics

#ifdef _DEBUG
void CShowDataImageDoc::AssertValid() const
{
	CDocument::AssertValid();
}

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

/////////////////////////////////////////////////////////////////////////////
// CShowDataImageDoc commands

BOOL CShowDataImageDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	if (!CDocument::OnOpenDocument(lpszPathName))
		return FALSE;
	
	// TODO: Add your specialized creation code here
	CImageSize  opt;
	if(opt.DoModal() == IDCANCEL)
		return false;
    nImageHeight = opt.m_Height;
	nImageWidth = opt.m_Width;

    DataImageFile = fopen(lpszPathName,"rb");
	if(DataImageFile == NULL)
		return false;
    mImageData = (unsigned char*)malloc(nImageHeight*nImageWidth);
	if(mImageData == NULL)
		return false;
  
    if(fread(mImageData,1,nImageHeight*nImageWidth,DataImageFile) != nImageHeight*nImageWidth)
		return false;
	bImageFileIsLoad = true;
	
   
	return TRUE;	
	return TRUE;
}

⌨️ 快捷键说明

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