1 ;; Visualization experiments
8 ;; Generic Wish interface
13 (define (wish-startup w h)
14 (let-values (((in-port out-port id) (process (conc "wish -geometry " w "x" h))))
15 (set! wish-in in-port)
16 (set! wish-out out-port)))
18 (define (wish-shutdown)
20 (close-input-port wish-in)
21 (close-output-port wish-out))
23 (define (wish% . args)
24 (with-output-to-port wish-out
28 ;; High-level visualization commands
30 (define (visualizer-open w h)
32 (wish% "canvas .c -width " w " -height " h " -bg black")
34 (wish% "image create photo core -width " w " -height " h " -palette 256/256/256")
35 (wish% ".c create image 0 0 -anchor nw -image core"))
37 (define (set-pixel x y col)
38 (wish% "core put " col " -to " x " " y))
40 (define (visualizer-close)
45 (visualizer-open 640 480)
46 (set-pixel 10 10 "red")