Skip to content

Glyph-by-shape: Sobel edge-orientation + --glyph-selection abstraction (#34) - #44

Merged
tamirelazar merged 7 commits into
devfrom
feat/glyph-by-shape
Jun 19, 2026
Merged

Glyph-by-shape: Sobel edge-orientation + --glyph-selection abstraction (#34)#44
tamirelazar merged 7 commits into
devfrom
feat/glyph-by-shape

Conversation

@tamirelazar

Copy link
Copy Markdown
Owner

Implements lever 10 (#34): a --glyph-selection <brightness|shape|hybrid> abstraction (plus --glyph-edge-threshold) toggling the terminal character-selection strategy, with a net-new hybrid mode that runs Sobel edge-orientation on the downsampled brightness field and emits directional glyphs (| / - \) on high-gradient cells.

Scope (Milestone 1)

  • Sobel edge-orientation (sobel_edge_glyph, pure + unit-tested): 3×3 brightness neighborhood → directional glyph above the gradient threshold, brightness bucket below.
  • --glyph-selection / --glyph-edge-threshold CLI flags, threaded as a single bundled GlyphConfig through the render path (mirrors the palette-cycle threading), resolved per-preset via RenderArtDefaults, carried on RuntimeState + the renderer, and round-tripped through saved config (serde(default) back-compat).
  • Mechanism-only / default-off: selection: None (the default for bare runs and every preset) is identity — the existing char-selection path is untouched, so the 47 existing golden tests are byte-identical to dev.
  • TUI/print-only: print + frame-capture honor glyph; pixel exports (GIF/WebM/PNG) are exempt.
  • No-op on tonal charsets; brightness override applies to Ascii/Braille/Sculpted; hybrid directional glyphs are ASCII-family only.

Out of scope (follow-ups)

Test plan

  • cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings — clean.
  • cargo test — 840 lib + 19 integration pass.
  • cargo test --test visual_regression — 51 pass: 47 existing unchanged + 4 new (ascii_hybrid, ascii_brightness, braille_brightness, sculpted_brightness).
  • Empirical same-seed: bare run byte-identical to dev; --glyph-selection hybrid differs (117 directional-glyph chars vs 0 for brightness).
  • New unit coverage: Sobel orientation, glyph-override semantics, CLI override/clamp, saved-config round-trip + back-compat.

Closes #34.

… glyph

Lever 10 (#34) Milestone 1 primitives: a bundled GlyphConfig (selection +
glyph-edge-threshold) and a pure, unit-tested sobel_edge_glyph() that maps a
3x3 brightness neighborhood to a directional glyph. Not yet wired into the
render path. New DEFAULT_GLYPH_EDGE_THRESHOLD const, distinct from the dither
edge_threshold consts.
…ection

Adds a trailing GlyphConfig param to from_downsampled/_at/create_cell and a
glyph_override() that, for non-default selections, forces the brightness ramp
on shape charsets or emits Sobel directional glyphs on ASCII-family charsets.
selection=None is identity (existing goldens unchanged). All current callsites
pass GlyphConfig::default(); the real renderer value is wired next.
Parses the two flags into RenderArtDefaults.glyph (GlyphConfig), overriding the
per-preset identity only when set. Every preset still resolves to identity, so
bare runs are unaffected. Flag values are not yet consumed by the renderer.
… path

RuntimeState and the renderer now carry GlyphConfig; sync_renderer_caches pushes
it on load/undo/redo/randomize (parity with palette_cycle); the runner seeds it
from the resolved render-art defaults; print mode honors it. Pixel exports stay
on the identity default (TUI-only lever).
…mpat)

SavedConfig gains glyph_selection/glyph_edge_threshold (both serde(default));
identity serializes to None so older configs load unchanged. Round-trips
through from_runtime + apply_to_runtime_state.
New goldens for ascii hybrid/brightness, braille brightness, sculpted
brightness. Existing 47 goldens unchanged (mechanism default-off proof).
README gains a hybrid-glyph usage example.
@tamirelazar
tamirelazar merged commit 22e32dd into dev Jun 19, 2026
3 checks passed
@tamirelazar
tamirelazar deleted the feat/glyph-by-shape branch June 19, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant