Skip to main content
GameDev.net gamedev.net
🔒 Locked

Pixel Calculations (bits)

Started by Big Al Jul 1, 2000 at 10:00 PM 0 replies 200+ views
Original Post
Big Al
Big Al
Okay, I have recently been implementing a pixel calculating routine for 16-bit surfaces. Okay Now I have set it up to do this: To take the most important bits and dump the least important bits. #define RGBG16(r, g, b) (((((WORD)r >> objDD.RGBDetails.RedRightBitShift) & objDD.RGBDetails.RedANDMask) << objDD.RGBDetails.RedLeftBitShift) + ((((WORD)g >> objDD.RGBDetails.GreenRightBitShift) & objDD.RGBDetails.GreenANDMask) << objDD.RGBDetails.GreenLeftBitShift) + ((((WORD)b >> objDD.RGBDetails.BlueRightBitShift) & objDD.RGBDetails.BlueANDMask) << objDD.RGBDetails.BlueLeftBitShift)) Note that I changed OR''s to +''s. Is this better than just accepting the lower bits or can I have a comprimise?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.