Jump to content
  • Advertisement

Archived

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

jack_1313

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

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

Advertisement
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
Yep, your right, the order is 0xAARRGGBB, so use a bitwise AND '&&'. EDIT: I mean '&'... woops...

[edited by - PlayGGY on December 13, 2003 12:30:38 AM]

Share this post


Link to post
Share on other sites
Yeah, but they doesn''t seem to have an GetAValue() :/
You would think that they would write those kind of functions down in the D3DCOLOR-document.

Share this post


Link to post
Share on other sites
quote:
Original post by Namethatnobodyelsetook
quote:
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!