Add modular primitive libraries and fix Symbol class compatibility

- Add primitive_libs/ with modular primitive loading (core, math, image,
  color, color_ops, filters, geometry, drawing, blending, arrays, ascii)
- Effects now explicitly declare dependencies via (require-primitives "...")
- Convert ascii-fx-zone from hardcoded special form to loadable primitive
- Add _is_symbol/_is_keyword helpers for duck typing to support both
  sexp_effects.parser.Symbol and artdag.sexp.parser.Symbol classes
- Auto-inject _interp and _env for primitives that need them
- Remove silent error swallowing in cell_effect evaluation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-20 09:02:34 +00:00
parent 6ceaa37ab6
commit d574d5badd
24 changed files with 2056 additions and 46 deletions

View File

@@ -1,5 +1,8 @@
;; Composable ASCII Art with Per-Zone Expression-Driven Effects
;;
;; Requires ascii primitive library for the ascii-fx-zone primitive
(require-primitives "ascii")
;; Two modes of operation:
;;
;; 1. EXPRESSION MODE: Use zone-* variables in expression parameters

View File

@@ -1,5 +1,7 @@
;; Blur effect - gaussian blur
(require-primitives "filters" "math")
(define-effect blur
:params (
(radius :type int :default 5 :range [1 50])

View File

@@ -1,6 +1,8 @@
;; Brightness effect - adjusts overall brightness
;; Uses vectorized adjust primitive for fast processing
(require-primitives "color_ops")
(define-effect brightness
:params (
(amount :type int :default 0 :range [-255 255])

View File

@@ -1,6 +1,8 @@
;; Contrast effect - adjusts image contrast
;; Uses vectorized adjust primitive for fast processing
(require-primitives "color_ops")
(define-effect contrast
:params (
(amount :type int :default 1 :range [0.5 3])

View File

@@ -1,6 +1,8 @@
;; Hue shift effect - rotates hue values
;; Uses vectorized shift-hsv primitive for fast processing
(require-primitives "color_ops")
(define-effect hue_shift
:params (
(degrees :type int :default 0 :range [0 360])

View File

@@ -1,6 +1,8 @@
;; Invert effect - inverts all colors
;; Uses vectorized invert-img primitive for fast processing
(require-primitives "color_ops")
(define-effect invert
:params ()
(invert-img frame))

View File

@@ -1,5 +1,7 @@
;; Rotate effect - rotates image
(require-primitives "geometry")
(define-effect rotate
:params (
(angle :type int :default 0 :range [-360 360])

View File

@@ -1,6 +1,8 @@
;; Saturation effect - adjusts color saturation
;; Uses vectorized shift-hsv primitive for fast processing
(require-primitives "color_ops")
(define-effect saturation
:params (
(amount :type int :default 1 :range [0 3])