Advertisement

RGB Colors in 16 bits help !

Started by October 24, 2002 04:49 AM
3 comments, last by Le0 22 years ago
I really need help in understanding how the colors are coded in RGB using 16bits depth, i cant figure it out i dont know if im tired or something but... im using that macro btw #define RGB16(r,g,b) ((r << 11) + (g << 5) + b) and i cant figure out how to put the color #2e2e2e in that Leo
"The bible is probably the most genocidal book ever written!" Noam Chomsky
Your macro is wrong. If you want a 565 macro it should look like this:

#define RGB16(red, green, blue) ( ((red >> 3) << 11) | ((green >> 2) << 5) | (blue >> 3))

If you want to learn why the macro is like that, I explain it in this thread.

***********************
          
Advertisement
BigSassy,

Just wanted to say that that was REALLY well done explanation.
"I thought Genius lived in bottles..." - Patrick Star
quote: Original post by Xanth
BigSassy,

Just wanted to say that that was REALLY well done explanation.
Thanks. Just trying to give back to the community

quote: Thanks. Just trying to give back to the community


You're welcome , and congratulations on a shining success!

[edited by - Xanth on October 24, 2002 9:44:36 PM]
"I thought Genius lived in bottles..." - Patrick Star

This topic is closed to new replies.

Advertisement