capture
Queues a capture of the next frame drawn for this window and saves it to path as a PNG file with four 8-bit channels, every pixel opaque. A relative path resolves against Files.basePath; a missing directory on the way to the file is created when it is written, as Files.writeBytes does.
The capture is asynchronous: it applies to the next frame drawn after the call, which the renderer reads back once the GPU has finished it, and the file is written before the frame after that one starts. It covers the whole drawable area, pixelWidth by pixelHeight pixels, as presented, or the offscreen texture when the frame is drawn into one. Several calls before a frame each get a file of that same frame. The frame that holds a capture waits for the GPU to finish it, so it takes longer than the others.
A capture that fails, for example because the file cannot be written, prints one line to standard error through printError and is dropped; nothing is thrown or reported anywhere else.
Has no sample because it needs a display.
Throws
if path is empty.