This will only work properly if the PGraphics is the same size as the PApplet. Is that the only use you have in mind?