 (defn rect [x1 y1 x2 y2]
   (.rect *applet* (float x1) (float y1) (float x2) (float y2)))
 
-(defn rect-mode [mode] (.rectMode (int mode)))
+(defn rect-mode [mode] (.rectMode *applet* (int mode)))
 
 (defn red [what] (.red *applet* (int what)))
 


(defn background-int
  ([rgb] (.background *applet* (int rgb)))
  ([rgb alpha] (.background *applet* (int rgb) (int alpha))))

(defn background-image
  [#^PImage img] (.background *applet* img))

;; $$main

(defn map-to [val istart istop ostart ostop]
  (PApplet/map val istart istop ostart ostop))

(defn mask
  ([#^ints alpha-array] (.mask *applet* alpha-array)))

(defn mask-image [#^PImage img] (.mask *applet* img))

