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

📄 modeview.cpp

📁 该程序通过遗传算法对图像进行聚类分析
💻 CPP
📖 第 1 页 / 共 4 页
字号:
			pRGBTable[x].rgbRed;
		palette.aEntries[x].peGreen =
			pRGBTable[x].rgbGreen;
		palette.aEntries[x].peBlue =
			pRGBTable[x].rgbBlue;
		palette.aEntries[x].peFlags = 0;
	}
	
	hPalette.CreatePalette((LPLOGPALETTE)&palette);
	//CPalette hPale=&hPalette;
	return &hPalette;
}
void CModeView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	lButtonDown=true;
	CView::OnLButtonDown(nFlags, point);
}

void CModeView::OnMouseMove(UINT nFlags, CPoint point) 
{
	if (stateDoc && lButtonDown)
	{
		if (point.x>4 && point.x+3<wide && point.y>4 && point.y+4<height)
		{
			CRect rc;
			rc.left=point.x-5;
			rc.right=point.x+5;
			rc.top=point.y-5;
			rc.bottom=point.y+5;
			for(int x=point.x-4;x<point.x+3;x++)
				for(int y=point.y-4;y<point.y+3;y++)
					if((x-point.x)*(x-point.x)+(y-point.y)*(y-point.y)<25)
						if (statePen)
							*(m_pData+wide*(height-y)+x)=0;
						else
							*(m_pData+wide*(height-y)+x)=255;
					
						InvalidateRect(rc);
		}
		
  }
	CView::OnMouseMove(nFlags, point);
}

void CModeView::OnLButtonUp(UINT nFlags, CPoint point) 
{
	lButtonDown=false;
	CView::OnLButtonUp(nFlags, point);
}



void CModeView::OnPen() 
{
	CModeDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	CString file;
	file=dir+"\\bmp\\blank.bmp";
	pDoc->mCluster.LoadFile(file);	
	memset(pDoc->mCluster.GetData(),255,pDoc->mCluster.GetWidth()*pDoc->mCluster.GetHeight());
 	pDoc->state=2;
	display();
	statePen=true;	



}

void CModeView::OnEraser() 
{
	if (!stateDoc)
		AfxMessageBox("请先点击 \"显示\" 按钮!");
	else
		statePen=false;	
}
void CModeView::OnStandardNum(UINT ID)
{
	CModeDoc *doc =GetDocument();
	ASSERT_VALID(doc);
	int w,h,n;
	
		if (doc->state==2)
		{
			
			if (positionx>wide-70)
			{
				positionx=10;
				positiony+=90;
				if (positiony>height-90)
					positiony=10;
			}
			switch (ID)
			{
			case ID_0:
				w=snum[0].wide;
				h=snum[0].height;
				n=0;
				break;
			case ID_1:
				w=snum[1].wide;
				h=snum[1].height;
				n=1;
				break;
			case ID_2:
				w=snum[2].wide;
				h=snum[2].height;
				n=2;
				break;
				
			case ID_3:
				w=snum[3].wide;
				h=snum[3].height;
				n=3;
				break;
			case ID_4:
				w=snum[4].wide;
				h=snum[4].height;
				n=4;
				break;
			case ID_5:

⌨️ 快捷键说明

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