5.6.1 Using Flipping Ink
(defun cmd-rubberband ()
(let ((x1 0) ; x1, y1 represents the fix point
(y1 0)
(x2 0) ; x2,y2 represents the point that is changing
(y2 0)
(mouse-button-press nil)
;; press to select pivot
(stream (get-frame-pane *application-frame* 'main)))
(tracking-pointer (stream)
(:pointer-button-press
(event x y )
(setf x1 x y1 y x2 x y2 y)
(draw-line* stream x1 y1 x2 y2
:ink +flipping-ink+)
(setf mouse-button-press t))
(:pointer-motion
(window x y)
(when Mouse-button-press
;;erase
(draw-line* stream x1 y1 x2 y2
:ink +flipping-ink+)
;; draw
(draw-line* stream x1 y1 x y
:ink +flipping-ink+)
(setf x2 x y2 y)))
(:pointer-button-release
(event x y )
(cond
((eq mouse-button-press t)
(return
(list x1 y1 x2 y2))))))))
Common Lisp Interface Manager 2.0 User's Guide - 27 Feb 2008