LMemoryFile::SaveBitmap

#include "ltwrappr.h"

virtual L_INT LMemoryFile::SaveBitmap(pLMemoryBuffer, nFormat, nBitsPerPixel=0, nQFactor=2, pSaveFileOption=NULL)

LBuffer L_FAR * pLMemoryBuffer;

/* pointer to an LBuffer object */

L_INT nFormat;

/* output file format */

L_INT nBitsPerPixel;

/* resulting file's pixel depth */

L_INT nQFactor;

/* quality factor */

pSAVEFILEOPTIONpSaveFileOption;

/* pointer to optional extended save options */

Saves the class object's associated bitmap to a file in memory. The output can be in any of the supported compressed or uncompressed file formats.

Parameter

Description

pLMemoryBuffer

Pointer to an LBuffer object into which the bitmap in memory will be saved. After successful completion of this function, the object pointed to by pLMemoryBuffer will contain the output file.

nFormat

Output file format. For valid values, refer to Formats of Output Files.

nBitsPerPixel

Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files. If nBitsPerPixel is 0, the file will be stored using the closest BitsPerPixel value supported by that format. For example, if a file format supports 1, 4, and 24 BitsPerPixel, and the LBitmapBase::GetBitsPerPixel returns 5, the file will be stored as 24 bit. Likewise, if LBitmapBase::GetBitsPerPixel returns 2, the file will be stored as 4 bit.

nQFactor

This parameter is used when saving an image file to FILE_CMP, FILE_JPEG, FILE_JPEG_411, FILE_JPEG_422, FILE_TIF_JPEG, FILE_LEAD1JTIF, FILE_LEAD2JTIF, FILE_FPX_JPEG_QFACTOR, FILE_EXIF_JPEG, and FILE_PNG. Qfactor is a number that determines the degree of loss in the compression process.

 

For possible values, refer to Compression Quality Factors.

pSaveFileOption

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

Returns

None

Comments

To use this function, do the following:

1.

Declare an LBuffer object. You can then pass its address in this function, which will allocate the memory, save the bitmap, and unlock the memory.

2.

Declare a long integer (L_UINT32) variable for the file-size. You can then pass its address in this function, which will update its value with the size of the file.

3.

Call this function to save the bitmap in the specified LBuffer object.

Support for 12 and 16-bit grayscale images is only available in the Document/Medical toolkits.

This function cannot be used in combination LBaseFile::EnableRedirectIO.

Note: More options are available in the SAVEFILEOPTION structure. However, please note that the PageNumber data member of the SAVEFILEOPTION structure is not valid with this function. Therefore you cannot save a multi-page file with this function.

Note: This function does not support Kodak PhotoCD (PCD), FlashPix (FPX), or Microsoft FAX (AWD) files.

This function cannot be used in combination with the Redirect input / output functions.

This function does not support signed data images, unless they are DICOM images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image that is not a DICOM image is passed to this function.

This function supports signed data images, but only DICOM and TIFF formats support signed data. This function will return an error code if you attempt to save a signed image to a format other than DICOM or TIFF.

If the bitmap has a region, the region stored in the bitmap will be saved, if the image is saved as one of the TIFF file formats.

Required DLLs and Libraries

LTFIL
File format DLLs

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:

Class Members

Topics:

Raster Image Functions: Saving Files

 

Raster Image Functions: Maintaining File Comments and Tags

 

Raster Image Functions: Low-Level Compression Functions

 

Raster Image Functions: Redirecting Input and Output

 

Raster Image Functions: Input and Output

 

Loading and Saving Images

 

Saving a Region

Example

For an example, refer to LMemoryFile::LoadMemory.