Files
test/sexp_effects/effects/mirror.sexp
gilesb 406cc7c0c7 Initial commit: video effects processing system
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>
2026-01-19 12:34:45 +00:00

32 lines
895 B
Common Lisp

;; Mirror effect - mirrors half of image
;; @param mode string default "left_right"
(define-effect mirror
((mode "left_right"))
(let* ((w (width frame))
(h (height frame))
(hw (floor (/ w 2)))
(hh (floor (/ h 2))))
(cond
((= mode "left_right")
(let ((left (crop frame 0 0 hw h))
(result (copy frame)))
(paste result (flip-h left) hw 0)))
((= mode "right_left")
(let ((right (crop frame hw 0 hw h))
(result (copy frame)))
(paste result (flip-h right) 0 0)))
((= mode "top_bottom")
(let ((top (crop frame 0 0 w hh))
(result (copy frame)))
(paste result (flip-v top) 0 hh)))
((= mode "bottom_top")
(let ((bottom (crop frame 0 hh w hh))
(result (copy frame)))
(paste result (flip-v bottom) 0 0)))
(else frame))))