- Add ascii_dual_blend.sexp: blends two ASCII-processed videos synced to audio - Fix blend.sexp: add require-primitives, fix params syntax - Fix layer.sexp: add require-primitives - Use consistent (effect blend ...) syntax instead of special form Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
29 lines
975 B
Common Lisp
29 lines
975 B
Common Lisp
;; Layer effect - composite frame-b over frame-a at position
|
|
;; Multi-input effect: uses frame-a (background) and frame-b (overlay)
|
|
;; Params: x, y (position), opacity (0-1), mode (blend mode)
|
|
|
|
(require-primitives "image" "blending")
|
|
|
|
(define-effect layer
|
|
:params (
|
|
(x :type int :default 0)
|
|
(y :type int :default 0)
|
|
(opacity :type float :default 1.0)
|
|
(mode :type string :default "alpha")
|
|
)
|
|
(let [bg (copy frame-a)
|
|
fg frame-b
|
|
;; Resize fg if needed to fit
|
|
fg-w (width fg)
|
|
fg-h (height fg)]
|
|
(if (= opacity 1.0)
|
|
;; Simple paste
|
|
(paste bg fg x y)
|
|
;; Blend with opacity
|
|
(let [blended (if (= mode "alpha")
|
|
(blend-images (crop bg x y fg-w fg-h) fg opacity)
|
|
(blend-images (crop bg x y fg-w fg-h)
|
|
(blend-mode (crop bg x y fg-w fg-h) fg mode)
|
|
opacity))]
|
|
(paste bg blended x y)))))
|