Why does my Color Key fail when using 16 bit color depth?
16 bit color depth is supported through several different bit arrangements, including 5-5-5 and 5-6-5. This is dependant upon the video hardware and driver, so you must determine what the pixel value for your color key will be at run time. This may be accomplished by reading the pixel format using IDirectDrawSurface::GetPixelFormat() and examining the bitmask values for each color channel, returned in dwBBitMask / dwGBitMask / dwRBitMask members of the structure filled by this function. For example, if we were using a saturated green key (RGB 0,255,0) we could use the following code to determine the proper key value to set: DDPIXELFORMAT pf; ZeroMemory(&pf,sizeof(pf)); pf.dwSize=sizeof(pf); lpDDSPrimary->GetPixelFormat(&pf); DWORD KeyColor=pf.