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.
IndexSuggestions & BugsSoftware Bugs › colorMode(HSB) Default Values.
Page Index Toggle Pages: 1
colorMode(HSB) Default Values. (Read 1768 times)
colorMode(HSB) Default Values.
Apr 26th, 2005, 2:25pm
 
Hiya.

The following code generates different results in v68 and v85.
Quote:
colorMode(HSB);

fill(0,128,128 );
rect(0,0,50,100);

color myColor = color(0,128,128 );
fill(myColor);
rect(50,0,50,100);



In alpha 68 you get two dull red rectangles (i.e. HSB(0,128,128 )).  In beta 85 you get one red, one blue-green (i.e. RGB(0,128,128 )).

...   ...

It appears that 'fill', (and 'set' and some other 2D graphics commands) don't pick up the fact that we've switched to HSB.  You can trip it to be correct using:

Quote:
 colorMode(HSB, 255);


I guess that somewhere along the line the HSB default doesn'y get implemented.  If this is an intentional  change it might be worth altering the description of colorMode in the help to reflect this.

The same issue can be illustrated with 'set' using:

Quote:
colorMode(HSB); //fails ...
//colorMode(HSB, 255);  //works!!!
color myColor = color(0,128,128 );

fill(0,128,128 );
rect(0,0,50,100);

fill(myColor);
rect(50,0,50,100);

for(int i = 0; i<100; i++){
 set(i,i,myColor);
}

for(int i = 0; i<100; i++){
 set(10,i,color(0,128,128 ));
}


...


Cheers,

reg



Re: colorMode(HSB) Default Values.
Reply #1 - Apr 26th, 2005, 5:21pm
 
good catch.. found and fixed. i appreciate the detailed explanation.

fwiw, the problem was in an optimization that if the colorMode is RGB and the max is 255, then a lot less code needs to be used when manipulating colors. but colorMode(HSB) wasn't properly un-setting the value that said that the current mode was rgb/255.
Re: colorMode(HSB) Default Values.
Reply #2 - May 7th, 2005, 7:40pm
 
all fixed, closing thread.
Page Index Toggle Pages: 1