MCPcopy Index your code
hub / github.com/benfry/processing4 / set

Method set

core/src/processing/core/PImage.java:712–722  ·  view source on GitHub ↗

Changes the color of any pixel or writes an image directly into the display window. The x and y parameters specify the pixel to change and the color parameter specifies the color value. The color parameter is affected by the current color mode (the default is RGB va

(int x, int y, int c)

Source from the content-addressed store, hash-verified

710 * @see PImage#copy(PImage, int, int, int, int, int, int, int, int)
711 */
712 public void set(int x, int y, int c) {
713 if ((x < 0) || (y < 0) || (x >= pixelWidth) || (y >= pixelHeight)) return;
714
715 switch (format) {
716 case RGB -> pixels[y * pixelWidth + x] = 0xff000000 | c;
717 case ARGB -> pixels[y * pixelWidth + x] = c;
718 case ALPHA -> pixels[y * pixelWidth + x] = ((c & 0xff) << 24) | 0xffffff;
719 }
720
721 updatePixels(x, y, 1, 1); // slow...
722 }
723
724
725 /**

Callers

nothing calls this directly

Calls 2

updatePixelsMethod · 0.95
setImplMethod · 0.95

Tested by

no test coverage detected