#### Archived

This topic is now archived and is closed to further replies.

# Bitmap Translucency

This topic is 6204 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Using DirectDraw, is there any way to make a bitmap translucent?

##### Share on other sites
I think with DirectX you''re limited to using D3D and it''s alpha blending capabilities, or implementing a software translucency method with direct draw (thrownback to dx7)

##### Share on other sites

There is a good article here on how to do 8 bit software
translucency:

http://www.flipcode.com/tutorials/tut_transmaps.shtml

For 16 bit translucency, you can try something like this:

#define MASK565 (1111011111011110b); // assuming a 565 format#define MASK555 (0111101111011110b); // assuming a 555 format// if you are in 565 modefor(each pixel){    color3 = ((color1&MASK565)+(color2&MASK565))>>1;}// if you are in 555 modefor(each pixel){    color3 = ((color1&MASK555)+(color2&MASK555))>>1;}

The above is only good for 50% translucency, and it is slight inaccurate in the LSB. If you want other percentages, you will have to separate each pixel into it''s red, green, and blue components, average them together using math or a lookup table, and recombine each red, green, and blue value into your new color.

1. 1
2. 2
3. 3
Rutin
19
4. 4
5. 5

• 10
• 14
• 30
• 13
• 11
• ### Forum Statistics

• Total Topics
631782
• Total Posts
3002332
×