This will do the trick:
https://processing.org/tutorials/rendering/
https://processing.org/reference/PGraphics.html
https://processing.org/reference/createGraphics_.html
https://processing.org/reference/image_.html
Create a PGraphic object of a starfield and use that in draw().