( begin auto-generated from PImage_get.xml ) 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 x and y parameters to get the value of one pixel. Get a section of the display window by specifying an additi
(int x, int y)
| 725 | * @see PApplet#copy(PImage, int, int, int, int, int, int, int, int) |
| 726 | */ |
| 727 | public int get(int x, int y) { |
| 728 | if ((x < 0) || (y < 0) || (x >= pixelWidth) || (y >= pixelHeight)) return 0; |
| 729 | |
| 730 | switch (format) { |
| 731 | case RGB: |
| 732 | return pixels[y*pixelWidth + x] | 0xff000000; |
| 733 | |
| 734 | case ARGB: |
| 735 | return pixels[y*pixelWidth + x]; |
| 736 | |
| 737 | case ALPHA: |
| 738 | return (pixels[y*pixelWidth + x] << 24) | 0xffffff; |
| 739 | } |
| 740 | return 0; |
| 741 | } |
| 742 | |
| 743 | |
| 744 | /** |