Sets the color of one or more pixels within an image.
img.set()
is easy to use but it's not as fast as img.pixels. Use img.pixels to set many pixel values.
img.set()
interprets the first two parameters as x- and y-coordinates. It interprets the last parameter as a grayscale value, a [R, G, B, A]
pixel array, a p5.Color object, or another p5.Image object.
img.updatePixels() must be called after using img.set()
for changes to appear.
Examples
Syntax
set(x, y, a)
Parameters
x
Number:
x-coordinate of the pixel.
y
Number:
y-coordinate of the pixel.
This page is generated from the comments in src/image/p5.Image.js . Please feel free to edit it and submit a pull request!