LFile::LoadList

#include "ltwrappr.h"

virtual L_INT LFile::LoadList(pLFileBitmapList, nBitsTo=0, nColorOrder=ORDER_BGRORGRAY, pLoadFileOption=NULL, pFileInfo=NULL)

LBitmapList * pLFileBitmapList;

/* pointer to an LBitmapList object */

L_INT nBitsTo;

/* resulting bitmap pixel depth */

L_INT nColorOrder;

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

pLOADFILEOPTION pLoadFileOption;

/* pointer to optional extended load options */

pFILEINFO pFileInfo;

/* pointer to a structure */

Creates a bitmap list in the specified LBitmapList object, and loads bitmaps from a multipage file into the list.

Parameter

Description

pLFileBitmapList

Pointer to an LBitmapList object that is to receive the loaded list.

nBitsTo

Resulting pixel depth of bitmaps in the list. Possible values are:

 

Value

Meaning

 

0

Keep the original file's pixel depth (Do not convert).

 

1 to 8

The specified bits per pixel in the resultant bitmaps

 

12

12 bits per pixel in the resultant bitmap.

 

16

16 bits per pixel in the resultant bitmaps

 

24

24 bits per pixel in the resultant bitmaps

 

32

32 bits per pixel in the resultant bitmaps

 

48

48 bits per pixel in the resultant bitmap

 

64

64 bits per pixel in the resultant bitmap

nColorOrder

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

 

Value

Meaning

 

ORDER_RGB

[0] Red, green, and blue color order

 

ORDER_BGR

[1] Blue, green, and red color order

 

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.

pFileInfo

Pointer to a FILEINFO structure. This structure may contain file information used in loading an image, or it may be updated with information about the file being loaded.

 

If nothing is known about the file, pass NULL for this parameter, or declare a variable of type FILEINFO and set the FILEINFO.Flags to 0, then pass the address of the FILEINFO structure in this parameter. In this case, if the address of a FILEINFO structure is passed, the FILEINFO structure will be updated with the results of LFile::GetInfo.

 

If only the file type is known, set pFileInfo.Format to the file type and set pFileInfo.Flags to FILEINFO_FORMATVALID. This can also be done if LFile::GetInfo has been called previously, but values that affect the size of the image loaded have been changed (for example, by calling LFileSettings::SetPCDResolution or LFileSettings::SetWMFResolution). In this case the FILEINFO structure pointed to by pFileInfo will be updated with the results of LFile::GetInfo.

 

If LFile::GetInfo has been called prior to calling this function, and no changes have been made to the contents of the structure filled by LFile::GetInfo, then the address of the filled FILEINFO structure can be passed for this parameter. In this case, the FILEINFO.Flags member should be set to FILEINFO_INFOVALID. The LFile::GetInfo function will set the FILEINFO.Flags to FILEINFO_INFOVALID. In this case the load will be faster since this function does not have to query the file filters for the file type.

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.

Before calling this function, you must create an LBitmapList object. You can then pass the address of this object in the pLFileBitmapList parameter, which this function will update with the loaded bitmap list.

Note: More options are available in the LOADFILEOPTION structure.

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.

Platforms

Win32, x64.

See Also

Functions:

Class Members, LFileSettings::GetLoadResolution, LFileSettings::GetPCDResolution, LFileSettings::GetWMFResolution, LFileSettings::SetLoadResolution, LFileSettings::SetPCDResolution, LFileSettings::SetWMFResolution, LFileSettings::GetViewMode2D, LFileSettings::GetViewPort2D, LFileSettings::SetViewMode2D, LFileSettings::SetViewPort2D, LFileSettings::GetWMFResolution, LFileSettings::SetWMFResolution

Topics:

Raster Image Functions: Playing Animated Images

 

Implementing Animation

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LFile__LoadBitmapListExample()
{
   L_INT nRet;
   LFile LeadFile ;
   LBitmapBase LeadBitmap;
   LeadFile.SetBitmap(&LeadBitmap);
   LeadFile.SetFileName(MAKE_IMAGE_PATH(TEXT("image1.cmp")));
   nRet = LeadFile.Load ();
   if(nRet != SUCCESS)
      return nRet;
   /* or */
   /* LeadFile.LoadBitmap(0, ORDER_BGR, 0); */
   LeadFile.SetFileName(MAKE_IMAGE_PATH(TEXT("TestBMP.bmp"))) ;
   nRet = LeadFile.Save(FILE_BMP,8,0) ;
   if(nRet != SUCCESS)
      return nRet;
   /* or */
   /* LeadFile.Save(FILE_BMP, 8, 0, 0, SAVE_OVERWRITE);*/
   // or LeadFile.Save(FILE_BMP);
   nRet = LeadFile.FileConvert(MAKE_IMAGE_PATH(TEXT("TestBMP2.bmp")),MAKE_IMAGE_PATH(TEXT("image1.cmp")),FILE_BMP, LeadBitmap.GetWidth(),LeadBitmap.GetHeight(),24,0, NULL, NULL);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}