Examines a FlashPix, PhotoCD, ECW, or JBIG file to determine which resolutions it contains.
#include "ltwrappr.h"
virtual L_INT LFile::ReadLoadResolutions(pDimensions, pDimensionCount, pLoadFileOption=NULL)
Pointer to the array of DIMENSION structures to be updated with the available physical resolutions in the file. You can pass NULL if you only want to update the count variable.
Address of the pDimensionCount variable to be updated with the number of available resolutions.
Pointer to optional extended load options. Pass NULL to use the default load options.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
A FlashPix, PhotoCD, ECW, or JBIG file can may contain more than one copy of the same image, each at a different physical resolution (width and height in pixels). For PhotoCD files, the resolutions are fixed sizes, and you can use an older function (LFile::GetPCDResolution) to examine them. For FlashPix and JBIG files, which can contain images of various sizes, you must use this function to examine them. For ECW files you can only resample images to dimensions smaller than the original values for width/height, you can use this function to get the original dimensions.
You must allocate the array to be updated. One way to do this is to declare an array of the maximum size (29 elements). Another way is to call this function twice the first time with NULL in the pDimensions parameter, so that you can get the number of elements and allocate storage of the appropriate size.
After you get the available resolutions, you can use the LFileSettings::SetLoadResolution function to specify the one to be loaded.
Before you can call this function, you must set the filename for the class object.
Win32, x64.
L_INT LFile__ReadLoadResolutionsExample( HWND hWnd)
{
L_INT nRet;
pDIMENSION pDimensions = NULL; // Pointer to the array to be updated
L_INT DimensionCount;// Number of physical resolutions
L_TCHAR szMessage[256];// MessageBox string
L_UINT32 uWidth; // Width variable to be updated
L_UINT32 uHeight; // Height variable to be updated
L_INT i; // Loop counter
LFile LeadFile ;
FILEINFO FileInfo ;
LBitmapBase LeadBitmap;
LeadFile.SetBitmap(&LeadBitmap) ;
LeadFile.SetFileName(MAKE_IMAGE_PATH(TEXT("Img0024.pcd"))) ;
nRet = LeadFile.GetInfo(&FileInfo, sizeof(FILEINFO)) ;
if(nRet != SUCCESS)
return nRet;
nRet = LeadFile.ReadLoadResolutions(NULL, &DimensionCount, NULL) ;
if(nRet != SUCCESS)
return nRet;
pDimensions = new DIMENSION[DimensionCount];
// Fill the array
nRet = LeadFile.ReadLoadResolutions( pDimensions, &DimensionCount, NULL);
if(nRet != SUCCESS)
return nRet;
// Display a message box that shows the available sizes
for(i = 0; i < DimensionCount; ++i)
{
wsprintf (szMessage,TEXT("%s\n%d x %d"), TEXT("Available dimensions:\n"), pDimensions[i].nWidth, pDimensions[i].nHeight);
MessageBox( NULL, szMessage, TEXT("File Information"), MB_OK );
}
// Set the size to load, the smallest size in this case
nRet = LFileSettings::SetLoadResolution(FileInfo.Format, pDimensions[0].nWidth, pDimensions[0].nHeight);
if(nRet != SUCCESS)
return nRet;
delete pDimensions;
// Get the dimensions that we just set and display them
nRet = LFileSettings::GetLoadResolution(FileInfo.Format, &uWidth, &uHeight);
if(nRet != SUCCESS)
return nRet;
wsprintf (szMessage,TEXT("Size that will be loaded:\n\n%d x %d"), uWidth, uHeight);
MessageBox( NULL, szMessage, TEXT("File Information"), MB_OK );
// Load the bitmap, keeping the bits per pixel of the file
nRet = LeadFile.Load ();
if(nRet != SUCCESS)
return nRet;
// Update the paint palette to force a repaint
SendMessage (hWnd, WM_QUERYNEWPALETTE, 0, 0L);
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document