Here is the processing source code:

Sustainable Painting Processing Source Code