regis-cli.txt 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ReGIS on the command line (xterm / contour)
  2. ==============================================
  3. ReGIS travels inside a DCS string. Sending the introducer IS the
  4. switch: no xterm flag starts you in graphics mode, the application
  5. (or printf) enters it, ST (ESC \) leaves it.
  6. Enter fresh (reset state + clear canvas):
  7. printf '\033P1pS(E)\033\\'
  8. Enter keeping previous state (resume):
  9. printf '\033Pp'
  10. Leave graphics mode:
  11. printf '\033\\'
  12. One-liners (each is a complete DCS ... ST picture):
  13. # diagonal line
  14. printf '\033PpP[100,100]V[400,300]\033\\'
  15. # rectangle
  16. printf '\033PpP[100,100]V[400,100]V[400,300]V[100,300]V[100,100]\033\\'
  17. # circle, radius 100, centred at cursor
  18. printf '\033PpP[400,240]C[500,240]\033\\'
  19. # text, double-size cell
  20. printf "\033PpP[100,100]T(S2)'Hello, ReGIS'\033\\"
  21. # clear + reset coordinate window
  22. printf '\033PpS(E)S(A[0,0][799,479])\033\\'
  23. Canvas: 800x480, origin top-left, Y down. [x,y] absolute,
  24. [+dx,-dy] relative, [x] X-only, [,y] Y-only, [] current pos.
  25. Detecting support: ask Device Attributes and look for ";3"
  26. (3 = ReGIS, 4 = Sixel):
  27. printf '\033[c' # e.g. ESC [ ? 65 ; ... ; 3 ; 4 ; ... c
  28. xterm caveat: ReGIS exists only in xterm built with
  29. --enable-regis-graphics; stock distro builds often omit it.
  30. Check yours with:
  31. strings $(which xterm) | grep -i regis
  32. appres XTerm | grep -i regis # regisScreenSize ...
  33. No match (as on this machine's xterm 398) means no ReGIS:
  34. use contour, or rebuild xterm with the flag. Related resource:
  35. regisScreenSize (default 800x480 window), privateColorRegisters.
  36. Programmatically (this repo, Modula-2): see Regis.def +
  37. tests/TestRegisDemo.mod, TestRegisColor.mod, TestRegisMacro.mod:
  38. Regis.Enter;
  39. Regis.Rect(50, 50, 750, 430);
  40. Regis.MoveTo(300, 445);
  41. Regis.TextOut("hi");
  42. Regis.Exit;