?? dipdoc.cpp
字號:
UpdateAllViews(NULL);
}
void CDipDoc::OnEnhaSmooth()
{
// 模板高度
int nTempH;
// 模板寬度
int nTempW;
// 模板系數
float fTempC;
// 模板中心元素X坐標
int nTempXc;
// 模板中心元素Y坐標
int nTempYc;
// 模板元素數組
float aValue[25];
// 創建對話框
CDlgSmooth dlgPara;
// 給模板數組賦初值(為平均模板)
aValue[0] = 1.0;
aValue[1] = 1.0;
aValue[2] = 1.0;
aValue[3] = 1.0;
aValue[4] = 1.0;
aValue[5] = 1.0;
aValue[6] = 1.0;
aValue[7] = 1.0;
aValue[8] = 1.0;
aValue[9] = 1.0;
aValue[10] = 1.0;
aValue[11] = 1.0;
aValue[12] = 1.0;
aValue[13] = 1.0;
aValue[14] = 1.0;
aValue[15] = 1.0;
aValue[16] = 1.0;
aValue[17] = 1.0;
aValue[18] = 1.0;
aValue[19] = 1.0;
aValue[20] = 1.0;
aValue[21] = 1.0;
aValue[22] = 1.0;
aValue[23] = 1.0;
aValue[24] = 1.0;
// 初始化對話框變量值
dlgPara.m_intType = 0;
dlgPara.m_iTempH = 3;
dlgPara.m_iTempW = 3;
dlgPara.m_iTempMX = 1;
dlgPara.m_iTempMY = 1;
dlgPara.m_fTempC = 9.0;
// 顯示對話框,提示用戶設定平移量
if (dlgPara.DoModal() != IDOK)
{
// 返回
return;
}
// 獲取用戶設定的平移量
nTempH = dlgPara.m_iTempH;
nTempW = dlgPara.m_iTempW;
nTempXc = dlgPara.m_iTempMX;
nTempYc = dlgPara.m_iTempMY;
fTempC = dlgPara.m_fTempC;
// 刪除對話框
delete dlgPara;
//創建點處理CPointPro類對象
CAreaPro AreaPro( m_pDibObject );
// 更改光標形狀
BeginWaitCursor();
AreaPro.Smoothing(aValue, fTempC, nTempW, nTempH, nTempXc, nTempYc);
// 恢復光標
EndWaitCursor();
// 更新視圖
UpdateAllViews(NULL);
}
void CDipDoc::OnPointPseudocolor()
{
CDlgColor dlgPara;
// 初始化變量值
if (m_nColorIndex >= 0)
{
// 初始選中當前的偽彩色
dlgPara.m_nColor = m_nColorIndex;
}
else
{
// 初始選中灰度偽彩色編碼表
dlgPara.m_nColor = 0;
}
// 指向名稱數組的指針
dlgPara.m_lpColorName = (LPSTR) ColorScaleName;
// 偽彩色編碼數目
dlgPara.m_nColorCount = COLOR_SCALE_COUNT;
// 名稱字符串長度
dlgPara.m_nNameLen = sizeof(ColorScaleName) / COLOR_SCALE_COUNT;
// 顯示對話框,提示用戶設定平移量
if (dlgPara.DoModal() != IDOK)
{
// 返回
return;
}
// 獲取用戶的設定
int nColor = dlgPara.m_nColor;
// 刪除對話框
delete dlgPara;
CPointPro PointOperation( m_pDibObject );
// 更改光標形狀
BeginWaitCursor();
// 調用ReplaceColorPal()函數變換調色板
PointOperation.ReplaceColorPal(m_pDibObject, (BYTE*) ColorsTable[nColor]);
// 設置臟標記
//SetModifiedFlag(TRUE);
// 更新視圖
UpdateAllViews(NULL);
// 恢復光標
EndWaitCursor();
}
void CDipDoc::OnEnhaGradsharp()
{
//創建點處理CPointPro類對象
CAreaPro AreaPro( m_pDibObject );
// 更改光標形狀
BeginWaitCursor();
AreaPro.GradSharping(10);
// 恢復光標
EndWaitCursor();
// 更新視圖
UpdateAllViews(NULL);
}
void CDipDoc::OnEnhaMidianF()
{
// 窗口高度
int nTempH;
// 窗口寬度
int nTempW;
// 窗口中心元素X坐標
int nTempXc;
// 窗口中心元素Y坐標
int nTempYc;
// 排序方式
int nSortType;
// 創建對話框
CDlgMedianFilter dlgPara;
// 初始化對話框變量值
dlgPara.m_nWindowSize = 0;
dlgPara.m_iTempH = 3;
dlgPara.m_iTempW = 3;
dlgPara.m_iTempMX = 1;
dlgPara.m_iTempMY = 1;
dlgPara.m_nSortType = 0;
// 顯示對話框,提示用戶設定平移量
if (dlgPara.DoModal() != IDOK)
{
// 返回
return;
}
// 獲取用戶設定的平移量
nTempH = dlgPara.m_iTempH;
nTempW = dlgPara.m_iTempW;
nTempXc = dlgPara.m_iTempMX;
nTempYc = dlgPara.m_iTempMY;
nSortType = dlgPara.m_nSortType;
// 刪除對話框
delete dlgPara;
//創建點處理CPointPro類對象
CAreaPro AreaPro( m_pDibObject );
// 更改光標形狀
BeginWaitCursor();
AreaPro.MedianFilter(nSortType, nTempW, nTempH, nTempXc, nTempYc);
// 恢復光標
EndWaitCursor();
// 更新視圖
UpdateAllViews(NULL);
}
void CDipDoc::OnEnhaTempsharp()
{
// 模板高度
int nTempH;
// 模板寬度
int nTempW;
// 模板系數
float fTempC;
// 模板中心元素X坐標
int nTempXc;
// 模板中心元素Y坐標
int nTempYc;
// 模板元素數組
float aValue[25];
// 方向元素數組
int nDirection[8];
// 創建對話框
CEdgeDetDlg dlgPara;
// 給模板數組賦初值(為Roberts模板1)
aValue[0] = -1.0;
aValue[1] = 0.0;
aValue[2] = 0.0;
aValue[3] = 0.0;
aValue[4] = 0.0;
aValue[5] = 0.0;
aValue[6] = 1.0;
aValue[7] = 0.0;
aValue[8] = 0.0;
aValue[9] = 0.0;
aValue[10] = 0.0;
aValue[11] = 0.0;
aValue[12] = 0.0;
aValue[13] = 0.0;
aValue[14] = 0.0;
aValue[15] = 0.0;
aValue[16] = 0.0;
aValue[17] = 0.0;
aValue[18] = 0.0;
aValue[19] = 0.0;
aValue[20] = 0.0;
aValue[21] = 0.0;
aValue[22] = 0.0;
aValue[23] = 0.0;
aValue[24] = 0.0;
// 初始化對話框變量值
dlgPara.m_intType = 0;
dlgPara.m_iTempH = 3;
dlgPara.m_iTempW = 3;
dlgPara.m_iTempMX = 1;
dlgPara.m_iTempMY = 1;
dlgPara.m_fTempC = 1.0;
dlgPara.m_fpArray = aValue;
dlgPara.m_nDirection = nDirection;
// 顯示對話框,提示用戶設定平移量
if (dlgPara.DoModal() != IDOK)
{
// 返回
return;
}
// 獲取用戶設定的平移量
nTempH = dlgPara.m_iTempH;
nTempW = dlgPara.m_iTempW;
nTempXc = dlgPara.m_iTempMX;
nTempYc = dlgPara.m_iTempMY;
fTempC = dlgPara.m_fTempC;
// 刪除對話框
delete dlgPara;
//創建點處理CPointPro類對象
CAreaPro AreaPro( m_pDibObject );
// 更改光標形狀
BeginWaitCursor();
AreaPro.Sharping(aValue, nDirection);
// 恢復光標
EndWaitCursor();
// 更新視圖
UpdateAllViews(NULL);
}
void CDipDoc::OnEnhaLapsharp()
{
// 模板高度
int nTempH;
// 模板寬度
int nTempW;
// 模板系數
float fTempC;
// 模板中心元素X坐標
int nTempXc;
// 模板中心元素Y坐標
int nTempYc;
// 模板元素數組
float aValue[25];
// 創建對話框
CLapDlg dlgPara;
// 給模板數組賦初值(為平均模板)
aValue[0] = -1.0;
aValue[1] = -1.0;
aValue[2] = -1.0;
aValue[3] = 0.0;
aValue[4] = 0.0;
aValue[5] = -1.0;
aValue[6] = 9.0;
aValue[7] = -1.0;
aValue[8] = 0.0;
aValue[9] = 0.0;
aValue[10] = -1.0;
aValue[11] = -1.0;
aValue[12] = -1.0;
aValue[13] = 0.0;
aValue[14] = 0.0;
aValue[15] = 0.0;
aValue[16] = 0.0;
aValue[17] = 0.0;
aValue[18] = 0.0;
aValue[19] = 0.0;
aValue[20] = 0.0;
aValue[21] = 0.0;
aValue[22] = 0.0;
aValue[23] = 0.0;
aValue[24] = 0.0;
// 初始化對話框變量值
dlgPara.m_intType = 0;
dlgPara.m_iTempH = 3;
dlgPara.m_iTempW = 3;
dlgPara.m_iTempMX = 1;
dlgPara.m_iTempMY = 1;
dlgPara.m_fTempC = 1.0;
dlgPara.m_fpArray = aValue;
// 顯示對話框,提示用戶設定平移量
if (dlgPara.DoModal() != IDOK)
{
// 返回
return;
}
// 獲取用戶設定的平移量
nTempH = dlgPara.m_iTempH;
nTempW = dlgPara.m_iTempW;
nTempXc = dlgPara.m_iTempMX;
nTempYc = dlgPara.m_iTempMY;
fTempC = dlgPara.m_fTempC;
// 刪除對話框
delete dlgPara;
//創建點處理CPointPro類對象
CAreaPro AreaPro( m_pDibObject );
// 更改光標形狀
BeginWaitCursor();
AreaPro.LapSharping(aValue, fTempC, nTempW, nTempH, nTempXc, nTempYc);
// 恢復光標
EndWaitCursor();
// 更新視圖
UpdateAllViews(NULL);
}
void CDipDoc::OnChannelSplit()
{
//獲取應用程序類指針
CDipApp *pApp = GetApp();
//獲取主框架窗口指針
CMainFrame *pFrame = GetMainFrame();
CDibObject *red = new CDibObject(m_pDibObject);
CDibObject *green = new CDibObject(m_pDibObject);
CDibObject *blue = new CDibObject(m_pDibObject);
//創建點處理CPointPro類對象
CPointPro PointOperation( m_pDibObject );
// 更改光標形狀
BeginWaitCursor();
if (PointOperation.SplitChannels(red, green, blue))
{
POSITION posTemplate = pApp->GetFirstDocTemplatePosition();
CDocTemplate* pDocTemplate = pApp->GetNextDocTemplate(posTemplate);
CDipDoc* pDocument = (CDipDoc*) pDocTemplate->OpenDocumentFile(NULL);
pDocument->m_pDibObject = red;
pDocument->m_bImageLoaded = TRUE;
CString sSplitCaption;
AfxFormatString1(sSplitCaption, IDS_SPLIT_RED_CAPTION, GetTitle());
pDocument->SetTitle(sSplitCaption);
//獲取子框架窗口指針
CChildFrame *pChild = (CChildFrame *) pFrame->MDIGetActive();
pChild->m_nWidth = m_pDibObject->GetWidth();
pChild->m_nHeight = m_pDibObject->GetHeight();
pChild->SetWindowPos( NULL, 0, 0, pChild->m_nWidth + 12,
pChild->m_nHeight + 38, SWP_NOZORDER | SWP_NOMOVE );
pDocument->UpdateAllViews(NULL);
pDocument = (CDipDoc*) pDocTemplate->OpenDocumentFile(NULL);
pDocument->m_pDibObject = green;
pDocument->m_bImageLoaded = TRUE;
AfxFormatString1(sSplitCaption, IDS_SPLIT_GREEN_CAPTION, GetTitle());
pDocument->SetTitle(sSplitCaption);
//獲取子框架窗口指針
pChild = (CChildFrame *) pFrame->MDIGetActive();
pChild->m_nWidth = m_pDibObject->GetWidth();
pChild->m_nHeight = m_pDibObject->GetHeight();
pChild->SetWindowPos( NULL, 0, 0, pChild->m_nWidth + 12,
pChild->m_nHeight + 38, SWP_NOZORDER | SWP_NOMOVE );
pDocument->UpdateAllViews(NULL);
pDocument = (CDipDoc*) pDocTemplate->OpenDocumentFile(NULL);
pDocument->m_pDibObject = blue;
pDocument->m_bImageLoaded = TRUE;
AfxFormatString1(sSplitCaption, IDS_SPLIT_BLUE_CAPTION, GetTitle());
pDocument->SetTitle(sSplitCaption);
//獲取子框架窗口指針
pChild = (CChildFrame *) pFrame->MDIGetActive();
pChild->m_nWidth = m_pDibObject->GetWidth();
pChild->m_nHeight = m_pDibObject->GetHeight();
pChild->SetWindowPos( NULL, 0, 0, pChild->m_nWidth + 12,
pChild->m_nHeight + 38, SWP_NOZORDER | SWP_NOMOVE );
pDocument->UpdateAllViews(NULL);
}
else
AfxMessageBox(IDS_FAIL_SPLIT);
// 恢復光標
EndWaitCursor();
}
void CDipDoc::OnChannelBlue()
{
//獲取應用程序類指針
CDipApp *pApp = GetApp();
//獲取主框架窗口指針
CMainFrame *pFrame = GetMainFrame();
CDibObject *blue = new CDibObject(m_pDibObject);
//創建點處理CPointPro類對象
CPointPro PointOperation( m_pDibObject );
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -