anchor.diff:  ;;; Note: Originally based on Troels' Henriksen's
   ;;; clim-demo:image-viewer
   ;;;
  +
   (in-package :spectacle)
   
   (defclass spectacle-gadget (value-gadget)
  
positive.code: 
  (defclass spectacle-pane (spectacle-gadget basic-gadget) ())
  
  (define-application-frame spectacle ()
    ()
    (:menu-bar t)
    (:panes
     (viewer (make-pane 'spectacle-pane :background +black+ :foreground +white+))
     (interactor :interactor
                 :text-style (make-text-style :sans-serif nil nil)
                 :min-height 100
                 :min-width 200))
    (:layouts
     (default (vertically ()
                (4/5 (labelling (:label "Opticl Image") viewer))
                (1/5 interactor)))))
  
  (defmethod handle-repaint ((pane spectacle-pane) region)
    (declare (ignore region))
    (with-bounding-rectangle* (x1 y1 x2 y2) (sheet-region pane)    
      (clim:draw-rectangle* (sheet-medium pane) x1 y1 x2 y2 :ink +background-ink+))
    (with-accessors ((image gadget-value)
                     (transform-parameters transform-parameters)
  
negative.code:         (run))))
  
  (defun rgb-image-to-climi-rgb-pattern (image)
    (declare (optimize (speed 3))
             (type 8-bit-rgb-image image))
    (with-image-bounds (y x) image
      (let ((cimg (make-32-bit-gray-image y x)))
        (declare (type 32-bit-gray-image cimg))
        (set-pixels (i j) cimg
          (multiple-value-bind (r g b)
              (pixel image i j)
  