LSegment::MrcSaveBitmapList

#include "ltwrappr.h"

#include "ltsgm.h"

L_INT LSegment::MrcSaveBitmapList( hSegmentList, uhSegmentCount, hList, pCmpOption, pszFileName, nFormat)

HSEGMENTATION * hSegmentList;

/* segmentation handles */

L_UINT32 uhSegmentCount;

/* segmentation handles count */

HBITMAPLIST hList;

/* handle to a list of bitmaps */

pCOMPRESSIONOPTIONS pCmpOption;

/* pointer to the compression options structure */

L_TCHAR * pszFileName;

/* output file name */

L_INT nFormat;

/* output file format */

Saves MRC images contained in a bitmap list to a file using the MRC LEAD, standard Proprietary T44 or PDF format.

Parameter

Description

hSegmentList

An array of segmentation handles. This handle is obtained by calling the LSegment::MrcStartBitmapSegmentation function.

uhSegmentCount

Number of segmentations.

hList

Handle to the list of bitmaps that holds the image data.

pCmpOption

Pointer to the COMPRESSIONOPTIONS structure that contains the compression information to use when saving the file.

pszFileName

Character string that contains the output file name.

nFormat

Output file format. Possible values are:

 

Value

Meaning

 

FILE_TIF_MRC

[177] Tagged Image File with standard MRC Compression (Standard T44). (Supports multi-page).

 

FILE_PDF_LEAD_MRC

[338] PDF compression using MRC segmentation technique.

 

FILE_TIF_LEAD_MRC

[315] Tagged Image File with LEAD proprietary MRC. (Supports multi-page). The default file extension is *.TIF.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Use this function to save a list of bitmaps as a TIF file using the Standard T44 format (if the nFormat value is FILE_TIF_MRC), as a TIF file with a LEAD MRC subtype format (if the nFormat value is FILE_TIF_LEAD_MRC), or as a multipage PDF using segmentation capabilities (if the nFormat value is FILE_PDF_LEAD_MRC). If nFormat is FILE_TIF_MRC or FILE_TIF_LEAD_MRC, *.TIF is the default file extension. If nFormat is FILE_PDF_LEAD_MRC, *.PDF is the default file extension.

Use the LSegment::MrcSaveBitmapList function to save a list of bitmaps as a TIF file with a Standard T44 subtype format, LEAD MRC subtype format, or PDF file, based on the LEAD segmentation technique, if you want to:

All formats supported by this function generate multi-page files (TIF, or PDF). The number of pages in the file is either uhSegmentCount or the number of images in hList, whichever is smaller.

Use the LSegment::MrcSaveBitmapT44, or LSegment::MrcSaveBitmap functions to save a single image or to append, inset overwrite to already existing TIF file.

It is best to perform segmentation for all images in the list before calling the LSegment::MrcSaveBitmapList 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::MrcSaveBitmapList function, segments can be any of the following types:

 

SEGTYPE_BACKGROUND

SEGTYPE_ONECOLOR

SEGTYPE_TEXT_1BIT_BW

SEGTYPE_TEXT_1BIT_COLOR

SEGTYPE_TEXT_2BITBW

SEGTYPE_TEXT_2BIT_COLOR

SEGTYPE_GRAYSCALE_2BIT

SEGTYPE_GRAYSCALE_8BIT

SEGTYPE_PICTURE

If the bitmap hasnt been segmented, or has any NULL element, then the function will automatically segment the bitmaps in hList by calling LSegment::MrcSegmentBitmap. 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 (1-bit), 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, and the nGrayscale8BitQFactor members of the COMPRESSIONOPTIONS structure are used only with the FILE_TIF_LEAD_MRC formats. The nText2BitCoder member of the COMPRESSIONOPTIONS structure is used with the FILE_TIF_LEAD_MRC and FILE_PDF_LEAD_MRC formats only.

Required DLLs and Libraries

LTSGM

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LSegment::MrcSaveBitmapT44, LSegment::MrcLoadBitmap, LSegment::MrcGetPagesCount, LSegment::MrcSegmentBitmap, Class Members

Topics:

Saving Capabilities

 

C++ Class Library Function Groups

Example

L_INT LSegment__MrcSaveBitmapListExample(LSegment& LeadSegment, L_UINT uhSegments, HBITMAPLIST hList, L_TCHAR* pszFileName)
{
   L_INT                nRet; 
   COMPRESSIONOPTIONS   CmpOption; 
   /* 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 list using the LEAD Proprietary T44 Format */
   nRet = LeadSegment.MrcSaveBitmapList(NULL, uhSegments, hList, &CmpOption, pszFileName, FILE_TIF_LEAD_MRC); 
   return nRet; 
}