mirchand@snuffy.cs.unc.edu (Jaideep Mirchandani) (03/21/91)
Have you tried to use MIT SCHEME, 7.0 to do graphics on an X window system ? If so, can you possibly point out any pitfalls ? I'd be grateful to have any code that may be helpful in getting started, e.g. code making X calls to open, close and display pictures, etc. Thank you for reading, Jaideep
markf@altdorf.ai.mit.EDU (03/22/91)
There are a set of device independent graphics commands defined in runtime/graphics.scm. When you make a graphics device you pass in a specific graphics device type. MIT Scheme currently supports starbase graphics (an HP creation) and X window graphics. For X window graphics you should use the x-graphics-device-type wich is defined in runtime/x11graph.scm. Here is a very simple graphics package which shows the use of some of the graphics stuff. -Mark ;;;; Simple graphics Interface ;;;; implemented for X Windows (define clear-graphics) (define clear-point) (define draw-line-to) (define draw-point) (define graphics-available?) (define graphics-text) (define init-graphics) (define position-pen) (define graphics-package (make-environment (define graphics-device #F) (set! clear-graphics (lambda () (if (not graphics-device) (init-graphics)) (graphics-clear graphics-device) (graphics-move-cursor graphics-device 0 0))) (set! clear-point (lambda (x y) (graphics-erase-point graphics-device x y))) (set! draw-line-to (lambda (x y) (graphics-drag-cursor graphics-device x y))) (set! draw-point (lambda (x y) (graphics-draw-point graphics-device x y))) (set! graphics-available? (lambda () (graphics-type-available? x-graphics-device-type))) (set! graphics-text (lambda (text x y) ;; Accepts different parameters on Chipmunks. (graphics-draw-text graphics-device x y text))) (set! init-graphics (lambda () (let ((display (x-open-display #f))) (set! graphics-device (make-graphics-device x-graphics-device-type display "512x388" #f))) (graphics-set-coordinate-limits graphics-device -256 -195 255 194) (graphics-move-cursor graphics-device 0 0))) (set! position-pen (lambda (x y) (graphics-move-cursor graphics-device x y))) ))