Skip to main content
gamedev.net
🔒 Locked

negative

Started by Pillejunior Mar 10, 2004 at 5:04 AM 3 replies 400+ views
Original Post
Pillejunior
Pillejunior
quick question: how do you calculate the negative of a color? And for example if it is stored as FF FF FF rgb. Where do i subtract/add/?? it with thanx in advance
aboeing
aboeing
depends on what you define as the negative.
usually you mean to ''invert'' the color

so the opposite of 0xffffff (white) would be 0x000000 (black)

so one way is to use the bitwise negate operator
(so assuming your using C:
negativecolor = ~color;
)

or just going:
negativecolor = 0xffffff - color;
Pillejunior
Pillejunior
i use delphi and i just used ''xor FFFFFF'' and that works. Thanx anyway!!
shmoove
shmoove
Yeah, ''not'' would work just the same since it''s equivalent to ''xor FFFFFF''

shmoove

Topic Locked

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

Sign in to reply to this topic.