Add S-expression based video effects pipeline with modular effect definitions, constructs, and recipe files. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
22 lines
711 B
Common Lisp
22 lines
711 B
Common Lisp
;; Vignette effect - darkens corners
|
|
;; @param strength float [0, 1] default 0.5
|
|
;; @param radius float [0.5, 2] default 1
|
|
|
|
(define-effect vignette
|
|
((strength 0.5) (radius 1))
|
|
(let* ((w (width frame))
|
|
(h (height frame))
|
|
(cx (/ w 2))
|
|
(cy (/ h 2))
|
|
(max-dist (* (sqrt (+ (* cx cx) (* cy cy))) radius)))
|
|
(map-pixels frame
|
|
(lambda (x y c)
|
|
(let* ((dx (- x cx))
|
|
(dy (- y cy))
|
|
(dist (sqrt (+ (* dx dx) (* dy dy))))
|
|
(factor (- 1 (* (/ dist max-dist) strength)))
|
|
(factor (clamp factor 0 1)))
|
|
(rgb (* (red c) factor)
|
|
(* (green c) factor)
|
|
(* (blue c) factor)))))))
|