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 › get current colorMode
Page Index Toggle Pages: 1
get current colorMode? (Read 345 times)
get current colorMode?
Sep 22nd, 2008, 2:44pm
 
hi all,

is it possible to "get" the current colorMode of a running sketch?

this would be helpfull for me because i'm try to write some color mapping function independent of the current colormode eg. colorMode(HSB, 400,50,50,50) ...

thanks
benedikt
Re: get current colorMode?
Reply #1 - Sep 22nd, 2008, 4:44pm
 
The current colormode is stored in the g object along with all sorts of other useful rendering settings. I have previously written a class for extracting these settings (including colormode), which may be useful. See my style stack class for an example.

Re: get current colorMode?
Reply #2 - Sep 23rd, 2008, 12:35pm
 
thanks jo wood,

your class looks very interesting! going to try that out ...
the solution was already in your class:

colorMode(HSB, 360,100,100,100);

println(g.colorModeX);
println(g.colorModeY);
println(g.colorModeZ);
println(g.colorModeA);
Page Index Toggle Pages: 1