- Add stream_sexp_generic.py: fully generic sexp interpreter - Add streaming primitives for video sources and audio analysis - Add config system for external sources and audio files - Add templates for reusable scans and macros - Fix video/audio stream mapping in file output - Add dynamic source cycling based on sources array length - Remove old Python effect files (migrated to sexp) - Update sexp effects to use namespaced primitives Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
32 lines
1.0 KiB
Common Lisp
32 lines
1.0 KiB
Common Lisp
;; Blend effect - combines two video frames
|
|
;; Streaming-compatible: frame is background, overlay is second frame
|
|
;; Usage: (blend background overlay :opacity 0.5 :mode "alpha")
|
|
;;
|
|
;; Params:
|
|
;; mode - blend mode (add, multiply, screen, overlay, difference, lighten, darken, alpha)
|
|
;; opacity - blend amount (0-1)
|
|
|
|
(require-primitives "image" "blending" "core")
|
|
|
|
(define-effect blend
|
|
:params (
|
|
(overlay :type frame :default nil)
|
|
(mode :type string :default "alpha")
|
|
(opacity :type float :default 0.5)
|
|
)
|
|
(if (core:is-nil overlay)
|
|
frame
|
|
(let [a frame
|
|
b overlay
|
|
a-h (image:height a)
|
|
a-w (image:width a)
|
|
b-h (image:height b)
|
|
b-w (image:width b)
|
|
;; Resize b to match a if needed
|
|
b-sized (if (and (= a-w b-w) (= a-h b-h))
|
|
b
|
|
(image:resize b a-w a-h "linear"))]
|
|
(if (= mode "alpha")
|
|
(blending:blend-images a b-sized opacity)
|
|
(blending:blend-images a (blending:blend-mode a b-sized mode) opacity)))))
|