Previous: Adding New Formats, Up: Supported Image Formats [Contents][Index]
Since the number of formats supported by the library is dynamic in nature, some query routines are available to obtain support information.
To obtain the number of currently supported image formats, use the routine
int flimage_get_number_of_formats(void);
The functions returns the number of formats supported, for reading or writing or both. To obtain detailed information for each format, the following can be used
typedef struct { const char * formal_name; const char * short_name; const char * extension; int type; int read_write; int annotation; } FLIMAGE_FORMAT_INFO; const FLIMAGE_FORMAT_INFO *flimage_get_format_info(int n);
where parameter n
is an integer between 1 and the return value
of flimage_get_number_of_formats()
. Upon function return
a static buffer is returned containing the basic information about the
image. The read_write field can be one of the following combinations
thereof
FLIMAGE_READABLE
supports reading
FLIMAGE_WRITABLE
supports writing
or the bitwise OR of both.
These two routines are most useful for reporting or presenting capabilities to the user
FLIMAGE_FORMAT_INFO *info; int n = flimage_get_number_of_formats(); fprintf(stderr,"FL supports the following format\n"); for (; n; n--) { info = flimage_get_format_info(n); fprintf(stderr,"%s format\t(%c%c)\n", info->short_name, (info->read_write & FLIMAGE_READABLE) ? 'r' : ' ', (info->read_write & FLIMAGE_WRITABLE) ? 'w' : ' '); }