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

Extracting the A,R,G and B from a D3DCOLOR

This topic is 5112 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

Well, looking at MSDN, it says that D3DCOLOR is defined as:
typedef DWORD D3DCOLOR  

So, you should be able to extract the info as this:
a = (myColor >> 24) & 0xFF;
r = (myColor >> 16) & 0xFF;
g = (myColor >> 8) & 0xFF;
b = myColor & 0xFF;

... or the other way around (change the order of a r g b.. dunno about it)

edit: added alpha

[edited by - Jolle on December 13, 2003 6:41:39 AM]

Share this post

Link to post
Share on other sites
Original post by Namethatnobodyelsetook
Original post by PlayGGY
Yep, your right, the order is 0xAARRGGBB, so use a bitwise AND ''&&''.

He did use a bitwise and. You''re using a logical and, and calling it bitwise. Please drink more coffee.

*cries* Your right... ''&''. Should have caught that.

Share this post

Link to post
Share on other sites