TODO
====

If you're particularly interested in any of this, send patches/pull requests
or maybe just prod me a little.

Minor Features/UX
-----------------

- Accept -o, --output to write to file.
- Add a --test option to print a test page.
- Add a --show-symbols op to print matching symbols.
- If FG color is transparent, see if we can use an inverted symbol and swap
  with BG.
  - Avoid using transparent foreground due to XFCE Terminal (other terminals?)
    weird handling with background picture set?
    - Except in FGBG modes.
- Test with more terminals.
  - PuTTY on Windows 10?
  - Terminology.
    - Emulate tycat.
  - Emacs ansi-term.
  - Emacs shell (TERM=dumb).
  - Come up with some kind of support matrix.
- More symbols/symbol aliases:
  - CP437.
- Output to retro art formats:
  - RexPaint.
  - lvllvl.com.
  - CharPad/CharPad Pro.
  - Marq's PETSCII Editor (http://www.kameli.net/marq/?page_id=2717).
  - PabloDraw.
  - ANSILove (direct to .ANS, other formats?).
  - Others?
- More image loaders:
  - BMP. The GIMP has a fairly complete decoder.
  - XPM. https://en.wikipedia.org/wiki/X_PixMap
  - PBM, PGM, PPM. https://en.wikipedia.org/wiki/Netpbm
- Run image decoders (and Chafa backend?) in sandboxed subprocess.

Major features
--------------

- Selection from multiple internal named font bitmap sets (IBM, C64, etc).
- Custom palettes.
  - External (e.g. in GIMP format, or extract from image) or named internal.
  - Using different palettes for BG and FG allows for retro modes like the
    C64's Extended Color Character Mode (ECM).
- Pixmap export (raw image buffer from backend, PNG or TIFF export in frontend).
- Lossy/lossless intra-frame compression. Data rate regulated:
  - By desired output size.
  - By maximum desired per-cell error.
  - By total error?
  - Slide window over row, calculate mean colors, calc error?
- Lossy/lossless delta compression.
  - Double-buffer with a checkpoint call to swap.
    - Dirty map not enough in case each frame is composited in multiple steps.
  - Emit difference between checkpoint state and current.
  - Optimization: Keep a rect or region of changed area.
  - Multiply previous symbol's new error with weight to increase or decrease
    stability (prevent flicker)?
- Drawing context with clip rect/region, etc.
  - Potentially a context stack.
  - Getting into NCurses territory...
- Video playback.
- Interactive UI (may need to be in separate tool).

Optimization
------------

- Preload next image/frame in delay phase.
- Don't calculate error if we're only using a single symbol (e.g. vhalf).

The Fine Material
-----------------

- Tips.
  - For scrolling, use e.g. chafa input.jpg -s 200 | less -S
  - Rate-controlled playback with e.g. cat input.txt | pv -qL 100k
  - X11 applications in terminal
    $ Xvfb :99 -ac -fbdir t -screen 0 1440x900x24 &
    $ DISPLAY=:99 lament -root &
    $ chafa --watch t/Xvfb_screen0
  - gnome-shell in terminal
    $ XDG_SESSION_TYPE=x11 DISPLAY=:99 gnome-shell
    - Run as different user.
  - Using (unreleased) ffmpeg driver:
    $ ./ffmpeg -i movie.mkv -pix_fmt rgba -f chafa -color 16 -symbols vhalf,space -fill ascii -
