|
-
Sep 20th, 2002, 11:51 PM
#1
Thread Starter
Junior Member
transparentcy directx7
hey everyone,
ive just started using directx7. ive been blt'ing pics in a fullscreen environment. i was wondering how i could for example, have a background image taking up the whole screen then have another image over the top of it with transparentcies as so i can see through to the background image...if that made sense...
any help would be muchly appreciated
thanks dudes
tim
-
Sep 20th, 2002, 11:53 PM
#2
Thread Starter
Junior Member
just to add to that. in other words how do i get an image to have transparentcies? would i have to set one colour to be transparent or something?..
-
Sep 21st, 2002, 07:46 AM
#3
Good Ol' Platypus
What you do is use the Colourkey. More can be found at http://www.directx4vb.com/; there's a whole tutorial (I think) dedicated to it.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Sep 21st, 2002, 05:56 PM
#4
Thread Starter
Junior Member
thanks dude,
i read the tutorial, its pretty confusing and in the end doesnt really address the issue of making something 'transparent'. also i read:
'So now you can key out any color in 16-bit, and not just black, white, and magenta.'
black white or magnetta or anything would be cool...i just need a colour to be transparent. im still stumped on HOW to do it... mabe it was in the tutorial, but i didnt find anything..
i dunno, im just confused.
thanks anyways
tim
-
Sep 21st, 2002, 07:45 PM
#5
Good Ol' Platypus
If I remember correctly you do something like this:
1. Create a colourkey object (should be in that tutorial).
2. Set it's .low and .high both to 0 (for BLACK).
3. Use the Surface's method to set this colourkey.
4. Blit it with the colourkey flag on.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Sep 21st, 2002, 08:07 PM
#6
Thread Starter
Junior Member
awsome, thanks heaps dude
-
Sep 21st, 2002, 10:41 PM
#7
Thread Starter
Junior Member
ive done this code here but it doesnt seem to be working...
i used another tut as a guide, its not very clear either...
Set SURF_tsetup = Nothing
ddsd_tsetup.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
ddsd_tsetup.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
ddsd_tsetup.lWidth = 90
ddsd_tsetup.lHeight = 30
SURF_tsetup.GetPixelFormat pf
CKey.low = 0 'black
CKey.high = 0
SURF_tsetup.SetColorKey DDCKEY_SRCBLT, CKey
Set SURF_tsetup = dd.CreateSurfaceFromFile(App.Path & "\image\tsetup.bmp", ddsd_tsetup)
then when im blt'ing:
ddrval = backbuffer.BltFast(0, 0, SURF_tsetup, RECT_tsetup, DDBLTFAST_SRCCOLORKEY)
i dont know if this is right but it isnt working....
thanks anyways
tim
-
Sep 22nd, 2002, 12:02 AM
#8
Addicted Member
Try calling the SetColorKey function after you create the surface. Also, you can specify the color key in the surface description before calling the create surface function.
-
Sep 22nd, 2002, 12:20 AM
#9
Thread Starter
Junior Member
thanks Machaira, i tried the first sentence and that didnt work... and i dont really know what your trying to say in the 2nd sentence... also i know which lines it is thats screwing it up,
when i commented out:
SURF_tsetup.GetPixelFormat pf
CKey.low = 0 'black
CKey.high = 0
SURF_tsetup.SetColorKey DDCKEY_SRCBLT, CKey
it seemed to work, but without my transparent image...
im stumped
thanks anyway for the help people
tim
-
Sep 22nd, 2002, 06:25 PM
#10
Thread Starter
Junior Member
ok, problem fixed. turns out i didnt have this line here..
Dim CKey As DDCOLORKEY
duh..
and i didnt need that 'SURF_tsetup.GetPixelFormat pf' line either, no idea what it does, but its gone...
but yea thanks for all the help anyways Sastraxi and Machaira
later
tim
-
Sep 22nd, 2002, 07:06 PM
#11
Addicted Member
A good reason to always use Option Explicit in all of your form's and modules.
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
|