       (.drawString (str (absolute-mouse-position screen-state)) 10 40))))
 
 ;; Loading visible tiles
-
-(defn visible-tile-indices
-  "Computes visible tile indices for a given channel index."
-  [screen-state channel-index]
-  (let [visible-tile-positions (tiles/tiles-in-pixel-rectangle
-                                 (screen-rectangle screen-state)
-                                 (:tile-dimensions screen-state))]
-    (for [[nx ny] visible-tile-positions]
-      {:nx nx :ny ny :zoom (:zoom screen-state)
-       :nc channel-index :nz (screen-state :z) :nt 0})))
 
 (defn overlay-loader
   "Creates overlay tiles needed for drawing."


;; testing



(defn big-region-contrast []
  (swap! ss assoc
         :channels {"Default" {:min 200 :max 800 :gamma 1.0 :color Color/WHITE}})

    (when (and x y)
      (doto graphics
        (.setColor Color/BLUE)
        (.drawRect (- x 25) (- y 25) 50 50))))))
  
(defn paint-tiles [^Graphics2D g overlay-tiles-atom screen-state]
  (doseq [tile-index (visible-tile-indices screen-state :overlay)] 
    (when-let [image (tile-cache/get-tile
                       overlay-tiles-atom
                       tile-index)]
      (let [[x y] (tiles/tile-to-pixels [(:nx tile-index) (:ny tile-index)]
                                        (screen-state :tile-dimensions) 1)]
        (paint/draw-image g image x y)
        ))))

(defn paint-stage-position [^Graphics2D g screen-state]
  (let [[x y] (:xy-stage-position screen-state)
