VC++: How to extract red, green and blue elements from a RGB value without using API functions?
How to extract red, green and blue elements from a RGB value without using API functions?
Following code retrieves red, green and blue elements from a COLORREF object rgb.
COLORREF rgb = RGB ( 100, 50, 75 ) ; int r, g, b ; r = ( ( rgb ) & 0xff ) ; g = ( ( ( rgb ) >> 8 ) & 0xff ) ; b = ( ( ( rgb ) >> 16 ) & 0xff ) ;




Comments
Log in or create a user account to comment.