ReGIS on the command line (xterm / contour)
==============================================

ReGIS travels inside a DCS string. Sending the introducer IS the
switch: no xterm flag starts you in graphics mode, the application
(or printf) enters it, ST (ESC \) leaves it.

  Enter fresh (reset state + clear canvas):
    printf '\033P1pS(E)\033\\'

  Enter keeping previous state (resume):
    printf '\033Pp'

  Leave graphics mode:
    printf '\033\\'

One-liners (each is a complete DCS ... ST picture):

  # diagonal line
  printf '\033PpP[100,100]V[400,300]\033\\'

  # rectangle
  printf '\033PpP[100,100]V[400,100]V[400,300]V[100,300]V[100,100]\033\\'

  # circle, radius 100, centred at cursor
  printf '\033PpP[400,240]C[500,240]\033\\'

  # text, double-size cell
  printf "\033PpP[100,100]T(S2)'Hello, ReGIS'\033\\"

  # clear + reset coordinate window
  printf '\033PpS(E)S(A[0,0][799,479])\033\\'

Canvas: 800x480, origin top-left, Y down. [x,y] absolute,
[+dx,-dy] relative, [x] X-only, [,y] Y-only, [] current pos.

Detecting support: ask Device Attributes and look for ";3"
(3 = ReGIS, 4 = Sixel):

  printf '\033[c'     # e.g. ESC [ ? 65 ; ... ; 3 ; 4 ; ... c

xterm caveat: ReGIS exists only in xterm built with
--enable-regis-graphics; stock distro builds often omit it.
Check yours with:

  strings $(which xterm) | grep -i regis
  appres XTerm | grep -i regis     # regisScreenSize ...

No match (as on this machine's xterm 398) means no ReGIS:
use contour, or rebuild xterm with the flag. Related resource:
regisScreenSize (default 800x480 window), privateColorRegisters.

Programmatically (this repo, Modula-2): see Regis.def +
tests/TestRegisDemo.mod, TestRegisColor.mod, TestRegisMacro.mod:

  Regis.Enter;
  Regis.Rect(50, 50, 750, 430);
  Regis.MoveTo(300, 445);
  Regis.TextOut("hi");
  Regis.Exit;
