FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   default colorMode(HSB) values?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: default colorMode(HSB) values?  (Read 250 times)
rich

amunre05 WWW Email
default colorMode(HSB) values?
« on: Oct 23rd, 2004, 6:37pm »

RGB colorMode has default mode values of 255. Does anyone know the default values for HSB?
 
amoeba

WWW
Re: default colorMode(HSB) values?
« Reply #1 on: Oct 24th, 2004, 5:14am »

I think you can assume it goes 0..255 as well. Unless you set it otherwise, or I'm much mistaken.
 

marius watz // amoeba
http://processing.unlekker.net/
rich

amunre05 WWW Email
Re: default colorMode(HSB) values?
« Reply #2 on: Oct 24th, 2004, 6:54pm »

Actually, I think I just found out it's 360, 100, 100. At least that's the equivalent in Photoshop...
 
amoeba

WWW
Re: default colorMode(HSB) values?
« Reply #3 on: Oct 24th, 2004, 10:45pm »

My apologies for not testing my assumption in my first post. However, I just did a sketch and it does in fact seem that the default values are 0..255. (Perhaps this should be in the reference - Casey?)
 
The following code will render the full spectrum, with mouseY controlling the brightness:
 
Code:
void setup() {
  size(256,256);
  colorMode(HSB);
}
 
void loop() {
 
  noStroke();  
  for(int i=0; i<256; i++) {  
    for(int j=0; j<256; j++) {  
 stroke(i, j, 255-mouseY);  
 point(i, j);  
    }  
  }
}

 
However, if you want the behavior you mention, all you need to do is say:
 
colorMode(HSB, 360,100,100);
 

marius watz // amoeba
http://processing.unlekker.net/
fry


WWW
Re: default colorMode(HSB) values?
« Reply #4 on: Oct 24th, 2004, 11:00pm »

yeah, if you switch to colorMode(HSB) it'll still be using the same values as before. so if you had:
 
colorMode(RGB, 1);
then calling colorMode(HSB);
will still leave things as values from 0..1
 
and as amoeba pointed out, colorMode(HSB, 360, 100, 100) will give you photoshop-style colors.. this is the intent of colorMode() since we figure most people are familiar with different types of color settings (photoshop, illustrator, or 0..1 computer graphics style).
 
Pages: 1 

« Previous topic | Next topic »