L_GetPreLoadFilters (original) (raw)
Summary
Retrieves the current preloaded filters list.
Syntax
#include "l_bitmap.h"
L_LTFIL_API L_SSIZE_T L_GetPreLoadFilters(pszFilters, uSize, pnFixedFilters, pnCachedFilters);
Parameters
L_TCHAR * pszFilters
Pointer to a character string to be updated with the current preloaded filters list.
L_SIZE_T uSize
The size in bytes of the buffer pointed to by pszFilters
.
L_INT * 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.
L_INT* 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
Value | Meaning |
---|---|
>=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:
- Call the function passing
pszFilters
as NULL and uSize as 0 to retrieve the size required for the filters list as returned value. - Allocate a buffer of size returned value.
- 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
Topics
Example
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;
}