ImageGear for C and C++ on Linux v18.10 - Updated
LPFNIG_DIB_GET
API Reference Guide > Core Component API Reference > Core Component Callback Functions Reference > LPFNIG_DIB_GET

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

Declaration:

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

Arguments:

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

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_save_FD_CB_ex / IG_save_mem_CB_ex and LPFNIG_DIB_GET_EX instead.

Example:

 
Copy Code
BOOL  ACCUAPI MyDIBGet (LPVOID lpPrivate, LPAT_DIB lpDIB, LPAT_RGBQUAD lpPalette )
{
/* Modify the DIB header fields at *lpDIB as desired, and store a
   palette at *lpPalette */
 ...
return IG_error_check(); 
}

Remarks:

This callback function is called by ImageGear prior to saving the DIB header and palette.

On entry to this function, lpDIB points to the image's DIB header (AT_DIB or BITMAPINFOHEADER struct), and lpRGB points to its DIB palette. This function is responsible for setting the DIB header fields (width, height, bits per pixel, compression, etc.) and for assuring the palette desired if it is not a 24-bit image.

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.