How to create a diagonal line

My suggestion is to build an array of points and assign each of them a color. You build this array in setup and use it on every frame in draw(). You can use Pgraphics a rectangle and a mask. Or you can use the code above an adjust the brightness there.

Kf