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.

a
Number|Number[]|Object:

grayscale value | pixel array | p5.Color object | p5.Image to copy.

Notice any errors or typos? Please let us know. Please feel free to edit src/image/p5.Image.js and open a pull request!

संबंधित संदर्भ