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 › retrieving colorMode
Page Index Toggle Pages: 1
retrieving colorMode (Read 471 times)
retrieving colorMode
Aug 8th, 2005, 10:57pm
 
How can I retrieve (and store) the current colorMode?  I have a member function of a class that needs to work in HSB, and I would like it to restore the colorMode to it's prior state after executing (be it HSB or RGB.)
Re: retrieving colorMode
Reply #1 - Aug 9th, 2005, 5:15am
 
g.colorMode is what you're looking for.

int savedColorMode = g.colorMode;
colorMode(HSB);

// do things

colorMode(savedColorMode);

and if you want the max values for each component, they're
g.colorModeX (for red or hue)
g.colorModeY (for green or saturation)
g.colorModeZ (for blue or brightness)
g.colorModeA (alpha)
Page Index Toggle Pages: 1