Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Extracting R,G,B data?

Credits go to X-G for helping out!
This thread is locked; no one can reply to it. rss feed Print
Extracting R,G,B data?
Steve Whitmore
Member #4,317
February 2004
avatar

Hey folks,

I'm sure it involves bit-shifting (which I'm not too well-versed in), but how does one extract the individual red, green, and blue values from an integer storing pixel data in, say, a 16-bit colour depth?

Thanks in advance! :)

X-G
Member #856
December 2000
avatar

dsdsfgsdfgsdsgdf getr getg getb sgfsdfhgsdfnbvc n

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Steve Whitmore
Member #4,317
February 2004
avatar

Jonatan Hedborg
Member #4,886
July 2004
avatar

I'll throw in a "RTFM" for good measure.

-------
Sweden: Free from the shackles of Democracy since 2008-06-18!

Go to: