📄 quantizecolordlg.cpp
字号:
// QuantizeColorDlg.cpp : implementation file
//
#include "stdafx.h"
#include "小波变换.h"
#include "QuantizeColorDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CQuantizeColorDlg dialog
CQuantizeColorDlg::CQuantizeColorDlg(CWnd* pParent /*=NULL*/)
: CDialog(CQuantizeColorDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CQuantizeColorDlg)
m_red = 0;
m_green = 0;
m_blue = 0;
m_bluemax = _T("");
m_bluemin = _T("");
m_greenmax = _T("");
m_greenmin = _T("");
m_redmax = _T("");
m_redmin = _T("");
//}}AFX_DATA_INIT
}
void CQuantizeColorDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CQuantizeColorDlg)
DDX_Text(pDX, IDC_RED, m_red);
DDX_Text(pDX, IDC_GREEN, m_green);
DDX_Text(pDX, IDC_BLUE, m_blue);
DDX_Text(pDX, IDC_BLUEMAX, m_bluemax);
DDX_Text(pDX, IDC_BLUEMIN, m_bluemin);
DDX_Text(pDX, IDC_GREENMAX, m_greenmax);
DDX_Text(pDX, IDC_GREENMIN, m_greenmin);
DDX_Text(pDX, IDC_REDMAX, m_redmax);
DDX_Text(pDX, IDC_REDMIN, m_redmin);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CQuantizeColorDlg, CDialog)
//{{AFX_MSG_MAP(CQuantizeColorDlg)
ON_WM_PAINT()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CQuantizeColorDlg message handlers
BOOL CQuantizeColorDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
GetDlgItem(IDC_HISGRAPHCOLOR)->GetWindowRect(&m_precthis);
ScreenToClient(&m_precthis);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CQuantizeColorDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
//double height=(m_precthis.bottom-m_precthis.top)/3.0;
double height=m_precthis.Height()/3.0;
for(int ncolor=0;ncolor<3;ncolor++)
{
for(int i=0;i<256;i++)
{
dc.MoveTo(m_precthis.left+i,LONG(m_precthis.bottom-ncolor*height));
dc.LineTo(m_precthis.left+i,
LONG(m_precthis.bottom-height*ncolor-m_level[256*ncolor+i]/m_levelmax[ncolor]*height));
}
}
// Do not call CDialog::OnPaint() for painting messages
}
void CQuantizeColorDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
double x;
if(m_precthis.PtInRect(point))
{
double m=(double)(m_precthis.bottom-point.y)/(double)(m_precthis.Height())*3.0;
int i=int(m);
x=(m_colormax[i]-m_colormin[i])/255*(point.x-m_precthis.left)+m_colormin[i];
switch(i)
{
case 0:
m_blue=int(x);
break;
case 1:
m_green=int(x);
break;
case 2:
m_red=int(x);
break;
}
UpdateData(FALSE);
}
CDialog::OnMouseMove(nFlags, point);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -