From version 2.1.0 on FreeImage provides a new, simplified interface besides the old style API.
The new API, known as the plugin API, treats bitmap formats and their accompanied loader and saver routines as plugin modules. A new series of functions provides access to these plugins. For example the new functions provide the means to retrieve a list of supported bitmap formats, as well as their descriptions and their possible file extensions. The new API has many advantages over the old one.
For a start the plugin interface will enable FreeImage's hot swap technology: a feature that allows you to compile and link the library only once in your program making instantly profit from bug fixes, newly supported bitmap formats and more without ever recompiling again. Second it opens the way to use plugins. You won't have these advantages when you use the standard API.
FREE_IMAGE_FORMAT FreeImage_GetFIFByIndex(int index);
Returns the needed plugin id in the plugin list. The plugin list is sorted on the format string.
int FreeImage_GetFIFCount();
Returns the number of supported bitmap formats.
FREE_IMAGE_FORMAT FreeImage_GetFIFFromFormat(const char *format);
Returns the FreeImage format ID for the given format string.
const char *FreeImage_GetFormatFromFIF(FREE_IMAGE_FORMAT fif);
Returns a format string for the given FreeImage Format ID.
const char *FreeImage_GetFIFExtensionList(FREE_IMAGE_FORMAT fif);
Returns a list of possible file extension for the given FreeImage Format ID. The extension list is a string containing one or more comma separated file extensions.
const char *FreeImage_GetFIFDescription(FREE_IMAGE_FORMAT fif);
Returns a descriptive string for the given FreeImage Format ID.
const char *FreeImage_GetFIFRegExpr(FREE_IMAGE_FORMAT fif);
Returns a regular expression for the given FreeImage Format ID, assisting external libraries to identify the bitmap format. Currently FreeImageQt uses this function.
FREE_IMAGE_FORMAT FreeImage_GetFIFFromFilename(const char *filename);
Tries to identify a bitmap type by looking at the filename or a file extension. FreeImage_GetFIFFromFilename returns a valid FreeImage Format ID on success and FIF_UNKNOWN on failure.
BOOL FreeImage_FIFSupportsReading(FREE_IMAGE_FORMAT fif);
Returns true if the plugin belonging to this FreeImage Format ID supports reading, false otherwise.
BOOL FreeImage_FIFSupportsWriting(FREE_IMAGE_FORMAT fif);
Returns true if the plugin belonging to this FreeImage Format ID supports writing, false otherwise.
FIBITMAP * FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
Loads a bitmap file into a FreeImage bitmap using the specified FreeImageIO struct and fi_handle. If the file is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the file couldn't be loaded, FreeImage_LoadFromHandle returns NULL.
The fif parameter specifies the desired bitmap format to be loaded. The parameter accepts any valid FreeImage Format ID, such as FIF_BMP or FIF_JPEG, or an integer value obtained from any of the plugin interface functions.
FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0));
Loads the bitmap file into a FreeImage bitmap. If the bitmap is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the bitmap couldn't be loaded, FreeImage_Load returns NULL.
BOOL FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
Saves the FreeImage DIB to a bitmap file of the given type.
BOOL FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0));
Saves the FreeImage DIB to a bitmap file of the given type.