ImageGear for C and C++ on Windows v20.0 - Updated
IG_image_DIB_export
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image DIB Functions > IG_image_DIB_export

This function exports the contents of hIGear into a buffer, provided by the application, using Windows DIB or ImageGear AT_DIB format.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_image_DIB_export(
   const HIGEAR hIGear,
   AT_VOID* lpBuffer,
   AT_INT BufferSize,
   const AT_DIB_EXPORT_OPTIONS* lpOptions
);

Arguments:

Name Type Description
hIGear const HIGEAR HIGEAR handle of image from which to export DIB.
lpBuffer AT_VOID* Memory buffer where DIB will be exported.
BufferSize AT_INT Size of memory buffer - use IG_image_DIB_export_size_calc to determine what to use for this.
lpOptions const AT_DIB_EXPORT_OPTIONS* Export options.

Return Value:

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

Supported Raster Image Formats:

Sample:

Filters, Image Util

Example:

 
Copy Code
AT_ERRCOUNT nErrcount;  // Number of errors on stack
HIGEAR hIGear;          // Handle of image
AT_INT nDibSize;        // Exported DIB size
AT_DIB_EXPORT_OPTIONS Options; // Options for DIB export
LPAT_DIB lpDIBBuffer;    // Buffer to export DIB

// Load image file "picture.bmp" from working directory
nErrcount = IG_load_file("picture.bmp", &hIGear);
if(nErrcount == 0)
{
    // Get exported DIB size, allocate memory buffer and export DIB
    memset(&Options, 0, sizeof(AT_DIB_EXPORT_OPTIONS));
    Options.Format = IG_DIB_EXPORT_FORMAT_IG_LEGACY;
    Options.UseAlpha = FALSE;
    IG_image_DIB_export_size_calc(hIGear, &nDibSize, &Options);
    lpDIBBuffer = (LPAT_DIB)malloc(nDibSize);
    nErrcount = IG_image_DIB_export(hIGear, lpDIBBuffer, nDibSize, &Options);
    // ...
    // Delete memory
    free(lpDIBBuffer);
    // Destroy the image
    IG_image_delete(hIGear);
}

Remarks:

hIGear remains valid after calling this function.

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