If you want to make a jigsaw puzzle that doesn’t need a background clip area, take a look at the logic at:
That page was made for Scirra’s Construct2, but the logic part can be used by processing. I’m planning to transform my jigsawpuzzle C2 app into a processing or p5js app, indeed.