LSegment::MrcSaveBitmapT44

Summary

Saves an MRC image contained in a bitmap to a file using the Standard T44 format.

Syntax

#include "ltwrappr.h"

L_INT LSegment::MrcSaveBitmapT44(pBitmap, pCmpOption, pszFileName, nFormat, pSaveOptions)

Parameters

LBitmapBase * pBitmap

Pointer to an LBitmapBase object that references the bitmap to be saved.

pCOMPRESSIONOPTIONS pCmpOption

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

L_TCHAR * pszFileName

Character string that contains the output file name.

L_INT nFormat

Output file format. Possible values are:

Value Meaning
FILE_MRC [168] Standard MRC Compression. The default file extension is *.MRC.
FILE_TIF_MRC [177] Tagged Image File with standard MRC Compression. (Supports multipage). The default file extension is *.TIF.

pSAVEFILEOPTION pSaveOptions

Pointer to optional extended save options. Pass NULL to use the default save options.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

Use this function to save the given LEADImage bitmap in one of the standard T44 Formats: either as a Standard T44 format file (if the nFormat value is FILE_MRC) or as a TIF file with a MRC subtype format (if the nFormat value is FILE_TIF_MRC). When an nFormat value of FILE_MRC is used, *.MRC is the default file extension. When an nFormat value of FILE_TIF_MRC is used, *.TIF is the default file extension.

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.

Use the LSegment::MrcSaveBitmap function to save a file in the LEAD Proprietary T44 format to:

Please note that when creating a Standard T44 format file (calling the LSegment::MrcSaveBitmapT44 function using an nFormat value of FILE_MRC), only one page can be saved.

If segmentation has been performed, when the LSegment::MrcSaveBitmapT44 function is called any 2-bit text, 2-bit grayscale, and 8-bit grayscale segments are treated as 24-bit image segments. If a text segment contains text over a background, when it is saved using the LSegment::MrcSaveBitmapT44 function the background color is lost. For more information on Mixed Raster Content (MRC) formats, refer to General Information.

When using the LSegment::MrcSaveBitmapT44 function, segments can be any of the following types:

SEGTYPE_BACKGROUND

SEGTYPE_ONECOLOR

SEGTYPE_TEXT_1BIT_BW

SEGTYPE_TEXT_1BIT_COLOR

SEGTYPE_PICTURE

Use the COMPRESSIONOPTIONS structure to set the compression to be used for the different types of segments.

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.

If the bitmap hasnt been segmented, the function will auto segment it by calling LSegment::MrcSegmentBitmap first and then will save it. 

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. The 2 bit text segments and the grayscale (2 bit and 8 bit) segments will be treated as 24 bit image segments. For more information, refer to COMPRESSIONOPTIONS.

Control page replacement/insertion operations by using some of the member values available in the SAVEFILEOPTION structure. When saving using an nFormat of FILE_MRC (where only one page can be saved), use the SAVEFILEOPTION.PageNumber member to designate the page number to be saved. When saving using an nFormat of FILE_TIF_MRC, use one of the following SAVEFILEOPTION.Flags values to specify what to do with the image being saved:

Value Meaning
0 Overwrite the file.
ESO_REPLACEPAGE [0x00000400] Replace the page specified by SAVEFILEOPTION.PageNumber.
ESO_INSERTPAGE [0x00000800] Insert the image before the page specified by SAVEFILEOPTION.PageNumber.

Required DLLs and Libraries

See Also

Elements

Topics

Example

The following example demonstrates the use of LSegment::MrcSaveBitmapT44 to save a bitmap.

L_INT LSegment__MrcSaveBitmapT44Example(LSegment Segment, LBitmapBase & Bitmap, 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; 
 
   /* Save the MRC bitmap using the LEAD Proprietary T44 Format */ 
   nRet = Segment.MrcSaveBitmapT44(&Bitmap, &CmpOption, pszFileName, FILE_LEAD_MRC, NULL); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS MRC C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.