资源描述:
《数学形态学处理程序实例》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、数学形态学处理程序实例/JEFFView.cpp:implementationoftheCJEFFViewclass//#include"stdafx.h"#include"JEFF.h"#include"JEFFDoc.h"#include"JEFFView.h"#defineOut(x,y)lpPoints[(x)+(y)*nWidth]#ifdef_DEBUG#definenewDEBUG_NEW#undefTHIS_FILEstaticcharTHIS_FILE[]=__FILE__;#endif//////////////////////////
2、/////////////////////////////////////////////////////CJEFFViewIMPLEMENT_DYNCREATE(CJEFFView,CScrollView)BEGIN_MESSAGE_MAP(CJEFFView,CScrollView)//{{AFX_MSG_MAP(CJEFFView)ON_COMMAND(ID_EROSION,OnErosion)ON_COMMAND(ID_DILATION,OnDilation)ON_COMMAND(ID_OPEN,OnOpen)ON_COMMAND(ID_CLOSE
3、,OnClose)ON_COMMAND(ID_ZAOSHENG,OnZaosheng)ON_COMMAND(ID_BIANYUAN,OnBianyuan)ON_COMMAND(ID_1,On1)ON_COMMAND(ID_2,On2)ON_COMMAND(ID_4,On4)ON_COMMAND(ID_8,On8)ON_COMMAND(ID_DILATION2,OnDilation2)ON_COMMAND(ID_EROSION2,OnErosion2)ON_COMMAND(ID_OPEN2,OnOpen2)ON_COMMAND(ID_CLOSE2,OnClo
4、se2)ON_COMMAND(ID_SMOOTH,OnSmooth)ON_COMMAND(ID_RELOAD,OnReload)ON_COMMAND(ID_TIDU,OnTidu)ON_COMMAND(ID_BIANYUAN_H,OnBianyuanH)ON_COMMAND(ID_QUSE,OnQuse)ON_WM_LBUTTONDOWN()//}}AFX_MSG_MAP//StandardprintingcommandsON_COMMAND(ID_FILE_PRINT,CScrollView::OnFilePrint)ON_COMMAND(ID_FILE
5、_PRINT_DIRECT,CScrollView::OnFilePrint)ON_COMMAND(ID_FILE_PRINT_PREVIEW,CScrollView::OnFilePrintPreview)END_MESSAGE_MAP()///////////////////////////////////////////////////////////////////////////////CJEFFViewconstruction/destructionCJEFFView::CJEFFView(){//TODO:addconstructioncod
6、ehereValidDoc=FALSE;m_i=1;}CJEFFView::~CJEFFView(){}BOOLCJEFFView::PreCreateWindow(CREATESTRUCT&cs){//TODO:ModifytheWindowclassorstylesherebymodifying//theCREATESTRUCTcsreturnCScrollView::PreCreateWindow(cs);}////////////////////////////////////////////////////////////////////////
7、///////CJEFFViewdrawingvoidCJEFFView::OnDraw(CDC*pDC){CJEFFDoc*pDoc=GetDocument();ASSERT_VALID(pDoc);//TODO:adddrawcodefornativedatahereif(pDoc->lpBitmap){ValidDoc=TRUE;nWidth=pDoc->nWidth;nHeight=pDoc->nHeight;lpBits=pDoc->lpBits;lpPoints=pDoc->lpPoints;BITMAPINFOHEADERbmi;bmi.bi
8、Size=sizeof(BITMAPINFOHEADER);bmi