small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo

albedo-render #

albedo-render renders source ranges and compaction text as PNG pages and resizes image inputs. The view and snapcompact extensions call this executable.

  • src/main.rs defines albedo-render FILE --start N --end N --out DIR and options for columns, tabs, language, and page limits.
  • --snapcompact PATH and --snapcompact-dir PATH render dense text frames with the supplied advance, pitch, and width.
  • --fit EDGE IMAGE --out DIR resizes a PNG, JPEG, or WebP input to fit the requested edge limit and applies the input's EXIF orientation. With --webp, the lossy WebP output also fits the codec's 16,383-pixel edge limit. Resizing weights each source pixel's color by its alpha.
  • Standard output reports image paths and dimensions. Code-range output also reports language and remaining lines. Errors go to standard error.

See compaction for frame use.

Code rendering #

The renderer colors the whole file before selecting a range, so a range that starts inside a comment or string keeps its syntax colors. The default width is 79 columns. LF and CRLF end source lines. The renderer displays a bare carriage return as a replacement glyph. Long lines wrap with an arrow. A source line that fits within --max-rows stays on one image. When every line fits, the renderer uses the fewest images possible and aims for an even row count across them. A line taller than the limit starts on a fresh image and continues across images.

When the image limit stops a range, remaining FIRST LAST gives the range for the next call. If it stops within a wrapped line, the report includes a third field, remaining FIRST LAST ROW. Pass FIRST and LAST as --start and --end, and pass ROW as --start-row. The display row counts from 1 within the first source line. Keep the source and wrapping options the same when resuming.

Tab stops are measured from the start of each display row. A tab that wraps advances to the first tab stop on the continuation row.

Lines 86-104 of src/layout.rs, rendered; line 97 wraps

install.sh builds with Cargo and installs the binary in apps/albedo/priv/bin.