Overlay Source Colorkey Problem: Mosquito Application

Started by
8 comments, last by Milind 16 years, 10 months ago
Hi All, Thanks a lot for stopping By .. and I hope you are the one who can answer my question. I am relatively new to Direct Draw and trying to implement Source and Destination Colorkeying on Overlay. I have used Mosquito Sample from DirectX 7 as example to start with and I am stuck now. Mosquito Application claims it is doing Source Colorkeying but when I compiled it and Ran it on my machine, it shows Black Background around Mosquito, it should not. At the same time I tried to change Source Colorkey to Destination ColorKey and it worked. I made sure that my Machine supports Source ColorKeying by Checking DDCKEYCAPS_SRCOVERLAY and also running one Application which does Source ColorKeying and both worked. There are two ways for Color Keying (1) Using Blit and (2) Using Update Overlay and I am trying Second option and somehow Source Colorkeying is not working. Reason: Either I dont know how to do it (100% :D) or I am missing some steps here(60% Chances). Can anyone please tell me how do I do it with example if possible or portion of source code which does it?? I can provide Source Code of Mosquito if in case you dont have. ########################################################################## ####################### Portion Of Source Code: Mosquito ################# ########################################################################## // Set the flags we'll send to UpdateOverlay dwUpdateFlags = DDOVER_SHOW | DDOVER_DDFX; // Does the overlay hardware support source color keying? // If so, we can hide the black background around the image. // This probably won't work with YUV formats if (capsDrv.dwCKeyCaps & DDCKEYCAPS_SRCOVERLAY) dwUpdateFlags |= DDOVER_KEYSRCOVERRIDE; // Create an overlay FX structure so we can specify a source color key. // This information is ignored if the DDOVER_SRCKEYOVERRIDE flag isn't set. INIT_DIRECTDRAW_STRUCT(ovfx); ovfx.dckSrcColorkey.dwColorSpaceLowValue=0; //Specify black as the color key ovfx.dckSrcColorkey.dwColorSpaceHighValue=0; // Make the call to UpdateOverlay() which actually displays the overlay on // the screen. ddrval = g_lpddsOverlay->UpdateOverlay(&rs, g_lpddsPrimary, &rd, dwUpdateFlags, &ovfx); ############################################################################## For Destination ColorKeying with Proper Flags It Works Fine I.e. DDOVER_KEYDESTOVERRIDE ovfx.dckDestColorkey ############################################################################## Thanks a lot, -MIlind
Advertisement
The source looks fine, but did you read the source comments there? "Probably won't work with YUV formats". What format are you using for your overlay? YUV doesn't seem to support hardware color keying. You can actually remove that check (if (capsDrv.dwCKeyCaps & DDCKEYCAPS_SRCOVERLAY)) and then check the return value of UpdateOverlay, do you get something like "NoHardwareColorKeySupport"? If you have an NVidia card you can only use YUV overlays AFAIK and then there is no color key support for YUV. It sucks I know. If anyone knows how to get around that, please share.
Yes I am using YUV Format ( I Have Bitmap Image and I am converting it to YUV)and the Third Party Application I have (Provided by Microsoft) that is creating YUV Formats and it is working Fine with Source and Destination ColorKey. I dont have source code for it :(

I just tried removing Check condition but UpdateOverlay doesnt Report any Error That Means .. It is supporting Source Colorkeying. But I dont see it. [:(]

Thanks
-Milind

Do you know where I can get this 3rd party Microsoft app from? I would like to see if I can get color keying working with YUV format to see if it's a hardware issue or just me screwing something up.
Ok Sure .. Give me your Email Address !!

or mail me on mil4milind@yahoo.co.in

I will send it to you .. With Mosquito Source Code ..

Thanks,
-MIlind
Thanks for that Milind, so just to let others know this does confirm my worse fears about NVidia cards. They only support YUY2 pixel format (as well as UYVY, YUU9, YU12 and IF09). And these do not support source color keying. They do however support destination key and destination key override.

It's very much a dissapointment to anyone who wants to use overlays with source color keying.
But Intel Supports Both ...Source and Destination with that application :)
But I am not able to get Mosquito Working .. for Source ColorKey .. :(

Did you select Source Key color as RED ??.. as if Intel supports NVIDIA should as well............

Any Idea or tip on following ..

Meanwhile I tried .. following
(1) Mosquito Creates 2 Back buffers so I reduce it to one so Now I have one Overlay Back Buffer and One Overlay Main Surface.
(2) Then I loaded Overlay Main Sufrace with Image and Blted another with Source Colorkey .. but stil it is not working ....
(3) same time if I Blt Overlay back buffer with any color say RED and use RED as Destination Key then I am able to load image in Overlay to Back Buffer successfully..

Any idea on that ??

Thanks,
-Milind
Yes I did use red as the color key in fact I tried using destination color key and you can see it works fine for that (only shows through red). But source color key doesn't work (greyed out so you cant even select it).

Would you still want to get your application working for your Intel card even if noone with an NVidia card could run your program with color keying?
Yes I really want to make it work as application is running so I want to make my Example work by any means :)

I have been trying for a week now .. As this is very basic concept of DDraw and I have to show it to someone .. on Intel Graphics :(

I will keep trying this and anyone out there knows about this please let me know what can be done here.

Thanks,
-Milind
Does anyone has any code sample for any format which does Source Colorkeying ??

If yes, please let me know. I might get some hint from it.

Thank you all,
-Milind

This topic is closed to new replies.

Advertisement