1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! Rendering pipeline from simulation data to terminal output: downsampling,
//! color mapping, character selection, dithering, and overlays.
//!
//! # Pipeline Overview
//!
//! 1. **Downsampling** (`downsample`): Converts high-resolution trail map to terminal dimensions
//! 2. **Color Mapping** (`palette`): Maps trail brightness to RGB colors using selected palette
//! 3. **Character Selection** (`charset`): Chooses appropriate Unicode characters based on brightness
//! 4. **Dithering** (`dither`, `error_diffusion`): Applies dithering for smoother gradients
//! 5. **Overlays** (`overlay`, `panel`): Renders UI elements like controls and statistics
//!
//! # Example
//!
//! ```rust,no_run
//! use tslime::render::downsample::{downsample, DownsampledFrame};
//! use tslime::render::palette::{Palette, map_brightness_rgb};
//!
//! let trail_data = vec![0.5f32; 400 * 400]; // Simulated trail data
//! let mut frame = DownsampledFrame::new(80, 24);
//! downsample(&trail_data, 400, 400, 80, 24, &mut frame);
//!
//! // Map brightness to color
//! let color = map_brightness_rgb(0.5, Palette::Organic, false, false, 0.0, None);
//! ```
/// Adaptive brightness normalization logic.
/// Ambient instrument surface and state machine.
/// Color anti-aliasing for subcell-shape charsets.
/// Character set definitions and mapping logic.
/// Standalone (non-palette) color constants.
/// Two-depth Controls instrument surface.
/// Dithering algorithms (ordered, error diffusion).
/// Downsampling from simulation grid to terminal grid.
/// Error diffusion specific implementation.
/// Color gradient data for palettes.
/// Background grid rendering.
/// Motion math helpers (lerp, breath).
/// Color palette definitions and conversions.
/// Theme/color scheme definitions.
/// Reusable rendering widgets and layout tokens.
/// Window layout geometry computation (aspect-ratio-correct sim rect).
/// Window frame rendering for terminal display.
/// General overlay rendering utilities (help, stats, etc.).
/// Interactive palette editor for custom color schemes.
/// Panel styling and theme definitions.
/// Config browser and save-dialog overlay builders (hand-rolled; no ratatui dep).
/// Preset-switch transition overlays (figlet / typed readout).