PDA

Click to See Complete Forum and Search --> : DirectDraw Transperancy


gwdash
Sep 14th, 2000, 04:38 PM
When using the DirectDraw Funciton SetColorKey how do i convert the RGB Value for the color i want into the DDCOLORKEY Structure. I have bright green as my key. I tried:

Key.high = RGB(0,255,0)
Key.low = RGB(0,255,0)

That didn't work, the only thing i know is black is

key.high = 0
key.low = 0

Can't do that because black is in my pict

Any help would be great

Grant

kedaman
Sep 15th, 2000, 07:31 AM
Just something i got from Fox page:

Function ConvertColor(R As Byte, G As Byte, B As Byte, Surface As DirectDrawSurface7) As Long
Dim Temp As DDPIXELFORMAT

Dim Red As Single
Dim Green As Single
Dim Blue As Single
Dim Alpha As Single

'Shift colors
Red = R / 255
Green = G / 255
Blue = B / 255
Alpha = 1

'Get the pixel format
Surface.GetPixelFormat Temp

'Return the scaled color
ConvertColor = (Temp.lRGBAlphaBitMask * Alpha And Temp.lRGBAlphaBitMask) + (Temp.lRBitMask * Red And Temp.lRBitMask) + (Temp.lGBitMask * Green And Temp.lGBitMask) + (Temp.lBBitMask * Blue And Temp.lBBitMask)
End Function

gwdash
Sep 15th, 2000, 03:12 PM
It worked, Yeah!!!!