L_GetPCDResolution

#include "l_bitmap.h"

L_LTFIL_API L_INT L_GetPCDResolution(pszFile, pPCDInfo)

L_TCHAR* pszFile;

/* name of the PhotoCD file */

pPCDINFO pPCDInfo;

/* pointer to the LEAD PCDINFOPCDINFO structure */

Examines a PhotoCD file to determine which resolutions it contains.

Parameter

Description

PszFile

Character string containing the name of the PhotoCD file.

PPCDInfo

Pointer to the LEAD PCDINFO structure.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Before calling this function, declare a variable for a PCDINFO structure. Then, after calling this function, look at the values in the structure to see which resolutions are available.

The PCDINFO structure is specified as follows in the LTFIL.H file:

typedef struct pcdinfo
{
      L_INT     resolution[6];
} PCDINFO,  *pPCDINFO

The structure contains an array of integers, and the value of each integer can be 0 or 1. The following symbolic constants are defined for use as indexes into the array:

Constant Used as Index

Meaning

L_PCD_BASE_OVER_64

[0] Resolution 64 x 96

L_PCD_BASE_OVER_16

[1] Resolution 128 x 192

L_PCD_BASE_OVER_4

[2] Resolution 256 x 384

L_PCD_BASE

[3] Resolution 512 x 768

L_PCD_4BASE

[4] Resolution 1024 x 1536

L_PCD_16BASE

[5] Resolution 2048 x 3072

 

Note:

More options are available in the LOADFILEOPTION structure.

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

Windows 2000 / XP/Vista.

See Also

Functions:

L_FileInfo, L_FileInfoMemory, L_ReadFileComment, L_SetPCDResolution, L_GetWMFResolution, L_SetWMFResolution, L_SetLoadInfoCallback, L_GetComment, L_SetComment

Topics:

Raster Image Functions: Input and Output

 

Loading and Saving Images

 

For a list of functions that utilize the LOADFILEOPTION or SAVEFILEOPTION structures, refer to Functions Utilizing the LOADFILEOPTION or SAVEFILEOPTION structures.

Example

This example checks for a high resolution PCD image and loads it if possible

 L_INT GetPCDResolutionExample(L_VOID)
{
   L_INT nRet;
   BITMAPHANDLE LeadBitmap;   /* Bitmap handle for the final image */
   PCDINFO PCDinfo; /* PCD information structure */

   /* Get the PCD resolution information. (LEADTOOLS does not supply PCD files.)  */
   nRet = L_GetPCDResolution(TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 15\\Images\\IMAGE1.PCD"), &PCDinfo);
   if(nRet != SUCCESS)
      return nRet;

   /* Use high resolution if possible */
   if (PCDinfo.resolution[nRet = L_PCD_4BASE])
   {
      L_SetPCDResolution(L_PCD_4BASE);
      if(nRet != SUCCESS)
         return nRet;
      MessageBox( NULL, TEXT("Loading 1024 x 1536"), TEXT("Notice"), MB_OK );
   }
   else
   {
      nRet = L_SetPCDResolution(L_PCD_BASE);
      if(nRet != SUCCESS)
         return nRet;
      MessageBox( NULL, TEXT("Loading 512 x 768"), TEXT("Notice"), MB_OK );
   }

   /* Load the bitmap at its own bits per pixel  */
   nRet = L_LoadBitmap (TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 15\\Images\\IMAGE1.PCD"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_SaveBitmap(TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 15\\Images\\Result.BMP"), &LeadBitmap, FILE_BMP, 24, 0, NULL);
   if(nRet != SUCCESS)
      return nRet;
   if(LeadBitmap.Flags.Allocated)
      L_FreeBitmap(&LeadBitmap);  

   /* Reset the default PCD resolution */   
   nRet = L_SetPCDResolution(L_PCD_BASE);
   if(nRet != SUCCESS)
      return nRet;

   return SUCCESS;
}