susandlg.cpp

来自「图像处理软件,功能比较基础」· C++ 代码 · 共 127 行

CPP
127
字号
// SUSANDLG.cpp : implementation file
//

#include "stdafx.h"
#include "linjunjuan.h"
#include "SUSANDLG.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSUSANDLG dialog


CSUSANDLG::CSUSANDLG(CWnd* pParent /*=NULL*/)
	: CDialog(CSUSANDLG::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSUSANDLG)
	m_brightnessthreshold = 20;
	m_distancethreshold = 0.0f;
    m_mode = 0;
	m_principle = FALSE;
	m_susan_quick = FALSE;
	m_drawing_mode = FALSE;
	m_three_by_three = FALSE;
	m_thin_post_proc = FALSE;
	//}}AFX_DATA_INIT
}


void CSUSANDLG::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSUSANDLG)
	DDX_Text(pDX, IDC_BRIGHTNESS, m_brightnessthreshold);
	DDX_Text(pDX, IDC_DISTANCE, m_distancethreshold);
	DDX_Check(pDX, IDC_ENCHENCEDIMAGE, m_principle);
	DDX_Check(pDX, IDC_FASTERCORNER, m_susan_quick);
	DDX_Check(pDX, IDC_MARK, m_drawing_mode);
	DDX_Check(pDX, IDC_MASK, m_three_by_three);
	DDX_Check(pDX, IDC_POSTPROCESS, m_thin_post_proc);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSUSANDLG, CDialog)
	//{{AFX_MSG_MAP(CSUSANDLG)
	ON_BN_CLICKED(IDC_CORNERMODE, OnCornermode)
	ON_BN_CLICKED(IDC_EDGEMODE, OnEdgemode)
	ON_BN_CLICKED(IDC_SMOOTHMODE, OnSmoothmode)
	ON_WM_SHOWWINDOW()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSUSANDLG message handlers

void CSUSANDLG::OnCornermode() 
{
	// TODO: Add your control notification handler code here
	m_mode = 2;
    GetDlgItem(IDC_ENCHENCEDIMAGE)->EnableWindow(TRUE);
    GetDlgItem(IDC_FASTERCORNER)->EnableWindow(TRUE);
    GetDlgItem(IDC_MARK)->EnableWindow(TRUE);
    GetDlgItem(IDC_MASK)->EnableWindow(FALSE);
    GetDlgItem(IDC_BRIGHTNESS)->EnableWindow(TRUE);
    GetDlgItem(IDC_DISTANCE)->EnableWindow(FALSE);
    GetDlgItem(IDC_POSTPROCESS)->EnableWindow(FALSE);
	
}

void CSUSANDLG::OnEdgemode() 
{
	// TODO: Add your control notification handler code here
	m_mode = 1;
    GetDlgItem(IDC_ENCHENCEDIMAGE)->EnableWindow(TRUE);
    GetDlgItem(IDC_FASTERCORNER)->EnableWindow(FALSE);
    GetDlgItem(IDC_MARK)->EnableWindow(TRUE);
    GetDlgItem(IDC_MASK)->EnableWindow(TRUE);
    GetDlgItem(IDC_BRIGHTNESS)->EnableWindow(TRUE);
    GetDlgItem(IDC_DISTANCE)->EnableWindow(FALSE);
    GetDlgItem(IDC_POSTPROCESS)->EnableWindow(TRUE);
	
}

void CSUSANDLG::OnSmoothmode() 
{
	// TODO: Add your control notification handler code here
	m_mode = 0;
    GetDlgItem(IDC_ENCHENCEDIMAGE)->EnableWindow(FALSE);
    GetDlgItem(IDC_FASTERCORNER)->EnableWindow(FALSE);
    GetDlgItem(IDC_MARK)->EnableWindow(FALSE);
    GetDlgItem(IDC_MASK)->EnableWindow(TRUE);
    GetDlgItem(IDC_BRIGHTNESS)->EnableWindow(TRUE);
    GetDlgItem(IDC_DISTANCE)->EnableWindow(TRUE);
    GetDlgItem(IDC_POSTPROCESS)->EnableWindow(FALSE);
	
}

void CSUSANDLG::OnShowWindow(BOOL bShow, UINT nStatus) 
{	
	CDialog::OnShowWindow(bShow, nStatus);
	
	// TODO: Add your message handler code here
    switch(m_mode)
    {
    case 0:
       OnSmoothmode();
       ((CButton *)GetDlgItem(IDC_SMOOTHMODE))->SetCheck(1);
       break;
    case 1:
       OnEdgemode();
       ((CButton *)GetDlgItem(IDC_EDGEMODE))->SetCheck(1);
       break;
    case 2:
       OnCornermode();
       ((CButton *)GetDlgItem(IDC_CORNERMODE))->SetCheck(1);
       break;
    }
	
	// TODO: Add your message handler code here
	
}

⌨️ 快捷键说明

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