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

📄 modeview.cpp

📁 图像模式识别的聚类器设计
💻 CPP
📖 第 1 页 / 共 4 页
字号:
}

CModeView::~CModeView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CModeView drawing

void CModeView::OnDraw(CDC* pDC)
{
	CModeDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	

	CRect cr(0,0,500,500);
	pDC->FillSolidRect(cr,RGB(220,220,220));

    pDC->TextOut(10,500,"1.视窗分为左视图和右视图,请按如下步骤执行。");
	pDC->TextOut(10,520,"2.鼠标单击左视图,可以激活按钮:[标准数字聚类]、[手画图形聚类]、[位图文件分析聚类]。");
	pDC->TextOut(10,540,"3.按下[标准数字聚类]按钮后,选择工具条上提供的各种标准数字。");
	pDC->TextOut(10,560,"4.按下[手画图形聚类]按钮后,拖动鼠标左键画各种数字或图形,注意每一个物体要连通。");
	pDC->TextOut(10,580,"5.按下[位图文件分析聚类]按钮后,打开需要聚类分析的位图文件。");
	pDC->TextOut(10,600,"6.单击右视图,选择菜单[获得模式特征]进行特征提取后,选择各种算法进行聚类分析。");

	
	if (stateDoc)   
	{
		if (statePen)
			::SetCursor(AfxGetApp()->LoadCursor(IDC_CURSORPEN));
		else
			::SetCursor(AfxGetApp()->LoadCursor(IDC_CURSORERASER));

		BYTE* pBitmapData = pCluster->GetData();
		LPBITMAPINFO pBitmapInfo = pCluster->GetInfo();
		int bitmapHeight = height;//pCDib->GetHeight();
		int bitmapWidth = wide;//pCDib->GetWidth();
		
		if (pCluster->GetRGB()) // Has a color table
		{
			CPalette * hPalette1=CreateBitmapPalette(pCluster);
			CPalette * hOldPalette =
				pDC->SelectPalette(hPalette1, true);
			pDC->RealizePalette();
			::StretchDIBits(pDC->GetSafeHdc(),0,0, bitmapWidth, bitmapHeight,
				0, 0, bitmapWidth , bitmapHeight ,
				pBitmapData, pBitmapInfo,
				DIB_RGB_COLORS, SRCCOPY);
			pDC->SelectPalette(hOldPalette, true);
			hPalette.DeleteObject();
		}
	}
}

/////////////////////////////////////////////////////////////////////////////
// CModeView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CModeView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CModeView message handlers
CPalette * CModeView::CreateBitmapPalette(CCluster *pBitmap)
{
	struct
	{
		WORD Version;
		WORD NumberOfEntries;
		PALETTEENTRY aEntries[256];
	} palette = { 0x300, 256 };
	
	LPRGBQUAD pRGBTable = pBitmap->GetRGB();
	UINT numberOfColors = pBitmap->GetNumberOfColors();
	
	for(UINT x=0; x<numberOfColors; ++x)
	{
		palette.aEntries[x].peRed =

⌨️ 快捷键说明

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