Window.capture

Capture the pixel data of the current window and returns a Surface with this pixel data. You can also alter the format of the pixel data. Default is <code>Texture.Format.BGRA</code>. This method is predestinated for screenshots.

class Window
final const
capture

Examples

Window wnd = ...
...
wnd.capture().saveToFile("samples/img/screenshot.png");

If you want to use the Screenshot more than only to save it, it could be better to wrap it into an Image.

Window wnd = ...
...
Image screen = new Image(wnd.capture());

Meta