LFile::ReadLoadResolutions

#include "ltwrappr.h"

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

pDIMENSION pDimensions;

/* pointer to the array to be updated */

L_INT L_FAR * pDimensionCount;

/* address of the variable to be updated */

pLOADFIlEOPTION pLoadFileOption

/* pointer to optional extended load options */

Examines a FlashPix, PhotoCD, 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, or JBIG file can 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.

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.

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

L_VOID TestLoad( HWND hWnd)
{
   pDIMENSION     pDimensions; // 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(TEXT("Img0024.pcd")) ;

   LeadFile.GetInfo(&FileInfo, sizeof(FILEINFO)) ;

   LeadFile.ReadLoadResolutions(NULL, &DimensionCount, NULL) ;
      
   // Fill the array 
   LeadFile.ReadLoadResolutions( pDimensions, &DimensionCount, NULL);
   
   // Display a message box that shows the available sizes
   wsprintf (szMessage,TEXT("Available dimensions:\n"));
   for(i = 0; i < DimensionCount; ++i)
   {
      wsprintf (szMessage,TEXT("%s\n%d x %d"), szMessage,
            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 
   LFileSettings::SetLoadResolution(FileInfo.Format, pDimensions[0].nWidth, pDimensions[0].nHeight);

   // Get the dimensions that we just set and display them 
   LFileSettings::GetLoadResolution(FileInfo.Format, &uWidth, &uHeight);

   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 
   LeadFile.LoadBitmap ();

   // Update the paint palette to force a repaint 
   SendMessage (hWnd, WM_QUERYNEWPALETTE, 0, 0L);
}