5.7 Examples of Simple Drawing Effects

5.7.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)
                       (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))
                       (window x y)
                       (when Mouse-button-press
                         (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)))
                       (event x y )
                        ((eq mouse-button-press t)
                          (list x1 y1 x2 y2))))))))

CLIM 2.0 User's Guide - OCT 1998

Generated with Harlequin WebMaker