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

📄 gammacorrection.cpp

📁 本光盘包含了《精通Visual C++图像处理编程(第3版)》一书中全部的源代码、示例程序的可执行文件以及一些供图像处理测试用的图像文件。
💻 CPP
字号:
// GammaCorrection.cpp : implementation file
//

#include "stdafx.h"
#include "colorprocess.h"
#include "GammaCorrection.h"

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

/////////////////////////////////////////////////////////////////////////////
// CGammaCorrection dialog


CGammaCorrection::CGammaCorrection(CWnd* pParent /*=NULL*/)
	: CDialog(CGammaCorrection::IDD, pParent)
{
	//{{AFX_DATA_INIT(CGammaCorrection)
	m_strGamma = _T("");
	m_nGamma = 0;
	//}}AFX_DATA_INIT

	m_fGamma = 0.0;
}


void CGammaCorrection::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CGammaCorrection)
	DDX_Text(pDX, IDC_BRIGHT, m_strGamma);
	DDX_Slider(pDX, IDC_SLIDER1, m_nGamma);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CGammaCorrection, CDialog)
	//{{AFX_MSG_MAP(CGammaCorrection)
	ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER1, OnReleasedcaptureSlider1)
	ON_WM_HSCROLL()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGammaCorrection message handlers

BOOL CGammaCorrection::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	((CSliderCtrl *)GetDlgItem(IDC_SLIDER1))->SetRangeMin(1, TRUE);
	((CSliderCtrl *)GetDlgItem(IDC_SLIDER1))->SetRangeMax(50, TRUE);
	((CSliderCtrl *)GetDlgItem(IDC_SLIDER1))->SetPos(1);
	m_strGamma = "0.1";
	UpdateData(FALSE);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CGammaCorrection::OnReleasedcaptureSlider1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	UpdateData(TRUE);
	m_fGamma = m_nGamma * 0.1;
	m_strGamma.Format("%.2f", m_fGamma);
	UpdateData(FALSE);

	*pResult = 0;
}

⌨️ 快捷键说明

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