pub static updatePixels: UpdatePixelsInternalTypeExpand 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. updatePixels() should be called anytime the pixels array is manipulated or set() is called, and only changes made with set() or direct changes to pixels[] will occur.
Examples
let img;
function preload() {
img = loadImage('assets/rockies.jpg');
}
function setup() {
image(img, 0, 0, width, height);
let d = pixelDensity();
let halfImage = 4 * (width * d) * (height * d / 2);
loadPixels();
for (let i = 0; i < halfImage; i++) {
pixels[i + halfImage] = pixels[i];
}
updatePixels();
}Parameters
x? x-coordinate of the upper-left corner of region
to update
y? y-coordinate of the upper-left corner of region
to update
w? width of region to update
h? height of region to update