Use CombineDIB function or method from BiDib DLL or OCX to combine two device independent bitmap. You can use a mask and masking modes for combining.
[C++]
/* Combine DIBs */
#include “BiDib.h”
UINT iRet;
/* 1. parameter: The destination x coordinate of the source bitmap on the destination
bitmap
2. parameter: The destination y coordinate of the source bitmap on the destination
bitmap
3. parameter: Pointer to the destination bitmap. It can be NULL.
4. parameter: Handle of the source DIB.
5. parameter: Handle of the mask DIB. It can be NULL.
6. parameter: Masking mode. Available values: COMB_TRANSPARENT,
COMB_OPAQUE */
iRet = CombineDIB(0, 0, &hDest, hDib, NULL, COMB_TRANSPARENT);
if (iRet == 0)
{
// Error
}
[C#]
/* Combine DIBs */
/* 1. parameter The destination x coordinate of the source bitmap on the destination
bitmap
2. parameter: The destination y coordinate of the source bitmap on the destination
bitmap
3. parameter: Handle of the destination bitmap
4. parameter: Handle of the source bitmap
5. parameter: Handle of the mask bitmap
6. parameter: Masking mode. Available values: combopaque, combTransparent */
// hDest is a valid handle of a DIB
hDest = BiDib.CombineDIB(0, 0, hDest hDib, hMask,
BIDIBLib.enumCombinationMode.combopaque);
if (hDest == 0)
{
// Error
}