PImage::pixels[] \ 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
pixels[]
Examples
PImage img = loadImage("tower.jpg");
int dimension = (img.width*img.height);
img.loadPixels();
for (int i=0; i < dimension; i+=2) {
img.pixels[i] = color(0, 0, 0);
}
img.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() method. After the array data has been modified, the updatePixels() method must be run 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 November 22, 2008 08:39:26pm 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 pixelsPImage loadPixelsPImage filterPImage resizePImage alphapixelsPImage blendPImage getpixelsPImage copyPImage heightPImagePImage filterPImage maskPImage setPImage updatePixelsPImage savePImage resizePImage blendwięcej podobnych podstron