SaveList example for Visual C++

void CSegDemoApp::OnFileSaveMulti() 
{
   int nRet =0;
   ILEADRasterMrc * pRasterMrc1 = NULL;
   ILEADRasterMrc * pRasterMrc2 = NULL;
   ILEADRasterIO  * pRasterIO = NULL;
   ILEADRaster *pRaster =NULL;
   ILEADRaster *pRasterList =NULL;

   CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&pRaster); 
   CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&pRasterList); 
   CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&pRasterIO); 
   CoCreateInstance(CLSID_LEADRasterMrc, NULL, CLSCTX_ALL, IID_ILEADRasterMrc, (void**)&pRasterMrc1); 
   CoCreateInstance(CLSID_LEADRasterMrc, NULL, CLSCTX_ALL, IID_ILEADRasterMrc, (void**)&pRasterMrc2);

   pRasterIO->Load(pRaster, TEXT("c:\\1.jpg"), 0, 0, 1);
   nRet = pRasterMrc1->AutoSegmentExt(pRaster, 5, 50, 25, 10, 75, SGM_WITHOUTBKGRND | SGM_FAVOR_TWOBIT);
   pRasterList->InsertBitmapListItem(-1, pRaster->Bitmap);

   pRasterIO->Load (pRaster, TEXT("c:\\2.jpg"), 0, 0, 1);
   nRet = pRasterMrc2->AutoSegmentExt(pRaster, 5, 50, 25, 10, 75, SGM_WITHOUTBKGRND | SGM_FAVOR_TWOBIT);
   pRasterList->InsertBitmapListItem (-1, pRaster->Bitmap);

   pRasterIO->PutMRCRasterCount(2);
   pRasterIO->PutMRCRaster(0, pRasterMrc1);
   pRasterIO->PutMRCRaster(1, pRasterMrc2);

   pRasterIO->PutMaskCoder(MRC_MASK_COMPRESSION_FAX_G3_1D);
   pRasterIO->PutPictureCoder(MRC_PICTURE_COMPRESSION_JPEG);
   pRasterIO->PutPictureQFactor(10);
   pRasterIO->PutGrayscale8BitCoder(MRC_GRAYSCALE_COMPRESSION_GRAYSCALE_CMW_8BIT);
   pRasterIO->PutGrayscale8BitQFactor(2);
   pRasterIO->PutGrayscale2BitCoder(MRC_GRAYSCALE_COMPRESSION_JBIG_2BIT);
   pRasterIO->PutText2BitCoder(MRC_TEXT_COMPRESSION_JBIG_2BIT);

   nRet = pRasterIO->SaveList(pRasterList, TEXT("c:\\Multi.tif"), FILE_TIF_MRC);

   if(pRasterMrc1)
   {
      pRasterMrc1->Release();
   }
   if(pRasterMrc2)
   {
      pRasterMrc2->Release();
   }
   if(pRasterIO)
   {
      pRasterIO->Release();
   }
   if(pRaster)
   {
      pRaster->Release();
   }
   if(pRasterList)
   {
      pRasterList->Release();
   }
}