LFileSettings::GetLoadResolution

#include "ltwrappr.h"

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

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

Parameters

L_INT 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.

L_UINT32 * pWidth

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

L_UINT32 * pHeight

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

pLOADFILEOPTION pLoadFileOption

Pointer to optional extended load options. Pass NULL to use the default load options.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

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= MAKE_IMAGE_PATH(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 */ 
   if(DimensionCount>0) 
   { 
      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; 
} 
Help Version 21.0.2021.4.8
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help