ImageGear for C and C++ on Windows v19.7 - Updated
IG_dspl_DDB_create
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Display Functions > IG_dspl_DDB_create

This function creates a DDB of the image.

Declaration:

 
Copy Code
AT_ERRCOUNT   ACCUAPI  IG_dspl_DDB_create(
        [IN] HIGEAR hIGear,
        [IN] DWORD dwGrpID,
        [IN] HDC hDC,
        [IN] AT_DIMENSION nWidth,
        [IN] AT_DIMENSION nHeight,
        [IN] BOOL bExport,
        [OUT] HBITMAP FAR* lphBitmap,
        [OUT] HPALETTE FAR* lphPalette
);

Arguments:

Name Type Description
hIGear HIGEAR ImageGear handle of image.
dwGrpID DWORD Identifier of group in which the options are stored.
hDC HDC Handle of device context with which the DDB should be compatible. If NULL, then the DDB will be compatible with the desktop's device context.
nWidth AT_DIMENSION Width of DDB that is to be created.
nHeight AT_DIMENSION Height of DDB that is to be created.
bExport BOOL Boolean parameter which specifies whether to delete the source image or not. If TRUE then the hIGear image will be deleted after the DDB is created, but if FALSE then the image is left unchanged.
lphBitmap HBITMAP FAR* Pointer to where to return the DDB object.
lphPalette HPALETTE FAR* Pointer to where to return the palette handle for this DDB.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

Display, Image Util

Example:

 
Copy Code
HIGEAR           hIGear;    /* HIGEAR handle of image  */ 
DWORD           nGrpID;     /* display group identifier */
HBITMAP hBitmap;    /* handle of bitmap  */
HPALETTE hPalette;   /* handle of palette */
 ...
case ID_IMAGE_EXPORT:
         ... 
IG_dspl_DDB_create( hIGear, nGrpID, NULL, 640, 480, TRUE, &hBitmap, &hPalette );
         ...
        break;
 ...

Remarks:

This function always uses all the display options specified by dwGrpIDgroup and assumes that the output device has a color format compatible with the hDC, but the client area of the output device is a rectangle of nWidth x nHeight size. For 1 bit per pixel images, bit depth of the resulting DDB depends on anti-aliasing settings. If anti-aliasing is turned off, the resulting DDB has 1 bit per pixel, otherwise its bit depth is equal to the hDC bit depth.