🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

COLORREF information

Started by
1 comment, last by kmsixpence 22 years, 8 months ago
I''m sorry, but I would like to ask another Q. I use GetPixel to get the pixel at a location. I have it stored in a COLORREF. How would you read each indivual color(red, green , blue) and store it in 3 seperate ints?
Advertisement
can anyone tell me?
I''ll give it a try.

According to the MSDN the colorref value is stored like this:

0x00bbggrr

  COLORREF pixel;int      red, green, blue;red = pixel & 0xFF;pixel = pixel >> 8;green = pixel & 0xFF;pixel = pixel >> 8;blue = pixel & 0xFF;  


The code might be all wrong but I think the general idea is that you have to use the bitwise and shift operators.

This topic is closed to new replies.

Advertisement