raw_surface(3)

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

πŸ’… raw_surface(3) β€” Arcan Lua API ✨

okay so this is a page out of the Arcan Lua API and honestly? it's kind of a baddie.

🌸 NAME 🌸

raw_surface β€” bestie, this one creates a brand-new surface using a table as its input. you hand it raw pixel data, it hands you a vid. slay.

πŸŽ€ SYNOPSIS πŸŽ€

vid
raw_surface( width, height, bytes_per_pixel, input_table, out_file )

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: this function creates a new 'raw' surface using user-supplied values for pixel data. you're literally the one picking every pixel. main character energy fr.

the internal representation is set to a compile-time system default (typically RGBA 888 β€” iykyk).

and if you pass that optional out_file argument? it will also store a PNG image in the APPL_TEMP namespace. but listen β€” using out_file is primarily intended as a debugging/developer feature, and the actual encode/store operation is synchronous. like, it blocks. no cap. keep that in mind πŸ’…

🫢 cute, but it's a dev tool, not a flex.

⭐ NOTES ⭐

  1. there might be a loss of precision imposed by the texture format native to the system that's running. so don't come for the pixels if they're not pixel-perfect πŸ™ˆ
  2. width and height should be within the compile-time constraints of MAX_SURFACEW and MAX_SURFACEH. exceeding those dimensions is a terminal state transition. like, the whole thing dies. not cute.
  3. the only acceptable bytes_per_pixel values are 1, 3 and 4. all others are a terminal state transition. periodt. don't try to be creative here.
  4. all input_table values will be treated as 8-bit unsigned integers. so we're talking 0–255 territory, bestie.
  5. input_table is expected to have exactly width Γ— height Γ— bytes_per_pixel values, starting at index 1. any deviation is a terminal state transition πŸ’€ the vibes must be exact, no rounding, no shortcuts.

πŸ”₯ EXAMPLE πŸ”₯

function raw_surface0()
      local rtbl = {};
      local ofs = 1;
      for row=1,64 do
            for col=1,64 do
                  rtbl[ofs+0] = math.random(255);
                  rtbl[ofs+1] = math.random(255);
                  rtbl[ofs+2] = math.random(255);
                  ofs = ofs + 3;
            end
      end
      local vid = raw_surface(64, 64, 3, rtbl);
      show_image(vid);
end

look at that. 64 Γ— 64, 3 bytes per pixel, random chaos in every channel, then show_image(vid) to serve the look. iconic. it ate and left no crumbs πŸ“βœ¨


🧚 tiny reminder bestie: those terminal-state situations are not a vibe check you want to fail. respect the dimensions, respect the byte count, respect the index 1.

anyway, that's the whole page β€” go make something pretty πŸ‘‘

πŸ§šβ€β™€οΈ from the image manual, October 2026 edition β€” mwah, love u, bye πŸ’–

πŸ“¦ where this page comes from