This section provides information about how to create DIBs and DDBs.
- To create a new HIGEAR with an empty DIB, use the following code (see IG_image_create_DIB_ex):
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.
- To create a new HIGEAR with a DIB filled by copying an existing DIB, use the same function as demonstrated above, but call it like this:
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.
- To give a HIGEAR handle to an existing DIB, use the import function:
Copy Code IG_image_DIB_import ( lpDIB, &hIGear );
This call returns you to the HIGEAR handle assigned to your DIB.
- To create a HIGEAR whose image is a copy of the image in an existing DDB, use IG_dspl_DDB_import:
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.
- To create a DDB whose image is a copy of the image in an existing HIGEAR, use IG_dspl_DDB_create:
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.