2 things in DirectDraw

porthios
11-01-2001, 03:46 PM
Here are my 2 questions:

1) Why is it that when you set the color key for the Source surface, only black seems to work. Ive used magenta and it still appears when i Blt it to another DD surface.

2) What are overlays used for and How do you code them?

All this is in VB (just in case someone thoughtn it may be C++) Any help appreciated.

Squirm
11-01-2001, 04:06 PM
If you are talking about regular Blting of an OFFSCREENPLAIN surface, the information about the colour key is stored in its own property. Lets say your surface is called tempSurf :

<pre>Dim lColKey As DDCOLORKEY
lColKey.high = <font color=red>some Long color value</font color=red>
lColKey.low = <font color=blue>some Long color value</font color=blue>
tempSurf.SetColorKey DDCKEY_SRCBLT, lColKey</pre>

What this means is that all colours that fall between the low and high values are ingored. If you set the low value to black and the high value to white, then nothing would be displayed, for example. Of course, you probably dont want this, and its usually fine to set the low and high to the same value.

Although I have to say that Blting using this colkey method is very slow, and the speed decreases exponentially to the size of the graphic. Another method is to use TLVERTEXes with a colkey'ed texture applied to it, with which you can use Black, White, or Magenta colorkeys.

In the Code Library there is a sample DX application I made. In it, there is a CreateTextureSurface function, which deals with Magenta colour keys.

Good luck

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum