The colorKey and Alpha properties about how the DDRAW. and set the overlay?

How to set the colorKey and Alpha properties of overlay?
Recently the younger in the development of DDraw, hope that we can achieve the following effect "of the image background color filter, while the remaining part is a transparent overlay"

The platform is win Mobile 6.1
And the hardware to provide overlay support.

I provided in the win moible SDK sample code (Mosquito) attempts to set at the same time, but failed. The specific practices are as follows:

That is my practice problems, without success, hope you heroes help me out. I appreciate~~

dwUpdateFlags = DDOVER_SHOW;

//Set up a transparent
memset(&ovfx, 0, sizeof(ovfx));
ovfx.dwSize = sizeof(ovfx);


ovfx.dwAlphaConst = 0x37;

ovfx.dwAlphaConstBitDepth = 8;

//Set colorkey
if (ddcaps.dwOverlayCaps & DDOVERLAYCAPS_CKEYSRC)
ovfx.dckSrcColorkey.dwColorSpaceLowValue=0; // black as the color key

hRet = g_pDDSOverlay->UpdateOverlay(&rs, g_pDDSPrimary, &rd, dwUpdateFlags, &ovfx);
if (hRet != DD_OK)
return InitFail(hWnd, hRet, szShowOverlayFailMsg);

The value of hRet is "invalid parameter".

That is my way of problems, hope you heroes help me out. I appreciate~~

Started by Lorry at December 08, 2016 - 3:43 AM

Don't know, to learn

Posted by Lulu at December 15, 2016 - 4:15 AM

Updateoverly can't seem to use color key and alpha simultaneously. May be achieved by setting up DDPF_ALPHAPIXELS, but I haven't tested successfully,

Posted by Alice at December 30, 2016 - 4:38 AM

You have to find the DDOVERLAYCAPS_ALPHAANDKEYDEST caps, this cap you can do color key and alpha simultaneously

Posted by Pearl at January 06, 2017 - 6:43 AM


Posted by Barry at January 07, 2017 - 4:59 AM

Just saw a problem, how to put the code like this...

Posted by Stanford at January 12, 2017 - 5:56 AM