UI module

write_screenshot

procedureextensionexperimentalsince 0.31.0Source

Draw the UI's last frame offscreen and write it to path as a PNG. Needs a GPU; build the UI with system_fonts for readable text. Returns false when there is no adapter or the file cannot be written.

Example↗
ui := headless();
defer free_ui(*ui);
write_screenshot(*ui, "frame.png");

This one is only checked to compile, not run.

write_screenshot :: (ui: *UI_State, path: string) -> bool

Draw the UI's last frame offscreen and write it to path as a PNG. Needs a GPU; build the UI with system_fonts for readable text. Returns false when there is no adapter or the file cannot be written.

Parameters

ui: *UI_State
the UI whose last frame to draw.
path: string
where to write the PNG.

Returns

bool
Example↗
ui := headless();
defer free_ui(*ui);
write_screenshot(*ui, "frame.png");

This one is only checked to compile, not run.

See also