ImageGear for C and C++ on Linux v19.10 - Updated
IG_fltr_formatlist_sort
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Filter Functions > IG_fltr_formatlist_sort

This function sorts the array of file format constants in alphabetic order based on the short format names.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_formatlist_sort(
   LPAT_MODE lpFormatList,
   UINT nFListSize
);

Arguments:

Name Type Description
lpFormatList LPAT_MODE Array of file format constants. See enumIGFormats for possible values.
nFListSize UINT Size of lpFormatList array.

Return Value:

Returns 0 if successful. Otherwise, returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

This function does not process image pixels.

Example:

 
Copy Code
AT_ERRCOUNT nErrCount;    // Count of errs on stack upon ret from func
UINT nCount;            // Count of supported formats
LPAT_MODE lpFormatList; // list of formats
// Get list filters that support detect and saving:
// Get total count
nErrCount = IG_fltr_formatlist_get(IG_FLTR_DETECTSUPPORT|IG_FLTR_PAGEINSERTSUPPORT, NULL,
    0, &nCount );
if( nErrCount==0 ) 
{
    // Allocate memory
    lpFormatList = (LPAT_MODE)malloc( nCount*sizeof(AT_MODE) );
    if( lpFormatList!=NULL )
    {
        // Get supported formats
        IG_fltr_formatlist_get(IG_FLTR_DETECTSUPPORT|IG_FLTR_PAGEINSERTSUPPORT,
            lpFormatList, nCount, NULL );
        // Sort formats in alphabetic order */
        IG_fltr_formatlist_sort( lpFormatList, nCount );

        // ...

        // Delete memory
        free( lpFormatList );
    }
}

Remarks:

You can use this function to sort the list of formats obtained from IG_fltr_formatlist_get. Short file format names used for sorting correspond to short names returned by IG_fltr_info_get function.

See also the section Loading and Saving.