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

Bitmap Translucency

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster

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

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 mode
for(each pixel)
color3 = ((color1&MASK565)+(color2&MASK565))>>1;

// if you are in 555 mode
for(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.

Share this post

Link to post
Share on other sites