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

📄 convertview.cpp

📁 本程序主要完成pic到tif图像格式的转换(由图象格式转换菜单实现)并且完成了读写pic,tif图像文件的源代码。File/open菜单完成在原始图中获取任意位置和大小的图像。
💻 CPP
字号:
// convertView.cpp : implementation of the CConvertView class
//

#include "stdafx.h"
#include "convert.h"

#include "convertDoc.h"
#include "convertView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CConvertView

IMPLEMENT_DYNCREATE(CConvertView, CView)

BEGIN_MESSAGE_MAP(CConvertView, CView)
	//{{AFX_MSG_MAP(CConvertView)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CConvertView construction/destruction

CConvertView::CConvertView()
{
	// TODO: add construction code here

}

CConvertView::~CConvertView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CConvertView drawing

void CConvertView::OnDraw(CDC* pDC)
{
	CConvertDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
    
	unsigned char gray;
    int i,j;

    int row=pDoc->myImage.m_ImageHeight;//......
	int col=pDoc->myImage.m_ImageWidth;
    for(i=0;i<row;i++)
	   for(j=0;j<col;j++)
	   {
		   gray=pDoc->myImage.image[i][j];
		   pDC->SetPixel(j+10,i+10,RGB(gray,gray,gray));
	   }

}

/////////////////////////////////////////////////////////////////////////////
// CConvertView printing

BOOL CConvertView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CConvertView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CConvertView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CConvertView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CConvertView message handlers

//DEL BOOL CConvertView::OnScroll(UINT nScrollCode, UINT nPos, BOOL bDoScroll) 
//DEL {
//DEL 	// TODO: Add your specialized code here and/or call the base class
//DEL 	
//DEL 	return CView::OnScroll(nScrollCode, nPos, bDoScroll);
//DEL }

//DEL void CConvertView::OnSize(UINT nType, int cx, int cy) 
//DEL {
//DEL 	CView::OnSize(nType, cx, cy);
//DEL 	
//DEL 	CView::SetScrollPos(setPageSize	
//DEL }

//DEL void CConvertView::OnInitialUpdate() 
//DEL {
//DEL //	CScrollView::OnInitialUpdate();
//DEL 	
//DEL 	CSize sizeTotal(800,1050);
//DEL 	CSize sizePage(sizeTotal.cx/2,sizeTotal.cy/2);
//DEL 	CSize sizeLine(sizeTotal.cx/50,sizeTotal.cy/50);
//DEL //	SetScrollSizes(MM_LOENGLISH,sizeTotal,sizePage,sizeLine);
//DEL 	// TODO: Add your specialized code here and/or call the base class
//DEL //	SetScrollRange(200,800,13200,false);
//DEL 	SetTotalSize(6000);
//DEL 	
//DEL }

⌨️ 快捷键说明

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