LFileSettings::GetLoadResolution

#include "ltwrappr.h"

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

L_INT nFormat;

/* file format */

L_UINT32 L_FAR * pWidth;

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

L_UINT32 L_FAR * pHeight;

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

pLOADFILEOPTIONpLoadFileOption;

/* 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.

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_VOID MyFunction(HWND hWnd)

{

   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_INT i; /* Loop counter */

   L_TCHAR *pszFileName= TEXT("img0024.pcd");

   LFileSettings fileSettings;

 

   /* Count the number of sizes */

   LBitmap LeadBitmap;

   LeadBitmap.Load(pszFileName, 0, ORDER_RGB);

   fileSettings.GetSaveResolution(&DimensionCount, NULL);

   /* Allocate memory to hold the array of DIMENSION structures */

   hDimensions = GlobalAlloc(GMEM_MOVEABLE, sizeof(DIMENSION)* DimensionCount);

   pDimensions = (pDIMENSION)GlobalLock( hDimensions );

   /* Fill the array */

   fileSettings.GetSaveResolution(&DimensionCount, pDimensions);

   /* 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 */

   fileSettings.SetLoadResolution(FILE_PCD, pDimensions[0].nWidth, pDimensions[0].nHeight);

   /* Free the memory that we allocated */

   GlobalUnlock (hDimensions);

   GlobalFree (hDimensions);

   /* Get the dimensions that we just set and display them */

   fileSettings.GetLoadResolution(FILE_PCD, &uWidth, &uHeight, NULL);

   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 */

   LeadBitmap.Load(pszFileName,0, ORDER_BGR);

   /* Update the paint palette to force a repaint */

   SendMessage (hWnd, WM_QUERYNEWPALETTE, 0, 0L);

 

   return;

}