;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; DRAWS A STRING OVER AN IMAGE
;;
;; Download a medium sized quicktime trailer from apple
;; Load it into quicktime-pro and export it at its current
;; size but in TIFF format. Use that file in gfx:load-movie.
;;
;; Impromptu does not currently support any format
;; other than TIFF
;;
;; This example show a few possabilities.
;; 1. A move frame can be be distorted (useing set-image-size)
;; 2. Text can be drawn to a canvas (using draw-text)
;; 3. Compositing of text and images can be done (using gfx:text2image)
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define canvas (gfx:make-canvas 600 600))
; change the path to the movie file to suit your computer
(define movie (gfx:load-movie "/tmp/myfilm.mov"))
(define mlgth (- (gfx:get-movie-duration movie) 1.0))
(define frame-length (* *second* 0.1))
(define font-style (gfx:make-text-style "Times-Roman" 120.0 (list 1.0 1.0 1.0 0.25)))
(define loop
(lambda (time mtime)
(let ((image (gfx:get-movie-frame movie mtime)))
(gfx:text2image (number->string mtime) image font-style '(10 0))
(gfx:draw-image time canvas image 1.0 '(0 0 600 600))
(set! time (+ time frame-length))
(if (< mtime mlgth)
(callback (- time 4000) 'loop time (+ mtime 0.1))))))
(loop (now) 0.0)
; the loop will stop when the end of the movie is reached