LFile::ReadLoadResolutions

#include "ltwrappr.h"

virtual L_INT LFile::ReadLoadResolutions(pDimensions, pDimensionCount, pLoadFileOption=NULL)

pDIMENSION pDimensions;

pointer to the array to be updated

L_INT * pDimensionCount;

address of the variable to be updated

pLOADFILEOPTION pLoadFileOption;

pointer to optional extended load options

Examines a FlashPix, PhotoCD, ECW, or JBIG file to determine which resolutions it contains.

Parameter

Description

pDimensions

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.

pDimensionCount

Address of the pDimensionCount variable to be updated with the number of available resolutions.

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

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.

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, LFile::GetPCDResolution

Topics:

Raster Image Functions: Loading Files

 

Raster Image Functions: Getting and Setting File Information

 

Implementing PhotoCD and FlashPix Features

 

Implementing JBIG Features

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
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 Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help