|
-
Jan 3rd, 2002, 05:18 PM
#1
Thread Starter
Hyperactive Member
Choosing DX transparency color?
How can I pick the color I want to be transparent in my sprites besides black? I've seen people that have white backgrounds, and they must have chosen white as their transparent color. It has something to do with .low and .high so what do I set them as? Thanks.
[vbcode]
' comment
Rem remark
[/vbcode]
-
Jan 3rd, 2002, 05:57 PM
#2
Good Ol' Platypus
In 8, 24 and 32 bit colour mode, set them to RGB(255, 255, 255), which is pure white. In 16 bit I'm not sure what you're supposed to set it to...
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Jan 4th, 2002, 12:06 PM
#3
Fanatic Member
I think the easy way to do this across all color modes is to get the value of the pixel located at 0, 0 once you load one of your images and use the returned value as your color key.
VB Code:
'...............................................................
Dim ck as DDCOLORKEY, lngTransCol as Long
' create surface and load picture that uses desired trans. color
Set surfOut = DD7.CreateSurfaceFromFile(pFile, ddsd)
lngTransCol = GetPixelColor(surfOut, 0, 0)
ck.low = lngTransCol
ck.high = lngTransCol
'......................................................
Public Function GetPixelColor(pSurf As DirectDrawSurface7, pX As Integer, pY As Integer) As Long
Dim rEmpty As RECT
Dim ddsd As DDSURFACEDESC2
pSurf.GetSurfaceDesc ddsd
' lock the surface to gain direct access to memory
pSurf.Lock rEmpty, ddsd, DDLOCK_WAIT, vbNull
' get the color value of the pixel
GetPixelColor = pSurf.GetLockedPixel(pX, pY)
pSurf.Unlock rEmpty
End Function
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Jan 4th, 2002, 12:14 PM
#4
Thread Starter
Hyperactive Member
[vbcode]
' comment
Rem remark
[/vbcode]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|