A question on displaying surfaces

How can I load a surface from a file to the screen and load another surface on top of it and allow parts of the previous surface to show through?
So far I have been able to load the surfaces, but when they are displayed, the one I want to be transparent in certain areas displays black in those parts.

Thanks for any help someone can give me.

[354 byte] By [Gernsworth] at [2007-12-20]
# 1
You've got a number of options. Here's three off the top of my head:

* Use alpha blending and/or alpha testing
* Use the stencil buffer
* Use a pixel shader that clip()s black pixels

RichardFine at 2007-9-10 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 2
Thanks for your advice, but I am a little confused.
I have tried looking for examples of these, but I haven't been able to find an example of this using surfaces and 2d graphics. When I load the files to the surface, I set the color key to the color I want transparent(255,0,255), copy the pictures to the back buffer, and display it. I have tried using alpha blending by enabling it with the SetRenderState function, but what I see is black instead of the origional color or the picture I loaded behind it.
If anyone could point me to an example or tutorial using surfaces and 2d graphics, then that would be great.
Thanks
Gernsworth at 2007-9-10 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...