PDA

Click to See Complete Forum and Search --> : DirectX Transparency Query


atjs
Oct 25th, 1999, 09:28 PM
Refering to DirectX development.
Anyone figured out how to use the DDCOLORKEY type?? I need to make a certain colour (bright purple to be exact) transparent, but I don't know how to use the .high and .low values. Who's found out?

Sastraxi
Jun 26th, 2000, 03:25 AM
Use This:


Sub Whatever
Dim CKey As DDCOLORKEY
Dim Surface1 as DirectDrawSurface7
dim DescS1 as DDSURFACEDESC2
Dim Transparent as long

Transparent=rgb(255,0,255)
ckey.low=transparent
ckey.high=transparent

DFlash.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
DFlash.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
DFlash.lWidth = 100
DFlash.lHeight = 100

Set Surface1 = DDraw.CreateSurfaceFromFile(App.Path & "\mybmp.bmp", DescS1)

Surface1.SetColorKey DDCKEY_SRCBLT, CKey

End Sub

Fox
Jun 26th, 2000, 11:31 AM
That would only work if your project uses 24-bit color... (I'm unsure about that). Anyway, here (http://f21.parsimony.net/forum38858/messages/72.htm)'s a function to convert RGB to DirectX-Color. ;)