ImageGear for C and C++ on Windows v20.0 - Updated
LPFNIG_DIB_CREATE
API Reference Guide > Core Component API Reference > Core Component Callback Functions Reference > LPFNIG_DIB_CREATE

This is one of the two types of callback functions supplied in calls to IG_load_FD_CB() and IG_load_mem_CB().

Declaration:

 
Copy Code
typedef AT_ERRCOUNT (ACCUAPI LPFNIG_DIB_CREATE) (
        LPVOID lpPrivate, 
        const LPAT_DIB lpDIB, 
        const LPAT_RGBQUAD lpRGB 
);

Arguments:

Name Type Description
lpPrivate LPVOID Far pointer to private data area.
lpDIB const LPAT_DIB Far pointer to start of an AT_DIB DIB header (that is, a BITMAPINFOHEADER) struct created by ImageGear.
lpRGB const LPAT_RGBQUAD Far pointer to the first of the AT_RGBQUAD structs constituting the palette in the DIB. Will be NULL if the image is 24-bit.

Return Value:

Returns an error count.

Supported Raster Image Formats:

Indexed RGB – 1…8 bpp;
Grayscale – 9…16 bpp;
RGB – 24 bpp;
CMYK – 32 bpp.

This callback function is only kept for backward compatibility reasons. Please use  IG_load_FD_CB_ex / IG_load_mem_CB_ex and LPFNIG_DIB_CREATE_EX instead.

Sample:

Load Callback

Example:

 
Copy Code
BOOL  ACCUAPI MyDIB_Create (LPVOID lpPrivate, LPAT_DIB lpDIB, LPAT_RGBQUAD lpRGB )
{
/* Can allocate memory, create a DIB header (AT_DIB) and palette. Later, an
LPFNIG_RASTER_SET function can create the image bitmap. */
 ...
return IG_error_check();
}

Remarks:

This callback function is called by ImageGear to provide your application the information it needs to create its own DIB header and palette.

On entry to this function lpDIB points to an AT_DIB struct which ImageGear has created upon reading the file's header. You can use information from this AT_DIB struct to create your own DIB header, but you should not alter the information at lpDIB.

Similarly, lpRGB points to the palette as obtained from the file. (lpRGB = NULL if no palette.) You can copy the palette, or create your own for the DIB you are creating. 

If you need to terminate the load, you can place an error on the stack yourself, using IG_error_set(). See the description for that function.

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