-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPImage_get.html
More file actions
85 lines (68 loc) · 5.04 KB
/
Copy pathPImage_get.html
File metadata and controls
85 lines (68 loc) · 5.04 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
<!DOCTYPE html>
<html>
<head>
<title>PImage_get \ Language (API)</title>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Author" content="Ce Gao" />
<meta name="Publisher" content="Processing" />
<meta name="Keywords" content="Processing, Processing, Interactive Media, Electronic Arts, Programming, gaocegege, R Language" />
<meta name="Description" content="R Language Mode for Processing extends the Processing Development Environment with the R Language." />
<script src="/javascript/modernizr-2.6.2.touch.js" type="text/javascript"></script>
<link href="/css/style.css" rel="stylesheet" type="text/css" />
</head>
<body id="Langauge-en" onload="" >
<div id="container">
<div id="header">
<a href="/" title="Back to R Language Mode" class="processing-logo no-cover"></a>
</div>
<a id="TOP" name="TOP"></a>
<div id="navigation">
<div class="navBar" id="mainnav">
<a href="/">Cover</a><br/>
<a href="/reference/">Reference</a><br/>
<a href="/tutorials/">Tutorials</a><br/>
<!-- <a href="/examples/">Examples</a><br/> -->
<a href="https://github.com/gaocegege/Processing.R/issues">Bugs</a>
</div>
</div>
<div class="content">
<table cellpadding="0" cellspacing="0" border="0" class="ref-item">
<tr class="name-row">
<th scope="row">Name</th>
<td><h3>PImage_get</h3></td>
</tr>
<tr class="">
<th scope="row">Description</th>
<td>
Reads the color of any pixel or grabs a section of an image. If no parameters are specified, the entire image is returned. Use the <b>x</b> and <b>y</b> parameters to get the value of one pixel. Get a section of the display window by specifying an additional <b>width</b> and <b>height</b> parameter. When getting an image, the <b>x</b> and <b>y</b> parameters define the coordinates for the upper-left corner of the image, regardless of the current <b>imageMode()</b>.<br /> <br /> 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 format.<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 <b>get(x, y)</b> using <b>pixels</b> is <b>pixels[y*width+x]</b>. See the reference for <b>pixels</b> for more information.
</td>
</tr>
<tr class=""><th scope="row">Syntax</th><td><pre><c>pimg</c>.get(<c>x</c>, <c>y</c>)
<c>pimg</c>.get(<c>x</c>, <c>y</c>, <c>w</c>, <c>h</c>)
<c>pimg</c>.get()</pre></td></tr>
<tr class=""><th scope="row">Parameters</th><td><table cellpadding="0" cellspacing="0" border="0">
<tr class=""><th scope="row" class="code">pimg</th><td>PImage: any object of type PImage</td></tr>
<tr class=""><th scope="row" class="code">x</th><td>int: x-coordinate of the pixel</td></tr>
<tr class=""><th scope="row" class="code">y</th><td>int: y-coordinate of the pixel</td></tr>
<tr class=""><th scope="row" class="code">w</th><td>int: width of pixel rectangle to get</td></tr>
<tr class=""><th scope="row" class="code">h</th><td>int: height of pixel rectangle to get</td></tr>
</table></tr>
<tr><th scope="row">Related</th><td class="code">
<a class="code" href="./set.html">set</a><br />
<a class="code" href="./pixels.html">pixels</a><br />
</table>
<!-- Creative Commons License -->
<div class="license">
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border: none" src="http://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a>
</div>
</div>
<div id="footer">
<div id="copyright">Processing is an open project intiated by <a href="http://benfry.com/">Ben Fry</a> and <a href="http://reas.com">Casey Reas</a>. It is developed by a <a href="http://processing.org/about/people/">small team of volunteers</a>.</div>
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/javascript/jquery-1.9.1.min.js"><\/script>');</script>
<script src="/javascript/site.js" type="text/javascript"></script>
</body>
</html>