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)
   divide a color
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: divide a color  (Read 378 times)
eskimoblood

222550793222550793 WWW
divide a color
« on: Feb 23rd, 2005, 8:43pm »

Can someone explain me what happend when I divide a color like:
Code:

color cl=color(23,49,59);
cl/10;

something happens but I dont know what.
 
fjen

WWW
Re: divide a color
« Reply #1 on: Feb 23rd, 2005, 9:08pm »

color in processing represents an int-type. so you could as well write:
 
int cl=color(0,0,0);
 
it's the way the int is written that makes the magic. the int is made of 32 bits or 4 bytes. each byte can represent values between 0-255, sounds familiar
 
so in fact color is:
AAAAAAAA RRRRRRRR GGGGGGGG BBBBBBBB
(A=alpha, R=red, ...)
 
more is here:
http://processing.org/discourse/yabb/board_Programs_action_disp_lay_num_1099892081.html
 
dividing the int more or less garbles the values since it treats it as one value between Integer.MIN_VALUE and Interger.MAX_VALUE ... maybe a nice way to randomize colors.
 
/F
 
Pages: 1 

« Previous topic | Next topic »