ImageGear for C and C++ on Linux v20.0 - Updated
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Load Functions > IG_load_FD_CB

This function loads an image from a file using user-defined callback functions.


Copy Code
   AT_INT fd,
   LONG lOffset,
   UINT nPage,
   UINT nTile,
   LPFNIG_RASTER_SET lpfnRasterSet,
   LPVOID lpPrivateData


Name Type Description
fd AT_INT Handle of the open file containing the image to be loaded. This handle can be obtained from Microsoft Windows functions such as CreateFile(), and cast to AT_INT for passing to the function parameter. FILE pointers returned by functions such as fopen(), and file handles returned by functions such as _sopen_s() are not supported.
lOffset LONG Offset into the file, in bytes, to where the image begins. This is the offset to the beginning of the header, not to the beginning of the bitmap. lOffset is usually 0.
nPage UINT Page number to load if this is a multi-page (multi-image) file. Note that page numbers begin at 1, not 0. Set nPage to 1 if this is not a multi-page file.
nTile UINT If loading an image that is tiled, you can set the number of a specific tile to load. Tile numbers begin at 1, not 0. Set to 1 for a non-tiled image.
lpfnRasterSet LPFNIG_RASTER_SET Pointer to callback function to be called after each raster line is read.
lpfnDIBCreate LPFNIG_DIB_CREATE Pointer to callback function to be called after the file header has been read.
lpPrivateData LPVOID Pointer to a private data area. This pointer will be passed to the callback functions.

Return Value:

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

Supported Raster Image Formats:

Actual set of pixel formats supported by this function can be narrower, depending on the implementation of the user-defined callback functions.


This function is only kept for backward compatibility reasons. Please use IG_load_FD_CB_ex instead.

It is the responsibility of your two callback functions, lpfnDIBCreate and lpfnRasterSet, to create the DIB or other structure you want. Your lpfnDIBCreate callback function is called after the file's header has been read. Then your lpfnRasterSet callback function is called for each raster line read. See the descriptions under function types LPFNIG_DIB_CREATE and LPFNIG_RASTER_SET for how these callback functions are called.

If you want a HIGEAR handle for the DIB your callback functions have created, you can obtain one (after the load is complete) by calling function IG_image_DIB_import.

Is this page helpful?
Yes No
Thanks for your feedback.