this may doesnt sound really helpful, but the best way, to understand stuff like this, is to "play" with it, code it, print() it, and try to understand the result, change some values, and print it again.
try to run the following in processing:
- color c_gray1 = color(200);
- color c_gray2 = color(200, 200, 200); // try to change values
- println("c_gray1 = " + c_gray1 );
- println("c_gray2 = " + c_gray2 );
- int val_1 = (c_gray2 >> 0) & 0xFF; // in rgba this would be blue
- int val_2 = (c_gray2 >> 8) & 0xFF; // in rgba this would be green
- int val_3 = (c_gray2 >> 16) & 0xFF; // in rgba this would be red
- int val_4 = (c_gray2 >> 24) & 0xFF; // in rgba this would be alpha
- println("rgba = "+ val_3 +", "+ val_2 +", "+ val_1 +", "+ val_4);
thomas