#### Archived

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

# Taking 16bit to 24bit

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

## Recommended Posts

For some reason. When I use
  unsigned char byBlue = (wValue & m_ddpxfColor.dwBBitMask)* 255/m_ddpxfColor.dwBBitMask); unsigned char byGreen = (wValue & m_ddpxfColor.dwGBitMask)* 255/m_ddpxfColor.dwGBitMask); unsigned char byRed = (wValue & m_ddpxfColor.dwRBitMask)* 255/m_ddpxfColor.dwRBitMask); 
To convert my colors back to 24 bit when I convert them back. They appear darker. Is there a flaw in my math I don''t see?

##### Share on other sites
thats because you dont shift

than thats 255/0xf800 or 255/(more than 255) and thats 0.
(integer division).

just think about it again, and maybe youll see what youre doing wrong.

--- foobar
We push more polygons before breakfast than most people do in a day

##### Share on other sites
You lose to low order 3-bits when you convert *TO* 16-bit colors. Typical format: ARRRRRGGGGGBBBBB. Thus a full intensity color of 11111111 becomes 11111000. I think your math is OK - You multiply by 255 first, then divide...

1. 1
2. 2
Rutin
23
3. 3
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 11
• ### Forum Statistics

• Total Topics
633653
• Total Posts
3013158
×