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


How to convert bitmap.....

Recommended Posts

It depends what pixel format you have for 16 bit. If you have 5-6-5, then you use a different method than 5-5-5. (red-green-blue bits)

If you have 5-5-5, something like this will work:
red = (color16 >> 10) & 0x1F;
green = (color16 >> 5) & 0x1F;
blue = color 16 & 0x1F;

color24 = (red << 19) | (green << 11) | (blue << 3);

I believe that is about right. You basically want to take the five bits of each color component and put it into the highest five bits of your 24 bit color components.

Share this post

Link to post
Share on other sites
You may wish to replace the upper bits of the 5-bit/6-bit value into the lower bits of the 8-bit value. Otherwise you are sitting them to 0 which will slighly darken brighter colors.

i.e., the birghtest red/green/blue/white in 5-bit color is 11111, which when conveted to 8-bits is 11111000, which is darker than 11111111 !!

-Matt P
Developer AoE/AoK/???

Share this post

Link to post
Share on other sites