Reference+
Name
updatePixels()
Class
PImage
Description
Updates the display window with the data in the pixels[] array. Use in conjunction with loadPixels(). If you're only reading pixels from the array, there's no need to call updatePixels() — updating is only necessary to apply changes.
Examples
PImage myImage; int halfImage; void setup() { size(400, 400); halfImage = width * height/2; myImage = loadImage("shells.jpg"); myImage.loadPixels(); for (int i = 0; i < halfImage; i++) { myImage.pixels[i+halfImage] = myImage.pixels[i]; } myImage.updatePixels(); } void draw() { image(myImage, 0, 0); }![Image output for example 1]()
Syntax
pimg.updatePixels()pimg.updatePixels(x, y, w, h)
Parameters
pimg(PImage)any object of type PImagex(int)x-coordinate of the upper-left cornery(int)y-coordinate of the upper-left cornerw(int)widthh(int)height
Return
void

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
