本参考资料用于Processing 3.0+。 如果你使用的是前一版本，请在使用软件帮助菜单内的参考资料。. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.
|描述|| Extracts the green value from a color, scaled to match current colorMode(). The value is always returned as afloat, so be careful not to assign it to an
The green() function is easy to use and understand, but it is slower than a technique called bit shifting. When working in colorMode(RGB, 255), you can acheive the same results as green() but with greater speed by using the right shift operator (>>) with a bit mask. For example, the following two lines of code are equivalent means of getting the green value of the color value c:
float r1 = green(c); // Simpler, but slower to calculatefloat r2 = c >> 8 & 0xFF; // Very fast to calculate
>> (right shift)
Updated on October 2, 2018 05:02:10pm EDT