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

📄 zftdialog.cpp

📁 主要是应用VC进行傅立叶变换和反变换的程序
💻 CPP
字号:
// ZftDialog.cpp : implementation file
//

#include "stdafx.h"
#include "bmpDemo.h"
#include "ZftDialog.h"

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

/////////////////////////////////////////////////////////////////////////////
// ZftDialog dialog


ZftDialog::ZftDialog(CWnd* pParent /*=NULL*/)
	: CDialog(ZftDialog::IDD, pParent)
{
	//{{AFX_DATA_INIT(ZftDialog)
	//}}AFX_DATA_INIT
	GrayFlag=1;
	RedFlag=1;
	GreenFlag=1;
	BlueFlag=1;
}


void ZftDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(ZftDialog)
	DDX_Control(pDX, IDC_RED, m_Red);
	DDX_Control(pDX, IDC_GREEN, m_Green);
	DDX_Control(pDX, IDC_GRAY, m_Gray);
	DDX_Control(pDX, IDC_BLUE, m_Blue);
	DDX_Control(pDX, ID_HISTOGRAM, m_Zft);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(ZftDialog, CDialog)
	//{{AFX_MSG_MAP(ZftDialog)
	ON_WM_PAINT()
	ON_BN_CLICKED(IDC_GRAY, OnGray)
	ON_BN_CLICKED(IDC_BLUE, OnBlue)
	ON_BN_CLICKED(IDC_GREEN, OnGreen)
	ON_BN_CLICKED(IDC_RED, OnRed)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// ZftDialog message handlers

void ZftDialog::OnPaint() 
{
	m_Gray.SetCheck(GrayFlag);
	m_Red.SetCheck(RedFlag);
	m_Green.SetCheck(GreenFlag);
	m_Blue.SetCheck(BlueFlag);
	CPaintDC dc(this); // device context for painting
	CDC *pDC=m_Zft.GetDC();
	CRect r;
	r.left=0;	r.right=300;
	r.top=0;	r.bottom=110;
	m_Zft.CalcWindowRect(&r);
	m_Zft.SetWindowPos (&wndTop,0,0,r.right-r.left,r.bottom-r.top,SWP_NOMOVE);
	
	m_Zft.GetClientRect(&r);
	pDC->FillSolidRect(r.left,r.top,r.right-r.left,r.bottom-r.top,RGB(0,0,0));
	CPen pen(PS_SOLID,1,RGB(128,128,128));
	CPen *oldpen=pDC->SelectObject(&pen);
	CBmpDemoApp *app=(CBmpDemoApp *)AfxGetApp();
	if(m_Red.GetCheck())
	{
		CPen pen(PS_SOLID,1,RGB(255,0,0));
		pDC->SelectObject(&pen);
		for(int i=0;i<256;i++)
		{
			pDC->MoveTo(i+22,r.bottom-r.top-1);
			int temp=int(app->RedData[i]*100);
			pDC->LineTo(i+22,r.bottom-temp-1);
		}
	}
	if(m_Green.GetCheck())
	{
		CPen pen(PS_SOLID,1,RGB(0,255,0));
		pDC->SelectObject(&pen);
		for(int i=0;i<256;i++)
		{
			pDC->MoveTo(i+22,r.bottom-r.top-1);
			int temp=int(app->GreenData[i]*100);
			pDC->LineTo(i+22,r.bottom-temp-1);
		}
	}
	if(m_Blue.GetCheck())
	{
		CPen pen(PS_SOLID,1,RGB(0,0,255));
		pDC->SelectObject(&pen);
		for(int i=0;i<256;i++)
		{
			pDC->MoveTo(i+22,r.bottom-r.top-1);
			int temp=int(app->BlueData[i]*100);
			pDC->LineTo(i+22,r.bottom-temp-1);
		}
	}
	if(m_Gray.GetCheck())
	{
		CPen pen(PS_SOLID,1,RGB(255,255,255));
		pDC->SelectObject(&pen);
		for(int i=0;i<256;i++)
		{
			pDC->MoveTo(i+22,r.bottom-r.top-1);
			int temp=int(app->GrayData[i]*100);
			pDC->LineTo(i+22,r.bottom-temp-1);
		}
	}
	pDC->SelectObject(oldpen);
}

void ZftDialog::OnGray() 
{
	// TODO: Add your control notification handler code here
	GrayFlag=m_Gray.GetCheck();
	RedFlag=m_Red.GetCheck();
	GreenFlag=m_Green.GetCheck();
	BlueFlag=m_Blue.GetCheck();
	OnPaint();	
}

void ZftDialog::OnBlue() 
{
	// TODO: Add your control notification handler code here
	GrayFlag=m_Gray.GetCheck();
	RedFlag=m_Red.GetCheck();
	GreenFlag=m_Green.GetCheck();
	BlueFlag=m_Blue.GetCheck();
	OnPaint();	
}

void ZftDialog::OnGreen() 
{
	// TODO: Add your control notification handler code here
	GrayFlag=m_Gray.GetCheck();
	RedFlag=m_Red.GetCheck();
	GreenFlag=m_Green.GetCheck();
	BlueFlag=m_Blue.GetCheck();
	OnPaint();	
}

void ZftDialog::OnRed() 
{
	// TODO: Add your control notification handler code here
	GrayFlag=m_Gray.GetCheck();
	RedFlag=m_Red.GetCheck();
	GreenFlag=m_Green.GetCheck();
	BlueFlag=m_Blue.GetCheck();
	OnPaint();	
}

⌨️ 快捷键说明

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