L_MrcSaveBitmapT44
#include "ltsgm.h"
L_LTSGM_API L_INT L_MrcSaveBitmapT44(hSegment, pBitmap, pCmpOption, pszFileName, pfnCallback, pUserData, nFormat, pSaveOptions)
HSEGMENTATION hSegment; |
/* segmentation handle */ |
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
pCOMPRESSIONOPTIONS pCmpOption; |
/* pointer to the compression options structure */ |
L_TCHAR * pszFileName; |
/* output file name */ |
FILESAVECALLBACK pfnCallback; |
/* reserved for future use */ |
L_HANDLE pUserData; |
/* reserved for future use */ |
L_INT nFormat; |
/* output file format */ |
pSAVEFILEOPTION pSaveOptions; |
/* pointer to optional extended save options */ |
Saves an MRC image contained in a bitmap to a file using the Standard T44 format.
Parameter |
Description |
|
hSegment |
An existing segmentation handle. This handle is obtained by calling the L_MrcStartBitmapSegmentation function. |
|
pBitmap |
Pointer to the bitmap handle referencing the bitmap 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. |
|
pfnCallback |
Reserved for future use. Pass NULL. |
|
pUserData |
Reserved for future use. Pass NULL. |
|
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 multi-page). The default file extension is *.TIF. |
pSaveOptions |
Pointer to optional extended save options. Pass NULL to use the default save options. |
Returns
SUCCESS |
The function was successful. |
<= 0 |
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 L_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 L_MrcSaveBitmap function to save a file in the LEAD Proprietary T44 format 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.
Please note that when creating a Standard T44 format file (calling the L_MrcSaveBitmapT44 function using an nFormat value of FILE_MRC), only one page can be saved.
If segmentation has been performed, when the L_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 L_MrcSaveBitmapT44 function the background color is lost. For more information on Mixed Raster Content (MRC) formats, refer to General Information.
When using the L_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 L_MrcSaveBitmap function. Segmentation can be performed automatically by calling the L_MrcSegmentBitmap function, or performed manually by calling the L_MrcCreateNewSegment function. Call the L_MrcStartBitmapSegmentation function before calling any of the segmentation methods. When the handle to the segmentation is no longer needed, free it by calling the L_MrcStopBitmapSegmentation function. For more information on segmentation, refer to General Segmentation, Auto-Segmentation, and Manual Segmentation.
If the hSegment parameter is NULL, then the function will automatically segment the bitmap by calling the L_MrcSegmentBitmap function and then saves the MRC image file.
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
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: |
L_MrcSaveBitmap, L_MrcLoadBitmap, L_MrcGetPagesCount, L_MrcSegmentBitmap |
Topics: |
|
|
Example
L_INT MrcSaveBitmapT44Example(HSEGMENTATION hSegmentation, pBITMAPHANDLE pBitmap, 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 Standard T44 Format */ nRet = L_MrcSaveBitmapT44 (hSegmentation, pBitmap, &CmpOption, pszFileName, NULL, NULL, FILE_MRC, NULL); if (nRet != SUCCESS) return nRet; return SUCCESS; }