forked from processing/processing-web-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget.xml
More file actions
executable file
·89 lines (63 loc) · 2.38 KB
/
Copy pathget.xml
File metadata and controls
executable file
·89 lines (63 loc) · 2.38 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>get()</name>
<category>Image</category>
<subcategory>Pixels</subcategory>
<usage>Web & Application</usage>
<example>
<image>get_.jpg</image>
<code><![CDATA[
PImage myImage = loadImage("topanga.jpg");
image(myImage, 0, 0);
PImage cp = get();
image(cp, 50, 0);
]]></code>
</example>
<example>
<image>get_2.jpg</image>
<code><![CDATA[
PImage myImage = loadImage("topanga.jpg");
image(myImage, 0, 0);
color cp = get(30, 20);
fill(cp);
rect(30, 20, 55, 55);
]]></code>
</example>
<description><![CDATA[
Reads the color of any pixel or grabs a section of an image. If no parameters are specified, the entire image is returned. Get the value of one pixel by specifying an x,y coordinate. Get a section of the display window by specifying an additional <b>width</b> and <b>height</b> parameter. If the pixel requested is outside of the image window, black is returned. The numbers returned are scaled according to the current color ranges, but only RGB values are returned by this function. For example, even though you may have drawn a shape with <b>colorMode(HSB)</b>, the numbers returned will be in RGB.
<br /><br />
Getting the color of a single pixel with <b>get(x, y)</b> is easy, but not as fast as grabbing the data directly from <b>pixels[]</b>. The equivalent statement to "get(x, y)" using <b>pixels[]</b> is "pixels[y*width+x]". Processing requires calling <b>loadPixels()</b> to load the display window data into the <b>pixels[]</b> array before getting the values.
<br /><br />
As of release 0149, this function ignores <b>imageMode()</b>.
]]></description>
<syntax><![CDATA[
get()
get(<kbd>x</kbd>, <kbd>y</kbd>)
get(<kbd>x</kbd>, <kbd>y</kbd>, <kbd>width</kbd>, <kbd>height</kbd>)
]]></syntax>
<parameter>
<label>x</label>
<description><![CDATA[int: x-coordinate of the pixel]]></description>
</parameter>
<parameter>
<label>y</label>
<description><![CDATA[int: y-coordinate of the pixel]]></description>
</parameter>
<parameter>
<label>width</label>
<description><![CDATA[int: width of pixel rectangle to get]]></description>
</parameter>
<parameter>
<label>height</label>
<description><![CDATA[int: height of pixel rectangle to get]]></description>
</parameter>
<returns>color or PImage</returns>
<related>
set()
pixels[]
imageMode
</related>
<availability>1.0</availability>
<type>Function</type>
<partof>Core</partof>
</root>