May 4th, 2011, 11:25 AM
Color keyed hardware overlay
I have an application that uses DirectDraw to overlay video over an image. It uses destination color keying. The color key is user defined and varies depending on the video played.
I use it to overlay video frames captured from a camera (via frame grabber) over computer generated graphics. This is comparable to what weather forecast TV programs do.
Since DirectDraw is deprecated with Windows Vista and 7 I'd like to update the application to a more recent API.
As far as I could see, only Direct3D offers hardware overlays with color keying, but it seems the color key is now automatically selected by the D3D runtime, which also draws a destination rectangle with that color.
"Overlay is performed using a destination color key, but the Direct3D runtime automatically selects the color and draws the destination rectangle"
Digging into D3D9Ex it seems color keying is not directly supported and that I should use alpha blending to emulate color keying. It seems I should use D3DXCreateTextureFromFileEx() to do the job.
Alpha blending seems to only work for ARGB 32bits pixel format but my images can be either RGB24 or YUV.
So my questions are the following:
1) does anyone know if alpha blending is the only route forward for Hardware Overlay Color Keying?
2) does it mean I will have to convert my color keyed images from RGB24 or YUV to ARGB?
3) must I do this conversion with CPU or can it be somehow accelerated by h/w?
4) what hardware acceleration is available when doing alpha blending?
Or am I missing something and there is a much simpler way to get color keyed hardware overlays with Windows 7? Alpha blending seems an overkill to replace color keyed overlays...
This is assuming a decent graphics card (currently GeForce GTX275) and Windows 7.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!