gfx:filter-image

(gfx:filter-image image filter-name params)


Description:

Filter image using CoreImage filter. Params is an assoc list of pairs with a car of the parameters name and a cdr of the parameters value. See examples for more.


Arguments:

          image -- image to filter

    filter-name -- filter-name as string

         params -- the parameter list for the filter


Returns: boolean


Examples:

(define canvas (gfx:make-canvas))

(define movie (gfx:load-movie "/tmp/myfilm.mov"))

(define params '(("inputIntensity" . 5)))

(define lgth (- (gfx:get-movie-duration movie) 1.0))

(define frame-length (* *second* 0.1))


(define loop

   (lambda (time movie-time)

      (let* ((image (gfx:convert-image (gfx:get-movie-frame movie movie-time)))

             (filtered-image (gfx:filter-image image "CIEdges" params)))

         (gfx:draw-image time canvas filtered-image 1.0 '(75 150))

         (set! time (+ time frame-length))

         (if (> movie-time lgth)

             (callback (- time 4000) 'loop time 0.0)

             (callback (- time 4000) 'loop time (+ movie-time 0.1))))))


(loop (now) 0.0)



Back to index