Name

loadPixels()

Description

Loads the pixel data of the current display window into the pixels[] array. This function must always be called before reading from or writing to pixels[]. Subsequent changes to the display window will not be reflected in pixels until loadPixels() is called again.

Examples

  • size(400,400);
    int halfImage = width*height/2;
    PImage myImage = loadImage("mt-fuji.jpg");
    image(myImage, 0, 0);
    
    loadPixels();
    for (int i = 0; i < halfImage; i++) {
      pixels[i+halfImage] = pixels[i];
    }
    updatePixels();
    Image output for example 1

Syntax

  • loadPixels()

Return

  • void