ImageGear Professional > User Guide > Using ImageGear > Images and Documents > Working with Image Utility Functions > Creating DIBs and DDBs |
This section provides information about how to create DIBs and DDBs.
Copy Code
|
|
---|---|
IG_image_create_DIB_ex ( nWidth, nHeight, nBpp, lCompression, lpDIB = NULL, &hIGear ); |
Later, you could use the IG_DIB_...() for direct pixel access functions, or an IG_IP_blend_ ...() function to create an image bitmap. You can use the IG_palette_ ...() functions (described later in this section) to add a palette to the DIB.
Copy Code
|
|
---|---|
IG_image_create_DIB_ex ( 0, 0, 0, 0, lpDIB, &hIGear ); |
In this example, lpDIB is a pointer to the existing DIB to copy, and the first four arguments are ignored. Width, height, bits per pixel, and "compression" will be copied from the existing DIB, along with its image bitmap and palette.
Copy Code
|
|
---|---|
IG_image_DIB_import ( lpDIB, &hIGear ); |
This call returns you to the HIGEAR handle assigned to your DIB.
Copy Code
|
|
---|---|
IG_dspl_DDB_import ( hBitmap, hPalette, &hIGear); |
In this call, you provide the DDB's HBITMAP handle, and optionally the handle of a palette. ImageGear creates a DIB for you and returns the new DIB's HIGEAR handle.
Copy Code
|
|
---|---|
IG_dspl_DDB_create( hIGear, IG_GRP_DEFAULT, hDC, nWidth, nHeight, TRUE, &hBitmap, &hPalette ); |
Provide the HIGEAR handle and the width and height for your DDB as well as the addresses of an HBITMAP and an HPALETTE variable to receive the DDB and palette handles. Because this function belongs to the display group, there should be a group identifier, nGripID, to specify where to get the options needed to complete this operation. hDC is necessary to specify the color format output to which the DDB should be compatible.