SaveJ2KUseColorTransform Example for C++ 5.0 and later
void CDialogs::OnShowSaveDlg()
{
int nRet;
m_pRasterFileDlg->DialogTitle = "Save a File";
m_pRasterFileDlg->FileDlgFlags = 0;
m_pRasterFileDlg->InitialDir = "C:\\";
m_pRasterFileDlg->SaveMulti = MULTIPAGE_OVERWRITE;
m_pRasterFileDlg->UIFlags = SAVE_SHOW_FILEOPTIONS_PROGRESSIVE |
SAVE_SHOW_FILEOPTIONS_MULTIPAGE |
SAVE_SHOW_FILEOPTIONS_STAMP |
SAVE_SHOW_FILEOPTIONS_QFACTOR |
SAVE_SHOW_FILEOPTIONS_J2KOPTIONS |
SAVE_SHOW_FILEOPTIONS_BASICJ2KOPTIONS;
m_pRasterFileDlg->Bitmap = m_LeadRasterView.GetRaster().GetBitmap ();
nRet= m_pRasterFileDlg->ShowSaveDlg ((long) this->m_hWnd);
if ( nRet == 0 && m_pRasterFileDlg->DialogStatus == DLG_OK)
{
if ( (m_pRasterFileDlg->SaveFormat == FILE_J2K) ||
(m_pRasterFileDlg->SaveFormat == FILE_JP2) )
{
m_pRasterFileDlg->SaveJ2KUseColorTransform;
m_pRasterIO->J2KDerivedQuantization = m_pRasterFileDlg->SaveJ2KDerivedQuantization;
m_pRasterIO->J2KCompressionControl = m_pRasterFileDlg->GetSaveJ2KCompressionControl();
m_pRasterIO->J2KCompressionRatio = m_pRasterFileDlg->SaveJ2KCompressionRatio;
m_pRasterIO->J2KTargetFileSize = m_pRasterFileDlg->SaveJ2KTargetFileSize;
m_pRasterIO->J2KXOsiz = m_pRasterFileDlg->SaveJ2KXOsiz;
m_pRasterIO->J2KYOsiz = m_pRasterFileDlg->SaveJ2KYOsiz;
m_pRasterIO->J2KXTsiz = m_pRasterFileDlg->SaveJ2KXTsiz;
m_pRasterIO->J2KYTsiz = m_pRasterFileDlg->SaveJ2KYTsiz;
m_pRasterIO->J2KXTOsiz = m_pRasterFileDlg->SaveJ2KXTOsiz;
m_pRasterIO->J2KYTOsiz = m_pRasterFileDlg->SaveJ2KYTOsiz;
m_pRasterIO->J2KDecompLevel = m_pRasterFileDlg->SaveJ2KDecompLevel;
m_pRasterIO->J2KProgressOrder = m_pRasterFileDlg->GetSaveJ2KProgressOrder();
m_pRasterIO->J2KCodBlockWidth = m_pRasterFileDlg->SaveJ2KCodBlockWidth;
m_pRasterIO->J2KCodBlockHeight = m_pRasterFileDlg->SaveJ2KCodBlockHeight;
m_pRasterIO->J2KCBS_SelectiveACBypass = m_pRasterFileDlg->SaveJ2KCBS_SelectiveACBypass;
m_pRasterIO->J2KCBS_ResetContextOnBoundaries = m_pRasterFileDlg->SaveJ2KCBS_ResetContextOnBoundaries;
m_pRasterIO->J2KCBS_TerminationOnEachPass = m_pRasterFileDlg->SaveJ2KCBS_TerminationOnEachPass;
m_pRasterIO->J2KCBS_VerticallyCausalContext = m_pRasterFileDlg->SaveJ2KCBS_VerticallyCausalContext;
m_pRasterIO->J2KCBS_PredictableTermination = m_pRasterFileDlg->SaveJ2KCBS_PredictableTermination;
m_pRasterIO->J2KCBS_ErrorResilienceSymbol = m_pRasterFileDlg->SaveJ2KCBS_ErrorResilienceSymbol;
m_pRasterIO->J2KGuardBits = m_pRasterFileDlg->SaveJ2KGuardBits;
m_pRasterIO->J2KDerivedBaseMantissa = m_pRasterFileDlg->SaveJ2KDerivedBaseMantissa;
m_pRasterIO->J2KDerivedBaseExponent = m_pRasterFileDlg->SaveJ2KDerivedBaseExponent;
m_pRasterIO->J2KUseSOPMarker = m_pRasterFileDlg->SaveJ2KUseSOPMarker;
m_pRasterIO->J2KUseEPHMarker = m_pRasterFileDlg->SaveJ2KUseEPHMarker;
nRet = m_pRasterIO->Save (m_LeadRasterView2.GetRaster(),
m_pRasterFileDlg->FileName,
(RasterFileConstants) m_pRasterFileDlg->SaveFormat,
m_pRasterFileDlg->SaveBitsPerPixel,
(QFactorConstants)m_pRasterFileDlg->SaveQFactor,
0);
m_pRasterIO->J2KSetDefaults ();
m_pRasterIO->J2KCompressionControl = J2K_COMP_LOSSLESS;
m_pRasterIO->Save (m_LeadRasterView2.GetRaster(), m_pRasterFileDlg->FileName, FILE_J2K, 0, (QFactorConstants) 0, SAVE_OVERWRITE);
}
}
}