Jump to content
  • Advertisement

Archived

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

IFooBar

whats the formula for inverting color/

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

Hi say I have an RGBA value of 100,120,200,230. How would i get the inverse? it cant possibly be 1/200, 1/120,1/200, 1/230! thanks for help
:::Al:::
[Triple Buffer V2.0] - Resource leak imminent. Memory status: Fragile

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
255-r,255-g,255-b,255-a

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
or
R = ~R;
G = ~G;
B = ~B;

Share this post


Link to post
Share on other sites
Andos:

~ for integers is a "bitwise NOT".

i.e. every binary 1 bit becomes a 0 and vice versa.



We could go on for days posting subtle and obfuscated code snippets which all do the same basic thing of inverting the colour. I think the basic question has been answered though


r = r^255;
g = g^255;
b = b^255;



--
Simon O'Connor
Creative Asylum Ltd
www.creative-asylum.com

[edited by - S1CA on December 8, 2002 11:15:21 AM]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!