Search processing.org:

Reference for Processing (BETA) version 0135+. 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.

Name | ### pixels[]
Examples |
    PImage img = loadImage("tower.jpg");
    int dimension = (img.width*img.height);
    loadPixels();
    for (int i=0; idimension; i+=2) {
      img.pixels[i] = color(0, 0, 0);
    }
    updatePixels();
    image(img, 0, 0);
Description | Array containing the values for all the pixels in the image. These values are of the color datatype. This array is the size of the image, meaning if the image is 100x100 pixels, there will be 10000 values and if the window is 200x300 pixels, there will be 60000 values. The index value defines the position of a value within the array. For example, the statement color b = img.pixels[230] will set the variable b equal to the value at that location in the array. Before accessing this array, the data must loaded with the loadPixels() functions. After the array data has been modified, the updatePixels() function must be loaded to update the changes. Without loadPixels(), running the code may (or will in future releases) result in a NullPointerException.
Syntax |
    img.pixels[index]
Parameters |
img | PImage: any variable of type PImage
index | int: must not exceed the size of the array
Usage | Web & Application
Related | get() set() blend() copy()

Updated on September 27, 2006 01:58:55pm PDT