L_GetPreLoadFilters

#include "l_bitmap.h"

L_LTFIL_API L_SSIZE_T L_GetPreLoadFilters(pszFilters, uSize, pnFixedFilters, pnCachedFilters);

L_TCHAR * pszFilters;

pointer to a character string to be updated with filters

L_SIZE_T uSize;

size in bytes of pszFilters

L_INT * pnFixedFilters;

pointer to a variable to be updated

L_INT* pnCachedFilters;

pointer to a variable to be updated

Retrieves the current preloaded filters list.

Parameter

Description

pszFilters

Pointer to a character string to be updated with the current preloaded filters list.

uSize

The size in bytes of the buffer pointed to by pszFilters.

pnFixedFilters

Pointer to a variable to be updated with the number of filters that should stay loaded in memory at all times. Pass NULL if it is not required.

pnCachedFilters

Pointer to a variable to be updated with the number of filters that should be loaded. Pass NULL if it is not required.

Returns

>=0

The size in bytes of the preloaded filters list.

Comments

In case the current preloaded filters list should be changed, call this function before calling the L_PreLoadFilters function.

The preload filters list contains the list of fixed and cached filters. For more information, refer to L_PreLoadFilters.

To retrieve the preloaded filters list, the user should do the following:

1.

Call the function passing pszFilters as NULL and uSize as 0 to retrieve the size required for the filters list as returned value.

2.

Allocate a buffer of size (Returned Value * sizeof(L_TCHAR)).

3.

Call the function passing the allocated buffer to the pszFilters and the returned value to uSize to retrieve the filters list.

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.

Platforms

Win32, x64, Linux.

See Also

Functions:

L_PreLoadFilters, L_IgnoreFilters, L_GetIgnoreFilters

Topics:

Raster Image Functions: Input/Output File Filters

 

Loading File Filters

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT GetPreLoadFiltersExample(L_VOID) 
{ 
   L_TCHAR * pszList = NULL; 
   L_INT nFixed; 
   L_INT nCached; 
   L_SIZE_T nRet; 
   BITMAPHANDLE Bitmap; 
   L_TCHAR buf[80]; 
   /* get the original filters list */ 
   nRet = L_GetPreLoadFilters(NULL, 0, NULL, NULL); 
   pszList = (L_TCHAR *)malloc(nRet*sizeof(L_TCHAR)); 
   nRet =L_GetPreLoadFilters(pszList, nRet, &nFixed, &nCached); 
   if(nRet < SUCCESS) 
      return (L_INT)nRet; 
   MessageBox(NULL, pszList, TEXT("TEST"), MB_OK); 
   free(pszList); 
   wsprintf(buf, TEXT("fixed: %ld, cached: %ld"), nFixed, nCached); 
   MessageBox(NULL, buf, TEXT("TEST"), MB_OK); 
   /* change the preload filters */ 
   /* This example preloads the CMP, PCX and TIF filters */ 
   /* and allows 1 filter to be cached, while always */ 
   /* keeping 2 loaded. */ 
   nRet =L_PreLoadFilters( 2, 1, TEXT("CMP,PCX,TIF")); 
   if(nRet !=SUCCESS) 
      return (L_INT)nRet; 
   /* get the new filters list */ 
   nRet = L_GetPreLoadFilters(NULL, 0, NULL, NULL); 
   pszList = (L_TCHAR *)malloc(nRet*sizeof(L_TCHAR)); 
   nRet =L_GetPreLoadFilters(pszList, nRet, &nFixed, &nCached); 
   if(nRet < SUCCESS) 
      return (L_INT)nRet; 
   MessageBox(NULL, pszList, TEXT("TEST"), MB_OK); 
   free(pszList); 
   wsprintf(buf, TEXT("fixed: %ld, cached: %ld"), nFixed, nCached); 
   MessageBox(NULL, buf, TEXT("TEST"), MB_OK); 
   /* try to load CMP */ 
   nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("image1.cmp")), &Bitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet != SUCCESS) 
   { 
      if(nRet == ERROR_FILE_FORMAT) 
         MessageBox(NULL, TEXT("CMP ignored"), TEXT("TEST"), MB_OK); 
      return (L_INT)nRet; 
   } 
   if(Bitmap.Flags.Allocated) 
      L_FreeBitmap(&Bitmap); 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help