PImage::get() \ Language (API) \ Processing 1.0
Search processing.org:
Language (A-Z) \
Libraries \
Tools \
Environment \
Compare \
Troubleshooting
Reference for Processing version 1.0+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.
Class
PImage
Name
get()
Examples
PImage img = loadImage("tower.jpg");
background(img);
noStroke();
color c = img.get(60, 90);
fill(c);
rect(25, 25, 50, 50);PImage img = loadImage("tower.jpg");
background(img);
PImage b = img.get(50, 0, 50, 100);
image(b, 0, 0);
Description
Reads the color of any pixel or grabs a group of pixels. 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 specifing an additional width and height 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. Even though you may have drawn a shape with colorMode(HSB), the numbers returned will be in RGB.
Getting the color of a single pixel with get(x, y) is easy, but not as fast as grabbing the data directly from pixels[]. The equivalent statement to "get(x, y)" using pixels[] is "pixels[y*width+x]". Processing requires calling loadPixels() to load the display window data into the pixels[] array before getting the values.
As of release 0149, this function ignores imageMode().
Syntax
img.get()
img.get(x, y)
img.get(x, y, width, height)
Parameters
img
PImage: any variable of type PImage
x
int: x-coordinate of the pixel
y
int: y-coordinate of the pixel
width
int: width of pixel rectangle to get
height
int: height of pixel rectangle to get
Returns
color or PImage
Usage
Web & Application
Related
set()pixels[]copy()
Updated on November 22, 2008 08:39:25pm PST
Processing was initiated by Ben Fry and Casey Reas. It is developed by a small team of volunteers.
© Info \
Site hosted by Media Temple!
Wyszukiwarka
Podobne podstrony:
PImage getfunction domnode get contentThe Best Way to Get Your Man to Commit to Youfunction mcrypt module get algo key sizeDestiny´s Child Get on the BusH L Gold And Three to Get Readyfunction imap get quota120131131307?c tewsV get me wrong pdffunction get meta tagsUsed to get used tofunction get magic quotes runtimeH Connick Jr Don t get around much anymore[1]Get 1000 Visitors in 24 Hoursfunction openssl get privatekeyfunction fdf get filefunction snmp get quick printfunction yp get default domainwięcej podobnych podstron