Add JAX typography, xector primitives, deferred effect chains, and GPU streaming
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m28s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m28s
- Add JAX text rendering with font atlas, styled text placement, and typography primitives - Add xector (element-wise/reduction) operations library and sexp effects - Add deferred effect chain fusion for JIT-compiled effect pipelines - Expand drawing primitives with font management, alignment, shadow, and outline - Add interpreter support for function-style define and require - Add GPU persistence mode and hardware decode support to streaming - Add new sexp effects: cell_pattern, halftone, mosaic, and derived definitions - Add path registry for asset resolution - Add integration, primitives, and xector tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
36
sexp_effects/effects/xector_vignette.sexp
Normal file
36
sexp_effects/effects/xector_vignette.sexp
Normal file
@@ -0,0 +1,36 @@
|
||||
;; Vignette effect using xector operations
|
||||
;; Demonstrates α (element-wise) and β (reduction) patterns
|
||||
|
||||
(require-primitives "xector")
|
||||
|
||||
(define-effect xector_vignette
|
||||
:params (
|
||||
(strength :type float :default 0.5 :range [0 1])
|
||||
(radius :type float :default 1.0 :range [0.5 2])
|
||||
)
|
||||
(let* (
|
||||
;; Get normalized distance from center for each pixel
|
||||
(dist (dist-from-center frame))
|
||||
|
||||
;; Calculate max distance (corner distance)
|
||||
(max-dist (* (βmax dist) radius))
|
||||
|
||||
;; Calculate brightness factor per pixel: 1 - (dist/max-dist * strength)
|
||||
;; Using explicit α operators
|
||||
(factor (α- 1 (α* (α/ dist max-dist) strength)))
|
||||
|
||||
;; Clamp factor to [0, 1]
|
||||
(factor (αclamp factor 0 1))
|
||||
|
||||
;; Extract channels as xectors
|
||||
(r (red frame))
|
||||
(g (green frame))
|
||||
(b (blue frame))
|
||||
|
||||
;; Apply factor to each channel (implicit element-wise via Xector operators)
|
||||
(r-out (* r factor))
|
||||
(g-out (* g factor))
|
||||
(b-out (* b factor)))
|
||||
|
||||
;; Combine back to frame
|
||||
(rgb r-out g-out b-out)))
|
||||
Reference in New Issue
Block a user