Skip to content

Instantly share code, notes, and snippets.

@alexgian
Created February 25, 2021 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexgian/15a0c3f5c0b1f34bc515dacbf13c6a7f to your computer and use it in GitHub Desktop.
Save alexgian/15a0c3f5c0b1f34bc515dacbf13c6a7f to your computer and use it in GitHub Desktop.
The X11 device primitives that MIT-Scheme makes available for graphing
;;;; X11 graphics device
(define (initialize-package!)
(set! x-graphics-device-type
(make-graphics-device-type
'x
`((available? ,x-graphics/available?)
(clear ,x-graphics/clear)
(close ,x-graphics/close-window)
(color? ,x-graphics/color?)
(coordinate-limits ,x-graphics/coordinate-limits)
(copy-area ,x-graphics/copy-area)
(create-colormap ,create-x-colormap)
(create-image ,x-graphics/create-image)
(device-coordinate-limits ,x-graphics/device-coordinate-limits)
(drag-cursor ,x-graphics/drag-cursor)
(draw-arc ,x-graphics/draw-arc)
(draw-circle ,x-graphics/draw-circle)
(draw-image ,image/draw)
(draw-line ,x-graphics/draw-line)
(draw-lines ,x-graphics/draw-lines)
(draw-point ,x-graphics/draw-point)
(draw-points ,x-graphics/draw-points)
(draw-subimage ,image/draw-subimage)
(draw-text ,x-graphics/draw-text)
(draw-text-opaque ,x-graphics/draw-text-opaque)
(fill-circle ,x-graphics/fill-circle)
(fill-polygon ,x-graphics/fill-polygon)
(flush ,x-graphics/flush)
(font-structure ,x-graphics/font-structure)
(get-colormap ,x-graphics/get-colormap)
(get-default ,x-graphics/get-default)
(iconify-window ,x-graphics/iconify-window)
(image-depth ,x-graphics/image-depth)
(lower-window ,x-graphics/lower-window)
(map-window ,x-graphics/map-window)
(move-cursor ,x-graphics/move-cursor)
(move-window ,x-graphics/move-window)
(open ,x-graphics/open)
(open? ,x-graphics/open-window?)
(query-pointer ,x-graphics/query-pointer)
(raise-window ,x-graphics/raise-window)
(reset-clip-rectangle ,x-graphics/reset-clip-rectangle)
(resize-window ,x-graphics/resize-window)
(set-background-color ,x-graphics/set-background-color)
(set-border-color ,x-graphics/set-border-color)
(set-border-width ,x-graphics/set-border-width)
(set-clip-rectangle ,x-graphics/set-clip-rectangle)
(set-colormap ,x-graphics/set-colormap)
(set-coordinate-limits ,x-graphics/set-coordinate-limits)
(set-drawing-mode ,x-graphics/set-drawing-mode)
(set-font ,x-graphics/set-font)
(set-foreground-color ,x-graphics/set-foreground-color)
(set-icon-name ,x-graphics/set-icon-name)
(set-input-hint ,x-graphics/set-input-hint)
(set-internal-border-width ,x-graphics/set-internal-border-width)
(set-line-style ,x-graphics/set-line-style)
(set-mouse-color ,x-graphics/set-mouse-color)
(set-mouse-shape ,x-graphics/set-mouse-shape)
(set-window-name ,x-graphics/set-window-name)
(visual-info ,x-graphics/visual-info)
(withdraw-window ,x-graphics/withdraw-window))))
(set! display-finalizer
(make-gc-finalizer x-close-display
x-display?
x-display/xd
set-x-display/xd!))
(initialize-image-datatype)
(initialize-colormap-datatype))
(define (x-graphics/available?)
(ignore-errors (lambda () (load-option 'x11))
(lambda (condition) condition #f)))
(define x-graphics-device-type)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment