(defparameter *width* 500)
(defparameter *height* 600)

(defun red-circle (intensity x y r)
  (set-rgb-fill intensity 0 0)
  (centered-circle-path x y r)
  (fill-path))

(defun disc (intensity x y r)
  (red-circle 0 x y r)
  (red-circle intensity (- x 3) (+ y 3) r))

(defun list-source (filename)
  (set-rgb-fill 1 1 1)
  (set-font (get-font "Anonymous.ttf") 14)
  (with-open-file (s filename)
    (loop for line = (read-line s nil 'eof)
       for y = (- *height* 25) then (- y 20)
       until (eq line 'eof) do
         (draw-string 6 y line))))

(defun red-discs (file n)
  (with-canvas (:width *width* :height *height*)
    (loop repeat n do
         (disc (/ (+ 100 (random 128)) 255.0)
               (random *width*) (random *height*)
               (+ 10 (random 40))))
    (list-source "discs.lisp")
    (save-png file)))