• Advertisement

Archived

This topic is now archived and is closed to further replies.

Need help..Operators - adding bytes to dword

This topic is 5982 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to add alpha and RGB values to a DWORD. I have two variables (where the XX are modified only).. BYTE nAlpha; // 0xXX DWORD nRGB; // 0x00XXXXXX I need to add them together, for example, if the alpha was 0x55 and the RGB was 0x00667788, the outcome would be 0x55667788 At the moment I do it this way: nAlpha = 0x55; nRGB = 0x00667788; dwColor = ( ((nAlpha) << 24) | nRGB ) ; But the results are incorrect How is this done properly? Thanks in advance

  Downloads:  ZeroOne Realm

Share this post


Link to post
Share on other sites
Advertisement
Use (or at least look at) the DirectX supplied macros D3DCOLOR_XRGB and D3DCOLOR_ARGB.

Share this post


Link to post
Share on other sites
Um, dont worry, I have it working now.
(Stupid mistake: The RGB was 0xFFFFFF)

I prefer not to use the D3D macros, thanks anyway.

Share this post


Link to post
Share on other sites

  • Advertisement