Language \ Environment \ Comparison
 
Index
 
  The Processing 1.0 _ALPHA_ Reference is a work in progress.
If you see any errors or have any comments, please write to: reas at groupc.net
Name  

get()

   
Examples  
void loop() { 
  for(int i=0; i<height; i++) { 
    stroke(i*2); 
    line(0, i, 50, i); 
  } 
  color c = get(mouseX, mouseY); 
  noStroke(); 
  fill(c); 
  rect(50, 0, 50, 100); 
} 
Description   Provides a way to read the color of any pixel and to grab a group of pixels. 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. If the pixel requested is outside of the image window, the background color is returned. Get a section of the display window by specifying a width and height parameter.
   
Syntax  
get(x, y)
get(x, y, width, height)
   
Parameters  
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 BImage
   
Usage   Web & Application
   
Related   set()
pixels[]
   
© 2004 - 2001 Massachusetts Institute of Technology and Interaction Design Institute Ivrea
Processing is an open project initiated by Ben Fry and Casey Reas