save_screenshot(3)

πŸ“¦
version 0.7.1 Β· 2 versions
, in nixos 26.05

πŸ’Ύ save_screenshot(3) πŸ’Ύ

okay bestie, welcome to the Arcan Lua API corner of the group chat πŸ’– this page is literally all about save_screenshot, and we are keeping every default, note, format name, and code line exactly where it belongs. no cap.


πŸŽ€ NAME πŸŽ€

  • save_screenshot β€” Store a copy of the current display to a file.

✨ SYNOPSIS ✨

nil
save_screenshot( dstres, fmt, srcid, local )

πŸ’… DESCRIPTION πŸ’…

okay so save_screenshot creates a file of the latest drawn output on the primary display, or of the contents of a specific VID of specified in srcid. yes, that phrasing is staying, because we do not mess with the original technical bits πŸ’–

local is the local-storage hint: it defaults to false, and setting it to true or non-zero hints that the local storage should be used. This is important when there is a discrepancy between what is stored as the objects video backing store (implementation defined) and the local copy, because they are not always in synch. the way that actually matters 🫢

The format setting (fmt) is by default FORMAT_PNG, but it can also be FORMAT_PNG_FLIP, FORMAT_RAW 8, FORMAT_RAW 24, or FORMAT_RAW 32 β€” though the RAW formats are primarily for advanced use and debugging purposes. iconic for debugging, bestie, but not the everyday main character format 🌈

🌸 NOTES 🌸

  1. For specific contexts, primarly calctargets, the contents of the non-local storage is not accessible on all graphic subsystems for all srcids as the calctarget may occupy or bind the same slot. Either do the call outside such a scope or force local readback. literally read that twice if you have to 😭

πŸ¦‹ EXAMPLE πŸ¦‹

here is the example, verbatim, no cap:

function save_screenshot0()
      show_image(fill_surface(64, 64, 255, 0, 0));
      local a = fill_surface(64, 64, 0, 255, 0);
      move_image(a, VRESW - 64, 0);
      local b = fill_surface(64, 64, 0, 0, 255);
      move_image(b, 0, VRESH - 64);
      local c = fill_surface(64, 64, 0, 255, 255);
      move_image(c, VRESW - 64, VRESH - 64);
      show_image({a, b, c});
end

xoxo, resource πŸ’– October 2026 πŸ’– save_screenshot(3) signing off 🫢

πŸ“¦ where this page comes from