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)
| 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 | /** |
nothing calls this directly
no test coverage detected