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.
示例
语法
set(x, y, a)
参数
x
Number:
x-coordinate of the pixel.
y
Number:
y-coordinate of the pixel.
Notice any errors or typos? Please let us know. Please feel free to edit src/image/p5.Image.js and open a pull request!