Saves an MRC image contained in a bitmap to a file using the LEAD Proprietary T44 format.
L_INT LSegment::MrcSaveBitmap(pBitmap, pCmpOption, pszFileName, nFormat, pSaveOptions)
Pointer to an LBitmapBase object that references the bitmap to be saved.
Pointer to the COMPRESSIONOPTIONS structure that contains the compression information to use when saving the file.
Character string that contains the output file name.
Output file format. Possible values are:
|FILE_LEAD_MRC|| LEAD Proprietary MRC. The default file extension is *.MRC.|
|FILE_TIF_LEAD_MRC|| Tagged Image File with LEAD proprietary MRC. (Supports multipage). The default file extension is *.TIF.|
|FILE_PDF_LEAD_MRC|| PDF compression using MRC segmentation.|
Pointer to optional extended save options. Pass NULL to use the default save options.
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
Use this function to save the bitmap in one of the LEAD Proprietary MRC formats: either as a LEAD proprietary MRC format file (if the nFormat value is FILE_LEAD_MRC), as a TIF file with a LEAD MRC subtype format (if the nFormat value is FILE_TIF_LEAD_MRC or as multiple document PDF using segmentation capabilities (if the nFormat value is FILE_PDF_LEAD_MRC). When an nFormat value of FILE_LEAD_MRC is used, *.MRC is the default file extension. When an nFormat value of FILE_TIF_LEAD_MRC or *.TIF is the default file extension.
When an nFormat value of FILE_PDF_LEAD_MRC, *.PDF is the default file extension.
Use the LSegment::MrcSaveBitmap function to save a file in one of the LEAD proprietary MRC formats or PDF file based on LEAD segmentation technique if you want to:
Take advantage of the greater number of different segment types available when using the proprietary format.
Create smaller files than would be possible by saving them to the Standard T44 format.
Create higher quality files than would be possible by saving them to the Standard T44 format.
The LEAD proprietary MRC and PDF format files are single-page file formats, while the TIF file with a LEAD MRC subtype formats are multipaged.
Use the LSegment::MrcSaveBitmapT44 function to save a file if it is necessary that the file be readable by any application that supports the T44 standard.
It is best to perform segmentation before calling the LSegment::MrcSaveBitmap function. Segmentation can be performed automatically by calling the LSegment::MrcSegmentBitmap function, or performed manually by calling the LSegment::MrcCreateNewSegment function.. Call the LSegment::MrcStartBitmapSegmentation function before calling any of the segmentation methods. When the LSegment class object is no longer needed, free it by calling the LSegment::MrcStopBitmapSegmentation function. For more information on segmentation, refer to General Segmentation, Auto-Segmentation, and Manual Segmentation.
When using the LSegment::MrcSaveBitmap function, segments can be any of the following types:
If the bitmap hasnt been segmented, then the function will automatically segment the bitmap by calling LSegment::MrcSegmentBitmap and then save the image file. The LSegment::MrcSegmentBitmap function maps the text, grayscale and picture segments into layers (mask, background and foreground layers) as defined in the NLS* model of the T.44 standard. A segment is a rectangular area on the bitmap that can be classified as text, grayscale, or picture, depending on the number of colors used in its area. The Mixed Raster Content (MRC) format was developed by the International Telecommunications Union as part of ITU-T Recommendation T.44. For more information on Mixed Raster Content (MRC) formats, refer to General Information.
If the pCmpOption parameter is NULL, then the function will use Fax G4 compression for the mask layer, JPEG compression for the 24 bit image segments and 2 for the quality factor, JPEG compression for the 8 bit grayscale segments and 2 for the quality factor, and JBIG compression for the 2 bit text and 2 bit grayscale segments. For more information, refer to COMPRESSIONOPTIONS. Note that the nGrayscale2BitCoder, the nGrayscale8BitCoder, the nGrayscale8BitQFactor, and the nText2BitCoder members of the COMPRESSIONOPTIONS. structure is used with the FILE_TIF_LEAD_MRC and FILE_PDF_LEAD_MRC formats only.
Control page replacement/insertion operations using some of the member values available in the SAVEFILEOPTION structure.
*NLS (N-Layer stripe) means that each stripe may contain one or more mask layers, foreground layers, and background layers.
The following example demonstrates the use of LSegment::MrcSaveBitmap to save a bitmap.
L_INT LSegment__MrcSaveBitmapExample(LSegment Segment, LBitmapBase & Bitmap, L_TCHAR * pszFileName)
/* Initialize the compression structure */
CmpOption.uStructSize = sizeof(COMPRESSIONOPTIONS);
CmpOption.nMaskCoder = MRC_MASK_COMPRESSION_FAX_G3_1D;
CmpOption.nPictureCoder = MRC_PICTURE_COMPRESSION_JPEG;
CmpOption.nPictureQFactor = 10;
CmpOption.nGrayscale8BitCoder = MRC_GRAYSCALE_COMPRESSION_GRAYSCALE_CMW_8BIT;
CmpOption.nGrayscale8BitFactor = 2;
CmpOption.nGrayscale2BitCoder = MRC_GRAYSCALE_COMPRESSION_JBIG_2BIT;
CmpOption.nText2BitCoder = MRC_TEXT_COMPRESSION_JBIG_2BIT;
/* Save the MRC bitmap using the LEAD Proprietary T44 Format */
nRet = Segment.MrcSaveBitmap(&Bitmap, &CmpOption, pszFileName, FILE_LEAD_MRC, NULL);
if (nRet != SUCCESS)