virtual L_INT LMemoryFile::Load(LMemoryBuffer, nBitsPerPixel=0, nOrder=ORDER_BGRORGRAY, pLoadFileOption=NULL, pFileInfo = NULL)
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.
A LEAD buffer that contains the file in memory to be loaded.
Resulting bitmap pixel depth. Possible values are:
|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 resulting bitmap|
|12||12 bits per pixel in the resulting bitmap.|
|16||16 bits per pixel in the resulting bitmap|
|24||24 bits per pixel in the resulting bitmap|
|32||32 bits per pixel in the resulting bitmap|
|48||48 bits per pixel in the resulting bitmap|
|64||64 bits per pixel in the resulting bitmap|
Color order for 16-, 24-, 32-, 48-, and 64-bit bitmaps. If the resulting bitmap is less than 16 bits per pixel, this will have no effect since palletized images have no order. Possible values are:
|ORDER_RGB|| Red, green, and blue color order in memory|
|ORDER_BGR|| Blue, green, and red color order in memory|
|ORDER_GRAY|| 12- or 16-bit grayscale image. 12 and 16-bit grayscale images are only supported in the Document/Medical toolkits.|
|ORDER_RGBORGRAY|| 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|| 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.|
Pointer to optional extended load options. Pass NULL to use the default load options.
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.
Some file formats do not contain a well-defined file signature. This is especially true for document file formats (TXT, PST, etc). LEADTOOLS can still detect the file format using the filename extension (ex. ".PST"). However, when loading files from memory the filename extension is not available. To provide this function with a filename extension, set pFileInfo.Name to the image file's name with extension and pFileInfo.Flags to FILEINFO_NAMEVALID when loading from memory.
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.
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
Support for 12- and 16-bit grayscale images is only available in the Document/Medical toolkits.
For supported formats, refer to Files To Be Included With Your Application.
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.
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.
L_INT LMemoryFile__LoadBitmapExample(LBitmapBase& LeadBitmap)
LMemoryFile LeadMemFile ;
LBuffer LeadMemBuffer ;
nRet = LeadMemFile.Save(&LeadMemBuffer,FILE_LEAD,24,QS) ;
if(nRet != SUCCESS)
nRet = LeadBitmap.Free();
if(nRet != SUCCESS)
nRet = LeadMemFile.Load(LeadMemBuffer,24,ORDER_BGR, NULL) ;
if(nRet != SUCCESS)
Medical Web Viewer .NET
Media Foundation .NET |