rawdevelopdlg.cpp
来自「canon 相机SDK,非常难得」· C++ 代码 · 共 1,977 行 · 第 1/4 页
CPP
1,977 行
}
/* Image data is acquired. */
err = CDOpenImage( hImage );
if( GETERRORID(err) != cdOK )
{
goto camerr;
}
err = CDGetPicture( hImage, &hImgData );
if( GETERRORID(err) != cdOK )
{
CDCloseImage( hImage );
goto camerr;
}
/* A setup of development is reflected. */
fRes = SetDevelopParam( hImgData, m_DevFaculty, &err );
if( fRes == FALSE )
{
if( GETERRORID(err) != cdOK )
{
CDCloseImage( hImage );
goto camerr;
}
else
{
CDCloseImage( hImage );
goto apierr;
}
}
/* Development processing is performed. */
fRes = CPrg.StartDevelop( hImgData,
destFormat,
cdMEMTYPE_FILE,
szPath );
if( fRes == FALSE )
{
CDCloseImage( hImage );
goto apierr;
}
else if( GETERRORID(CPrg.m_LastErr) == cdOPERATION_CANCELLED )
{
CDCloseImage( hImage );
CDUnlockUI( m_hSource );
return;
}
else if( GETERRORID(CPrg.m_LastErr) != cdOK )
{
err = CPrg.m_LastErr;
CDCloseImage( hImage );
goto camerr;
}
err = CDCloseImage( hImage );
if( GETERRORID(err) != cdOK )
{
goto camerr;
}
/* The lock of UI is canceled. */
err = CDUnlockUI( m_hSource );
if( GETERRORID(err) != cdOK )
{
goto camerr;
}
return;
camerr:
char szErrStr[256];
wsprintf( szErrStr, "ErrorCode = 0x%08X", err );
MessageBox( szErrStr );
CDUnlockUI( m_hSource );
return;
apierr:
MessageBox( "API Error" );
CDUnlockUI( m_hSource );
return;
}
void CRawDevelopDlg::OnSelchangeFile()
{
// TODO: Add your control notification handler code here
cdError err;
cdHImageItem hImage;
cdHImageData hImgData;
/* The handle of the item chosen is acquired. */
hImage = (cdHImageItem)m_CFile.GetItemData( m_CFile.GetCurSel() );
if(!hImage) return;
/* UI is locked so that information may not be changed. */
err = CDLockUI( m_hSource );
if( GETERRORID(err) != cdOK )
{
goto camerr;
}
/* Image data is acquired. */
err = CDOpenImage( hImage );
if( GETERRORID(err) != cdOK )
{
goto camerr;
}
err = CDGetPicture( hImage, &hImgData );
if( GETERRORID(err) != cdOK )
{
CDCloseImage( hImage );
goto camerr;
}
/* The data of the image chosen is acquired. */
err = CDGetRAWDevFaculty( hImgData, &m_DevFaculty );
if( GETERRORID(err) != cdOK )
{
CDCloseImage( hImage );
goto camerr;
}
/* The state of control is changed in accordance with the selected file. */
SetDevCtrlState( m_DevFaculty );
err = CDCloseImage( hImage );
if( GETERRORID(err) != cdOK )
{
goto camerr;
}
/* The lock of UI is canceled. */
err = CDUnlockUI( m_hSource );
if( GETERRORID(err) != cdOK )
{
goto camerr;
}
return;
camerr:
char szErrStr[256];
wsprintf( szErrStr, "ErrorCode = 0x%08X", err );
MessageBox( szErrStr );
CDUnlockUI( m_hSource );
}
void CRawDevelopDlg::OnSelchangeGammasrc()
{
// TODO: Add your control notification handler code here
/* The input of data is enabled only at the time of cdGAMMA_SRC_SPECIFIED_PARAM. */
if( m_CGammaSrc.GetItemData( m_CGammaSrc.GetCurSel() ) == cdGAMMA_SRC_SPECIFIED_PARAM )
{
m_CGammaTblY3.EnableWindow( TRUE );
m_CGammaTblY2.EnableWindow( TRUE );
m_CGammaTblY1.EnableWindow( TRUE );
m_CGammaTblY0.EnableWindow( TRUE );
m_CGammaTblX3.EnableWindow( TRUE );
m_CGammaTblX2.EnableWindow( TRUE );
m_CGammaTblX1.EnableWindow( TRUE );
m_CGammaTblX0.EnableWindow( TRUE );
}
else
{
m_CGammaTblY3.EnableWindow( FALSE );
m_CGammaTblY2.EnableWindow( FALSE );
m_CGammaTblY1.EnableWindow( FALSE );
m_CGammaTblY0.EnableWindow( FALSE );
m_CGammaTblX3.EnableWindow( FALSE );
m_CGammaTblX2.EnableWindow( FALSE );
m_CGammaTblX1.EnableWindow( FALSE );
m_CGammaTblX0.EnableWindow( FALSE );
}
}
void CRawDevelopDlg::OnSelchangeWbLightsrc()
{
// TODO: Add your control notification handler code here
/* A setup of the parameter of each light source is enabled. */
switch( m_CWBLightSrc.GetItemData( m_CWBLightSrc.GetCurSel() ) )
{
case cdWB_BY_POS:
m_CWBPosX.EnableWindow( TRUE );
m_CWBPosY.EnableWindow( TRUE );
m_CWBKelvin.EnableWindow( FALSE );
m_CWBCofficient.EnableWindow( FALSE );
m_CWBBrowse.EnableWindow( FALSE );
break;
case cdWB_USE_COEFFICIENT:
m_CWBPosX.EnableWindow( FALSE );
m_CWBPosY.EnableWindow( FALSE );
m_CWBKelvin.EnableWindow( FALSE );
m_CWBCofficient.EnableWindow( TRUE );
m_CWBBrowse.EnableWindow( TRUE );
break;
case cdWB_KELVIN:
m_CWBPosX.EnableWindow( FALSE );
m_CWBPosY.EnableWindow( FALSE );
m_CWBKelvin.EnableWindow( TRUE );
m_CWBCofficient.EnableWindow( FALSE );
m_CWBBrowse.EnableWindow( FALSE );
break;
default:
m_CWBPosX.EnableWindow( FALSE );
m_CWBPosY.EnableWindow( FALSE );
m_CWBKelvin.EnableWindow( FALSE );
m_CWBCofficient.EnableWindow( FALSE );
m_CWBBrowse.EnableWindow( FALSE );
break;
}
}
void CRawDevelopDlg::OnWbBrowse()
{
// TODO: Add your control notification handler code here
CFileDialog CGetPath( TRUE,
NULL,
NULL,
OFN_HIDEREADONLY | OFN_NONETWORKBUTTON | OFN_PATHMUSTEXIST,
"All Files (*.*)|*.*||",
this );
if( CGetPath.DoModal() != IDOK )
{
return;
}
CString CSavePath;
CSavePath = CGetPath.GetPathName();
m_CWBCofficient.SetWindowText( CSavePath );
}
void CRawDevelopDlg::OnSelchangeFormat()
{
// TODO: Add your control notification handler code here
switch( m_CFormat.GetItemData( m_CFormat.GetCurSel() ) )
{
case cdFORMAT_TIFF_16:
case cdFORMAT_PIXMAP_16:
m_CLinear.EnableWindow( TRUE );
break;
default:
m_CLinear.SetCheck( 0 );
m_CLinear.EnableWindow( FALSE );
break;
}
}
void CRawDevelopDlg::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your control notification handler code here
cdError err;
char szErrStr[256];
/* End processing of CDSDK is performed. */
err = CDFinishSDK();
if( GETERRORID(err) != cdOK )
{
wsprintf( szErrStr, "ErrorCode = 0x%08X", err );
MessageBox( szErrStr );
}
}
void CRawDevelopDlg::OnSelchangeEdgelevel()
{
// TODO: Add your control notification handler code here
/* Selection of Frequency is made impossible when a level is 0. */
if( m_CEdgeLevel.GetCurSel() == 0 )
{
m_CEdgeFreq.EnableWindow( FALSE );
}
else
{
m_CEdgeFreq.EnableWindow( TRUE );
}
}
void CRawDevelopDlg::OnEdgeatcapture()
{
// TODO: Add your control notification handler code here
/*Selection of a level and Frequency of the case of ATCAPTURE is made impossible.*/
if( m_CEdgeAdcap.GetCheck() )
{
m_CEdgeLevel.EnableWindow( FALSE );
m_CEdgeFreq.EnableWindow( FALSE );
}
else
{
m_CEdgeLevel.EnableWindow( TRUE );
if( m_CEdgeLevel.GetCurSel() == 0 )
{
m_CEdgeFreq.EnableWindow( FALSE );
}
else
{
m_CEdgeFreq.EnableWindow( TRUE );
}
}
}
void CRawDevelopDlg::OnKillfocusDegitalgain()
{
// TODO: Add your control notification handler code here
int iDigitalGain;
char szText[256];
m_CDigitalGain.GetWindowText( szText, 256 );
iDigitalGain = atoi( szText );
if( iDigitalGain < -20 )
{
m_CDigitalGain.SetWindowText( "-20" );
}
else if( iDigitalGain > 20 )
{
m_CDigitalGain.SetWindowText( "20" );
}
}
void CRawDevelopDlg::OnKillfocusWbKelvin()
{
// TODO: Add your control notification handler code here
int iKelvin;
char szText[256];
m_CWBKelvin.GetWindowText( szText, 256 );
iKelvin = atoi( szText );
if( iKelvin < 2800 )
{
m_CWBKelvin.SetWindowText( "2800" );
}
else if( iKelvin > 10000 )
{
m_CWBKelvin.SetWindowText( "10000" );
}
}
void CRawDevelopDlg::OnKillfocusGammatblX0()
{
// TODO: Add your control notification handler code here
int iGammaPos,iCheck;
char szText[256];
m_CGammaTblX0.GetWindowText( szText, 256 );
iGammaPos = atoi( szText );
iCheck = CheckGammaRange( iGammaPos );
if( iCheck != iGammaPos )
{
itoa( iCheck, szText, 10 );
m_CGammaTblX0.SetWindowText( szText );
}
}
void CRawDevelopDlg::OnKillfocusGammatblX1()
{
// TODO: Add your control notification handler code here
int iGammaPos,iCheck;
char szText[256];
m_CGammaTblX1.GetWindowText( szText, 256 );
iGammaPos = atoi( szText );
iCheck = CheckGammaRange( iGammaPos );
if( iCheck != iGammaPos )
{
itoa( iCheck, szText, 10 );
m_CGammaTblX1.SetWindowText( szText );
}
}
void CRawDevelopDlg::OnKillfocusGammatblX2()
{
// TODO: Add your control notification handler code here
int iGammaPos,iCheck;
char szText[256];
m_CGammaTblX2.GetWindowText( szText, 256 );
iGammaPos = atoi( szText );
iCheck = CheckGammaRange( iGammaPos );
if( iCheck != iGammaPos )
{
itoa( iCheck, szText, 10 );
m_CGammaTblX2.SetWindowText( szText );
}
}
void CRawDevelopDlg::OnKillfocusGammatblX3()
{
// TODO: Add your control notification handler code here
int iGammaPos,iCheck;
char szText[256];
m_CGammaTblX3.GetWindowText( szText, 256 );
iGammaPos = atoi( szText );
iCheck = CheckGammaRange( iGammaPos );
if( iCheck != iGammaPos )
{
itoa( iCheck, szText, 10 );
m_CGammaTblX3.SetWindowText( szText );
}
}
void CRawDevelopDlg::OnKillfocusGammatblY0()
{
// TODO: Add your control notification handler code here
int iGammaPos,iCheck;
char szText[256];
m_CGammaTblY0.GetWindowText( szText, 256 );
iGammaPos = atoi( szText );
iCheck = CheckGammaRange( iGammaPos );
if( iCheck != iGammaPos )
{
itoa( iCheck, szText, 10 );
m_CGammaTblY0.SetWindowText( szText );
}
}
void CRawDevelopDlg::OnKillfocusGammatblY1()
{
// TODO: Add your control notification handler code here
int iGammaPos,iCheck;
char szText[256];
m_CGammaTblY1.GetWindowText( szText, 256 );
iGammaPos = atoi( szText );
iCheck = CheckGammaRange( iGammaPos );
if( iCheck != iGammaPos )
{
itoa( iCheck, szText, 10 );
m_CGammaTblY1.SetWindowText( szText );
}
}
void CRawDevelopDlg::OnKillfocusGammatblY2()
{
// TODO: Add your control notification handler code here
int iGammaPos,iCheck;
char szText[256];
m_CGammaTblY2.GetWindowText( szText, 256 );
iGammaPos = atoi( szText );
iCheck = CheckGammaRange( iGammaPos );
if( iCheck != iGammaPos )
{
itoa( iCheck, szText, 10 );
m_CGammaTblY2.SetWindowText( szText );
}
}
void CRawDevelopDlg::OnKillfocusGammatblY3()
{
// TODO: Add your control notification handler code here
int iGammaPos,iCheck;
char szText[256];
m_CGammaTblY3.GetWindowText( szText, 256 );
iGammaPos = atoi( szText );
iCheck = CheckGammaRange( iGammaPos );
if( iCheck != iGammaPos )
{
itoa( iCheck, szText, 10 );
m_CGammaTblY3.SetWindowText( szText );
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?