📄 dibprocessview.cpp
字号:
void CDibProcessView::OnScanright()
{
m_nEffect = EFFECT_SCANRIGHT;
EffectDisplay(m_nEffect);
}
void CDibProcessView::OnUpdateScanright(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnScanup()
{
m_nEffect = EFFECT_SCANUP;
EffectDisplay(m_nEffect);
}
void CDibProcessView::OnUpdateScanup(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnVblind()
{
m_nEffect = EFFECT_VBLIND;
EffectDisplay(m_nEffect);
}
void CDibProcessView::OnUpdateVblind(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnVcrossmove()
{
m_nEffect = EFFECT_VCROSSMOVE;
EffectDisplay(m_nEffect);
}
void CDibProcessView::OnUpdateVcrossmove(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnVraster()
{
m_nEffect = EFFECT_VRASTER;
EffectDisplay(m_nEffect);
}
void CDibProcessView::OnUpdateVraster(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnVsplitmove()
{
m_nEffect = EFFECT_VSPLITMOVE;
EffectDisplay(m_nEffect);
}
void CDibProcessView::OnUpdateVsplitmove(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnUpdateVsplitscan(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnVsplitscan()
{
m_nEffect = EFFECT_VSPLITSCAN;
EffectDisplay(m_nEffect);
}
void CDibProcessView::OnFadein()
{
m_nEffect = EFFECT_FADE;
EffectDisplay(m_nEffect);
}
void CDibProcessView::OnUpdateFadein(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::EffectDisplay(int nEffect)
{
CDibProcessDoc* pDoc = GetDocument();
CClientDC dc(this);
CPoint pt = GetScrollPosition();
if (nEffect==EFFECT_FADE)
{
pDoc->m_pDib->Clear(nEffect, &dc, -pt.x, -pt.y, 16, 50);
pDoc->m_pDib->Display(nEffect, &dc, -pt.x, -pt.y, 16, 50);
}
else if (nEffect==EFFECT_HBLIND || nEffect==EFFECT_VBLIND)
{
pDoc->m_pDib->Clear(nEffect, &dc, -pt.x, -pt.y, 8, 70);
pDoc->m_pDib->Display(nEffect, &dc, -pt.x, -pt.y, 8, 70);
}
else if (nEffect==EFFECT_HRASTER || nEffect==EFFECT_VRASTER || nEffect==EFFECT_MOSAIC)
{
pDoc->m_pDib->Clear(nEffect, &dc, -pt.x, -pt.y, 16, 1);
pDoc->m_pDib->Display(nEffect, &dc, -pt.x, -pt.y, 16, 1);
}
else
{
pDoc->m_pDib->Clear(nEffect, &dc, -pt.x, -pt.y, 1, 5);
pDoc->m_pDib->Display(nEffect, &dc, -pt.x, -pt.y, 1, 5);
}
}
void CDibProcessView::OnHmirror()
{
CDibProcessDoc* pDoc = GetDocument();
pDoc->m_pDib->FlipHorz();
CSize sizeTotal(pDoc->m_pDib->GetWidth(), pDoc->m_pDib->GetHeight());
SetScrollSizes(MM_TEXT, sizeTotal);
pDoc->SetModifiedFlag(TRUE);
pDoc->UpdateAllViews(NULL);
}
void CDibProcessView::OnUpdateHmirror(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnRotateAngle()
{
// TODO: Add your command handler code here
CRotateAngle rotateDlg;
if (rotateDlg.DoModal() == IDOK)
{
CDibProcessDoc* pDoc = GetDocument();
pDoc->m_pDib->Rotate(rotateDlg.m_fAngle, RGB(0,0,0));
CSize sizeTotal(pDoc->m_pDib->GetWidth(), pDoc->m_pDib->GetHeight());
SetScrollSizes(MM_TEXT, sizeTotal);
pDoc->SetModifiedFlag(TRUE);
pDoc->UpdateAllViews(NULL);
}
}
void CDibProcessView::OnUpdateRotateAngle(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnRotate()
{
CDibProcessDoc* pDoc = GetDocument();
pDoc->m_pDib->Rotate90();
CSize sizeTotal(pDoc->m_pDib->GetWidth(), pDoc->m_pDib->GetHeight());
SetScrollSizes(MM_TEXT, sizeTotal);
pDoc->SetModifiedFlag(TRUE);
pDoc->UpdateAllViews(NULL);
}
void CDibProcessView::OnUpdateRotate(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnRotate180()
{
CDibProcessDoc* pDoc = GetDocument();
pDoc->m_pDib->Rotate180();
CSize sizeTotal(pDoc->m_pDib->GetWidth(), pDoc->m_pDib->GetHeight());
SetScrollSizes(MM_TEXT, sizeTotal);
pDoc->SetModifiedFlag(TRUE);
pDoc->UpdateAllViews(NULL);
}
void CDibProcessView::OnUpdateRotate180(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnRotate270()
{
CDibProcessDoc* pDoc = GetDocument();
pDoc->m_pDib->Rotate270();
CSize sizeTotal(pDoc->m_pDib->GetWidth(), pDoc->m_pDib->GetHeight());
SetScrollSizes(MM_TEXT, sizeTotal);
pDoc->SetModifiedFlag(TRUE);
pDoc->UpdateAllViews(NULL);
}
void CDibProcessView::OnUpdateRotate270(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnScale()
{
CDibProcessDoc* pDoc = GetDocument();
CScaleDlg scaleDlg(this);
if (scaleDlg.DoModal() == IDOK)
{
pDoc->m_pDib->Zoom(scaleDlg.m_fRatioX, scaleDlg.m_fRatioY);
CSize sizeTotal(pDoc->m_pDib->GetWidth(), pDoc->m_pDib->GetHeight());
SetScrollSizes(MM_TEXT, sizeTotal);
pDoc->SetModifiedFlag(TRUE);
pDoc->UpdateAllViews(NULL);
}
}
void CDibProcessView::OnUpdateScale(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnVmirror()
{
CDibProcessDoc* pDoc = GetDocument();
pDoc->m_pDib->FlipVert();
CSize sizeTotal(pDoc->m_pDib->GetWidth(), pDoc->m_pDib->GetHeight());
SetScrollSizes(MM_TEXT, sizeTotal);
pDoc->SetModifiedFlag(TRUE);
pDoc->UpdateAllViews(NULL);
}
void CDibProcessView::OnUpdateVmirror(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnColorbits()
{
CDibProcessDoc* pDoc = GetDocument();
CColorBitsDlg colorBitsDlg((int)pDoc->m_pDib->GetBitCount(), this);
if (colorBitsDlg.DoModal() == IDOK)
{
pDoc->m_pDib->ColorQuantize(colorBitsDlg.m_nColorBits);
pDoc->SetModifiedFlag(TRUE);
OnRealizePal((WPARAM)m_hWnd,0); // realize the new palette
pDoc->UpdateAllViews(NULL);
}
}
void CDibProcessView::OnUpdateColorbits(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnGray()
{
CDibProcessDoc* pDoc = GetDocument();
CGrayDlg grayDlg(this);
if (grayDlg.DoModal() == IDOK)
{
pDoc->m_pDib->ChangeToGrayscale(grayDlg.m_nMethod,
grayDlg.m_fWeightR,
grayDlg.m_fWeightG,
grayDlg.m_fWeightB);
pDoc->SetModifiedFlag(TRUE);
OnRealizePal((WPARAM)m_hWnd,0); // realize the new palette
pDoc->UpdateAllViews(NULL);
}
}
void CDibProcessView::OnUpdateGray(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnGetpixel()
{
GetDocument()->m_pDib->Exposure(128);
GetDocument()->SetModifiedFlag(TRUE);
OnRealizePal((WPARAM)m_hWnd,0); // realize the new palette
GetDocument()->UpdateAllViews(NULL);
}
void CDibProcessView::OnExposure()
{
GetDocument()->m_pDib->Exposure(128);
GetDocument()->SetModifiedFlag(TRUE);
OnRealizePal((WPARAM)m_hWnd,0); // realize the new palette
GetDocument()->UpdateAllViews(NULL);
}
void CDibProcessView::OnUpdateExposure(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnReverse()
{
GetDocument()->m_pDib->Reverse();
GetDocument()->SetModifiedFlag(TRUE);
OnRealizePal((WPARAM)m_hWnd,0); // realize the new palette
GetDocument()->UpdateAllViews(NULL);
}
void CDibProcessView::OnUpdateReverse(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnSpread()
{
// TODO: Add your command handler code here
GetDocument()->m_pDib->Spread(3);
GetDocument()->SetModifiedFlag(TRUE);
OnRealizePal((WPARAM)m_hWnd,0); // realize the new palette
GetDocument()->UpdateAllViews(NULL);
}
void CDibProcessView::OnUpdateSpread(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
void CDibProcessView::OnEmboss()
{
// TODO: Add your command handler code here
GetDocument()->m_pDib->Embossment(128);
GetDocument()->SetModifiedFlag(TRUE);
OnRealizePal((WPARAM)m_hWnd,0); // realize the new palette
GetDocument()->UpdateAllViews(NULL);
}
void CDibProcessView::OnUpdateEmboss(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(! GetDocument()->m_pDib->IsEmpty());
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -