Available in the LEADTOOLS Imaging toolkit. |
JBIG2GBATX1 Example for C++ 5.0 and later
ILEADRasterDlgFile * pRasterFileDlg
= NULL;
ILEADRasterIO * pRasterIO = NULL;
CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL,
IID_ILEADRasterIO, (void**)&pRasterIO);
CoCreateInstance(CLSID_LEADRasterDlgFile, NULL, CLSCTX_ALL,
IID_ILEADRasterDlgFile, (void**)&pRasterFileDlg);
m_RasterView.GetRaster().UnlockSupport(L_SUPPORT_JBIG2,
L_KEY_JBIG2);
pRasterIO->Load(m_RasterView.GetRaster(), TEXT("c:\\1.jpg"),
0, 0, 1);
int nRet = 0;
pRasterFileDlg->DialogTitle = "Save a File";
pRasterFileDlg->FileDlgFlags = 0;
pRasterFileDlg->InitialDir = "C:\\";
pRasterFileDlg->SaveMulti = MULTIPAGE_OVERWRITE;
pRasterFileDlg->UIFlags = SAVE_AUTOPROCESS
|
SAVE_SHOW_FILEOPTIONS_PROGRESSIVE
|
SAVE_SHOW_FILEOPTIONS_MULTIPAGE
|
SAVE_SHOW_FILEOPTIONS_STAMP
|
SAVE_SHOW_FILEOPTIONS_QFACTOR
|
SAVE_SHOW_FILEOPTIONS_J2KOPTIONS
|
SAVE_SHOW_FILEOPTIONS_BASICJ2KOPTIONS
|
SAVE_SHOW_FILEOPTIONS_JBIG2OPTIONS;
pRasterFileDlg->Bitmap = m_LeadRasterView.GetRaster
().GetBitmap ();
nRet = pRasterFileDlg->ShowSaveDlg ((long)this->m_hWnd);
if ( nRet == 0 && pRasterFileDlg->DialogStatus
==DLG_OK )
{
if (pRasterFileDlg->SaveFormat ==
FILE_JBIG2 ||
pRasterFileDlg->SaveFormat
== FILE_RAS_PDF_JBIG2 ||
pRasterFileDlg->SaveFormat
== FILE_TIF_JBIG2)
{
pRasterIO->JBIG2ImageGBATX1
= pRasterFileDlg->JBIG2ImageGBATX1;
pRasterIO->JBIG2ImageGBATY1
= pRasterFileDlg->JBIG2ImageGBATY1;
pRasterIO->JBIG2ImageGBATX2
= pRasterFileDlg->JBIG2ImageGBATX2;
pRasterIO->JBIG2ImageGBATY2
= pRasterFileDlg->JBIG2ImageGBATY2;
pRasterIO->JBIG2ImageGBATX3
= pRasterFileDlg->JBIG2ImageGBATX3;
pRasterIO->JBIG2ImageGBATY3
= pRasterFileDlg->JBIG2ImageGBATY3;
pRasterIO->JBIG2ImageGBATX4
= pRasterFileDlg->JBIG2ImageGBATX4;
pRasterIO->JBIG2ImageGBATY4
= pRasterFileDlg->JBIG2ImageGBATY4;
pRasterIO->JBIG2ImageTemplateType
= pRasterFileDlg->JBIG2ImageTemplateType;
pRasterIO->JBIG2ImageFlags
= pRasterFileDlg->JBIG2ImageFlags;
pRasterIO->JBIG2ImageQFactor
= pRasterFileDlg->JBIG2ImageQFactor;
pRasterIO->JBIG2TextGBATX1
= pRasterFileDlg->JBIG2TextGBATX1;
pRasterIO->JBIG2TextGBATY1
= pRasterFileDlg->JBIG2TextGBATY1;
pRasterIO->JBIG2TextGBATX2
= pRasterFileDlg->JBIG2TextGBATX2;
pRasterIO->JBIG2TextGBATY2
= pRasterFileDlg->JBIG2TextGBATY2;
pRasterIO->JBIG2TextGBATX3
= pRasterFileDlg->JBIG2TextGBATX3;
pRasterIO->JBIG2TextGBATY3
= pRasterFileDlg->JBIG2TextGBATY3;
pRasterIO->JBIG2TextGBATX4
= pRasterFileDlg->JBIG2TextGBATX4;
pRasterIO->JBIG2TextGBATY4
= pRasterFileDlg->JBIG2TextGBATY4;
pRasterIO->JBIG2TextTemplateType
= pRasterFileDlg->JBIG2TextTemplateType;
pRasterIO->JBIG2TextFlags
= pRasterFileDlg->JBIG2TextFlags;
pRasterIO->JBIG2TextQFactor
= pRasterFileDlg->JBIG2TextQFactor;
pRasterIO->JBIG2TextMinSymArea
= pRasterFileDlg->JBIG2TextMinSymArea;
pRasterIO->JBIG2TextMinSymWidth
= pRasterFileDlg->JBIG2TextMinSymWidth;
pRasterIO->JBIG2TextMinSymHeight
= pRasterFileDlg->JBIG2TextMinSymHeight;
pRasterIO->JBIG2TextMaxSymArea
= pRasterFileDlg->JBIG2TextMaxSymArea;
pRasterIO->JBIG2TextMaxSymWidth
= pRasterFileDlg->JBIG2TextMaxSymWidth;
pRasterIO->JBIG2TextMaxSymHeight
= pRasterFileDlg->JBIG2TextMaxSymHeight;
pRasterIO->JBIG2TextDifThreshold
= pRasterFileDlg->JBIG2TextDifThreshold;
pRasterIO->JBIG2YResolution
= pRasterFileDlg->JBIG2YResolution;
pRasterIO->JBIG2XResolution
= pRasterFileDlg->JBIG2XResolution;
pRasterIO->JBIG2Flags
= pRasterFileDlg->JBIG2Flags;
pRasterIO->Save
(m_RasterView.GetRaster(),pRasterFileDlg->FileName, (RasterFileConstants)
pRasterFileDlg->SaveFormat, 1, QFACTOR_LEAD_0, 0);
}
}
if(pRasterIO)
pRasterIO->Release();
if(pRasterFileDlg)
pRasterFileDlg->Release();