LFileSettings::GetLoadResolution

#include "ltwrappr.h"

static L_INT LFileSettings::GetLoadResolution(nFormat, pWidth, pHeight, pLoadFileOption=NULL)

L_INT nFormat;

/* file format */

L_UINT32 * pWidth;

/* address of the width variable to be updated */

L_UINT32 * pHeight;

/* address of the height variable to be updated */

pLOADFILEOPTION pLoadFileOption;

/* pointer to optional extended load options */

Gets the last values set by the LFileSettings::SetLoadResolution function.

Parameter

Description

nFormat

File format. The following are possible values:

 

Value

Meaning

 

FILE_PCD

[57] Kodak PhotoCD

 

FILE_FPX

[80] Kodak FlashPix

 

FILE_JBIG

[115] JBIG

 

FILE_JP2

[163] JPEG 2000. This file format contains image data and extra information about the contents and organization of the file.

 

FILE_J2K

[164] JPEG 2000. This file format contains only a stream of image data.

 

FILE_CMW

[165] Wavelet CMP.

 

FILE_ECW

[277] Enhanced Compressed Wavelet.

pWidth

Address of the variable to be updated with the last width value that was set.

pHeight

Address of the variable to be updated with the last height value that was set.

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.

Required DLLs and Libraries

LTFIL

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:

LFileSettings::SetLoadResolution, Class Members, LFileSettings::GetViewMode2D, LFileSettings::GetViewPort2D, LFileSettings::SetViewMode2D, LFileSettings::SetViewPort2D

Topics:

Raster Image Functions: Loading Files

 

Raster Image Functions: Getting and Setting File Information

 

Implementing PhotoCD and FlashPix Features

 

Implementing JBIG Features

Example

L_INT LFileSettings__GetLoadResolutionExample(HWND hWnd)
{
   L_INT nRet;
   pDIMENSION pDimensions; /* Pointer to the array to be updated */
   HGLOBAL hDimensions; /* Handle to the buffer for the array */
   L_UINT 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_UINT i; /* Loop counter */
   L_TCHAR *pszFileName= TEXT("img0024.pcd");
   LFileSettings fileSettings;
   /* Count the number of sizes */
   LBitmap LeadBitmap;
   nRet = LeadBitmap.Load(pszFileName, 0, ORDER_RGB);
   if(nRet != SUCCESS)
      return nRet;
   nRet = fileSettings.GetSaveResolution(&DimensionCount, NULL);
   if(nRet != SUCCESS)
      return nRet;
   /* Allocate memory to hold the array of DIMENSION structures */
   hDimensions = GlobalAlloc(GMEM_MOVEABLE, sizeof(DIMENSION)* DimensionCount);
   pDimensions = (pDIMENSION)GlobalLock( hDimensions );
   /* Fill the array */
   nRet = fileSettings.GetSaveResolution(&DimensionCount, pDimensions);
   if(nRet != SUCCESS)
      return nRet;
   /* 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 */
   nRet = fileSettings.SetLoadResolution(FILE_PCD, pDimensions[0].nWidth, pDimensions[0].nHeight);
   if(nRet != SUCCESS)
      return nRet;
   /* Free the memory that we allocated */
   GlobalUnlock (hDimensions);
   GlobalFree (hDimensions);
   /* Get the dimensions that we just set and display them */
   nRet = fileSettings.GetLoadResolution(FILE_PCD, &uWidth, &uHeight, NULL);
   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 = LeadBitmap.Load(pszFileName,0, ORDER_BGR);
   if(nRet != SUCCESS)
      return nRet;
   /* Update the paint palette to force a repaint */
   SendMessage (hWnd, WM_QUERYNEWPALETTE, 0, 0L);
   return SUCCESS;
}