forked from processing/processing-web-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgreen.xml
More file actions
executable file
·52 lines (39 loc) · 1.4 KB
/
Copy pathgreen.xml
File metadata and controls
executable file
·52 lines (39 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>green()</name>
<category>Color</category>
<subcategory>Creating & Reading</subcategory>
<usage>Web & Application</usage>
<example>
<image>green_.gif</image>
<code><![CDATA[
noStroke();
color c = color(0, 126, 255);
fill(c);
rect(15, 20, 35, 60);
float value = green(c); // Sets "value" to "126"
fill(value);
rect(50, 20, 35, 60);
]]></code>
</example>
<description><![CDATA[Extracts the green value from a color, scaled to match current <b>colorMode()</b>. This value is always returned as a float so be careful not to assign it to an int value.<br /><br />The <b>green()</b> function is easy to use and undestand, but is slower than another technique. To achieve the same results when working in <b>colorMode(RGB, 255)</b>, but with greater speed, use the >> (right shift) operator with a bit mask. For example, the following two lines of code are equivalent:<br /><pre>float r1 = green(myColor);<br />float r2 = myColor >> 8 & 0xFF;</pre>]]></description>
<syntax><![CDATA[
green(<kbd>color</kbd>)
]]></syntax>
<parameter>
<label>color</label>
<description><![CDATA[any value of the color datatype]]></description>
</parameter>
<returns>float</returns>
<related>
red()
blue()
hue()
saturation()
brightness()
>> (right shift)
</related>
<availability>1.0</availability>
<type>Function</type>
<partof>Core</partof>
</root>