Skip to main content
gamedev.net
🔒 Locked

Transparency + Surfaces

Started by Nomad010 Mar 12, 2005 at 3:05 PM 2 replies 1.1k views
Original Post
Nomad010
Nomad010
How would one go about loading a bitmap with mask colors into a surface? This surface is just gonna be blitted to the screen. (In D3D 9 C++)
"..."
Muhammad Haggag
Muhammad Haggag
When loading the bitmap into a texture via D3DXCreateTextureFromFileEx, you can specify a "colorkey" - a color that is searched for in the bitmap, and replaced with a transparent color. Then, you enable alpha-testing and render whatever you want with your texture - the transparent pixels won't be drawn.

nuc
nuc
You can also try creating an offscreen surface and loading the image to it. This can be done by calling following functions:

IDirect3DDevice9::CreateOffscreenPlainSurface
D3DXLoadSurfaceFromFile

This API allows the color key to be used too. Also call D3DXGetImageInfoFromFile can become handy if you decide to try this.

-nuc
Nomad010
Nomad010
Thank you. Yes, these will do nicely.
"..."

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.