LMemoryFile::LoadBitmap

#include "ltwrappr.h"

virtual L_INT LMemoryFile::LoadBitmap(LMemoryBuffer, nBitsPerPixel=0, nOrder=ORDER_BGRORGRAY, pLoadFileOption=NULL)

LBuffer& LMemoryBuffer;

/* an LBuffer object */

L_INT nBitsPerPixel;

/* resulting bitmap pixel depth */

L_INT nOrder;

/* color order for 16-, 24-, and 32-bit bitmaps */

pLOADFILEOPTION pLoadFileOption;

/* pointer to optional extended load options */

Loads an image file from memory into the class object's associated bitmap. The file in memory can be in any supported image file format and bits per pixel, whether compressed or uncompressed.

Parameter

Description

LMemoryBuffer

A LEAD buffer that contains the file in memory to be loaded.

nBitsPerPixel

Resulting bitmap pixel depth. Possible values are:

Value

Meaning

0

Keep the original file's pixel depth (Do not convert). A special note about loading 12 and 16-bit grayscale images.

1 to 8

The specified bits per pixel in the resultant bitmap

12

12 bits per pixel in the resultant bitmap.

16

16 bits per pixel in the resultant bitmap

24

24 bits per pixel in the resultant bitmap

32

32 bits per pixel in the resultant bitmap

48

48 bits per pixel in the resultant bitmap

64

64 bits per pixel in the resultant bitmap

nOrder

Color order for 16-, 24-, 32-, 48-, and 64-bit bitmaps. If the resultant bitmap is less than 16 bits per pixel, this will have no effect since palletized images have no order. Possible values are:

Value

Meaning

ORDER_RGB

[0] Red, green, and blue color order in memory

ORDER_BGR

[1] Blue, green, and red color order in memory

ORDER_GRAY

[2] 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are only supported in the Document/Medical toolkits.

ORDER_RGBORGRAY

[3] Load the image as red, green, blue OR as a 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are supported in the Document/Medical toolkits only.

ORDER_BGRORGRAY

[4] Load the image as blue, green, red OR as a 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are supported in the Document/Medical toolkits only.

pLoadFileOption

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

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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

For supported formats, refer to Summary of All Supported Image File Formats.

Before calling this function, you may need to get or set file information, such as the page number of a multipage file. Refer to Getting and Setting File Information.

The function will initialize the bitmap handle and allocate the storage necessary to hold the image. If the bits per pixel of the file is larger than 8 bits, the image data will be loaded in the same color order as the one passed to the function in nOrder.

Since the function allocates storage to hold the image, it is up to you to free this storage by calling LBitmapBase::Free.

Note: More options are available in the LOADFILEOPTION structure.

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

The LMemoryBuffer parameter is passed by reference, and is a required parameter.

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

Note: For information on loading and saving large TIFF files faster, refer to Loading and Saving Large TIFF Files.

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, LFile::LoadCMYKArray, LFile::SaveCMYKArray, LPaint::PaintDCCMYKArray, LFileSettings::GetLoadResolution, LFileSettings::GetPCDResolution, LFileSettings::GetWMFResolution, LFileSettings::SetLoadResolution, LFileSettings::SetPCDResolution, LFileSettings::SetWMFResolution, LFileSettings::GetViewMode2D, LFileSettings::GetViewPort2D, LFileSettings::SetViewMode2D, LFileSettings::SetViewPort2D, LFileSettings::GetWMFResolutionExt, LFileSettings::SetWMFResolutionExt

Topics:

Raster Image Functions: Loading Files

 

Raster Image Functions: Redirecting Input and Output

 

Raster Image Functions: Input and Output

 

Loading and Saving Images

 

Using a PanWindow

Example

L_VOID LoadSaveFunc(LBitmapBase& LeadBitmap)
{
   LMemoryFile LeadMemFile ;
   LBuffer LeadMemBuffer ;

   LeadMemFile.SetBitmap(&LeadBitmap) ;
   LeadMemFile.EnableCallBack(TRUE) ;

   LeadMemFile.SaveBitmap(&LeadMemBuffer,FILE_LEAD,24,QS) ;

   LeadBitmap.Free();

   LeadMemFile.LoadBitmap(LeadMemBuffer,24,ORDER_BGR, NULL) ;
}