Glyph-by-shape: Sobel edge-orientation + --glyph-selection abstraction (#34) - #44
Merged
Conversation
… 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.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_glyph, pure + unit-tested): 3×3 brightness neighborhood → directional glyph above the gradient threshold, brightness bucket below.--glyph-selection/--glyph-edge-thresholdCLI flags, threaded as a single bundledGlyphConfigthrough the render path (mirrors the palette-cycle threading), resolved per-preset viaRenderArtDefaults, carried onRuntimeState+ the renderer, and round-tripped through saved config (serde(default)back-compat).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.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).--glyph-selection hybriddiffers (117 directional-glyph chars vs 0 for brightness).Closes #34.