ImageGear Professional v18.2 > API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image DIB Functions > IG_image_DIB_import |
This function creates a new HIGEAR image from a Windows DIB stored in memory.
Copy Code
|
|
---|---|
AT_ERRCOUNT ACCUAPI IG_image_DIB_import(
const AT_DIB* lpDIB,
LPHIGEAR lphIGear
);
|
Name | Type | Description |
lpDIB | const AT_DIB* | DIB to be imported. |
lphIGear | LPHIGEAR | HIGEAR handle of image created from imported DIB. |
Filters, Image Utility
Copy Code
|
|
---|---|
AT_ERRCOUNT nErrcount; // Number of errors on stack HIGEAR hIGear; // Handle of image HIGEAR hIGearImported; // Handle of the imported 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_WINDOWS; 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); if(nErrcount == 0) { // Import the DIB into the new image nErrcount = IG_image_DIB_import(lpDIBBuffer, &hIGearImported); //... // Destroy the image IG_image_delete(hIGearImported); } // Delete memory free(lpDIBBuffer); // Destroy the image IG_image_delete(hIGear); } |
This function copies pixels to the new HIGEAR. Application continues to own lpDIB after calling this function.