Education/Projects/ProcessingForTheWeb/PImage.get: Difference between revisions
< Education | Projects | ProcessingForTheWeb
Jump to navigation
Jump to search
Line 6: | Line 6: | ||
=== Examples === | === Examples === | ||
PImage | PImage pimg = new PImage(loadImage("fish.jpg")); <br /> | ||
PImage pimg2 = pimg.get(0,0,64,46);<br /> | |||
color c= pimg.get(120,0);<br /> | |||
image( | fill(c);<br /> | ||
image(pimg,0,0);<br /> | |||
rect(25, 25, 50, 50);<br /> | |||
image(pimg2,0,93);<br />[[File:PImageGet.jpg]] | |||
=== Syntax === | === Syntax === |
Revision as of 01:27, 28 November 2009
Summary
This is a method of the PImage class written for Education/Projects/ProcessingForTheWeb. Gets the color of a pixel, a group of pixels, or the entire image. View official Reference
Examples
PImage pimg = new PImage(loadImage("fish.jpg"));
PImage pimg2 = pimg.get(0,0,64,46);
color c= pimg.get(120,0);
fill(c);
image(pimg,0,0);
rect(25, 25, 50, 50);
image(pimg2,0,93);
Syntax
Description | |
---|---|
img.get() | returns the entire image |
img.get(x, y) | returns the color of a single pixel in the img pixels[y*width+x] |
img.get(x, y, width, height) | returns a section of the display window by specifing an additional width and height parameter. If the pixel requested is outside of the image window, black is returned. |
Parameters
Description | |
---|---|
img | PImage |
x | x-coordinate of the pixel |
y | y-coordinate of the pixel |
width | width of pixel rectangle to get |
height | height of pixel rectangle to get |
Returns
color or PImage
Bugs
Refer to the reference of each function for a specific bug report.
Bug Description | Fixed?(Date) |
---|---|