        (finally
          (quil.core/pop-matrix)))))
 
-(defn begin-draw [graphics]
+(defn begin-draw [^PGraphics graphics]
   #?(:clj (.beginDraw graphics)))
 
-(defn end-draw [graphics]
+(defn end-draw [^PGraphics graphics]
   #?(:clj (.endDraw graphics)))
 
 (defmacro

  * `:dilate`    - increases the light areas. Doesn't work with level."
  ([mode]
   (.filter (current-graphics)
            (u/resolve-constant-key mode filter-modes)))

  ([mode level]
   (let [mode (u/resolve-constant-key mode filter-modes)]
     (.filter (current-graphics) mode (float level)))))

#?(:clj

        ; instead we convert extract alphas into array and use array version of mask()
        ; see https://processing.org/reference/PImage_mask_.html
      (let [pxls (pixels mask)
            ^ints alphas (amap ^ints pxls idx ret (int (alpha (aget ^ints pxls idx))))]
        (.mask img alphas))
      :cljs (.mask img mask))))

