We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › faster hue() / faster hsb2rgb conversion
Page Index Toggle Pages: 1
faster hue() / faster hsb2rgb conversion? (Read 1025 times)
faster hue() / faster hsb2rgb conversion?
Dec 7th, 2007, 3:32am
 
hi all

i know about using

float r = (c >> 16) & 0xFF;

instead of red(c)

but is there an equivalent shift function that could be used to extract the hue() saturation() values from a colour more quickly?

and also, is there a quick way to convert from rgb to hsb on the fly? (aside from javas Color.RGBtoHSB()

thanks....
Re: faster hue() / faster hsb2rgb conversion?
Reply #1 - Jan 20th, 2010, 7:46am
 
well, if you've got an rgb color c you can just use hue(c), saturation(c), brightness(c) to convert!

cheers,
j
Re: faster hue() / faster hsb2rgb conversion?
Reply #2 - Jan 20th, 2010, 10:12am
 
The functions mentioned by jns already use Color.RGBtoHSB.
Page Index Toggle Pages: 1