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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
//! # Trueno-Viz
//!
//! SIMD/GPU/WASM-accelerated visualization library for data science and machine learning.
//!
//! Built on the [trueno](https://crates.io/crates/trueno) core library, trueno-viz provides
//! hardware-accelerated rendering of statistical and scientific visualizations with zero
//! JavaScript/HTML dependencies.
//!
//! ## Features
//!
//! - **Pure Rust**: No JavaScript, HTML, or browser dependencies
//! - **Hardware Acceleration**: Automatic dispatch to SIMD (SSE2/AVX2/AVX512/NEON), GPU, or WASM
//! - **Grammar of Graphics**: Declarative, composable visualization API
//! - **Multiple Outputs**: PNG, SVG, and terminal (ASCII/Unicode) rendering
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use trueno_viz::prelude::*;
//!
//! // Create a scatter plot
//! let plot = ScatterPlot::new()
//! .x(&[1.0, 2.0, 3.0, 4.0, 5.0])
//! .y(&[2.0, 4.0, 1.0, 5.0, 3.0])
//! .color(Rgba::BLUE)
//! .build();
//!
//! // Render to PNG
//! plot.render_to_file("scatter.png")?;
//! ```
//!
//! ## Feature Flags
//!
//! - `gpu`: Enable GPU compute acceleration
//! - `parallel`: Enable parallel processing with rayon
//! - `ml`: Integration with aprender/entrenar ML libraries
//! - `graph`: Integration with trueno-graph
//! - `db`: Integration with trueno-db
//! - `terminal`: Terminal output support
//! - `svg`: SVG output support
//! - `full`: All features enabled
//!
//! ## Academic References
//!
//! This library implements algorithms from peer-reviewed research:
//!
//! - Wilkinson, L. (2005). *The Grammar of Graphics*. Springer.
//! - Wu, X. (1991). "An Efficient Antialiasing Technique." SIGGRAPH '91.
//! - Douglas, D. H., & Peucker, T. K. (1973). Line simplification algorithm.
//! - Fruchterman, T. M. J., & Reingold, E. M. (1991). Force-directed graph layout.
// Allow unwrap() in tests only - banned in production code (Cloudflare incident 2025-11-18)
// Allow common patterns in graphics/visualization code
// ============================================================================
// Core Modules
// ============================================================================
/// Color types and color space conversions.
/// Core framebuffer for pixel rendering.
/// Geometric primitives (points, lines, rectangles).
/// Scale functions for data-to-visual mappings.
// ============================================================================
// Visualization Modules
// ============================================================================
/// Grammar of Graphics implementation.
/// High-level plot types (scatter, heatmap, histogram, etc.).
// ============================================================================
// Rendering Modules
// ============================================================================
/// SIMD/GPU acceleration layer.
/// Output encoders (PNG, SVG, terminal).
/// Rendering backends and rasterization.
// ============================================================================
// Optional Integration Modules
// ============================================================================
/// Ecosystem integrations (trueno-db, trueno-graph, aprender).
// NOTE: the `monitor` module (ttop-2.0 btop-like TUI) and its `monitor` feature were
// removed in #1979. The module was deleted in the ttop-2.0 refactor; the feature and its
// gated tests/examples that still imported it could no longer compile.
/// Text prompt interface for declarative visualization DSL.
/// WebAssembly bindings for browser usage.
/// Dashboard widgets for experiment tracking and visualization.
// ============================================================================
// Error Types
// ============================================================================
/// Error types for trueno-viz operations.
pub use ;
// ============================================================================
// Prelude
// ============================================================================
/// Commonly used types and traits for convenient imports.
///
/// ```rust,ignore
/// use trueno_viz::prelude::*;
/// ```
// ============================================================================
// Re-exports
// ============================================================================
/// Re-export trueno for direct access to SIMD operations.
pub use trueno;
// ============================================================================
// Tests
// ============================================================================