for hex to RGB you can use
r = hex >> 16
g = (hex ^ hex >> 16 << 16) >> 8
b = hex >> 8 << 8 ^ hex
which if all being done at once, can be reduced to
r = hex >> 16;
temp = hex ^ r << 16;
g = temp >> 8;
b = temp ^ g << 8;
going back to hex is simply
r << 16 ^ g << 8 ^ b
Friday, July 30, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment