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
//! ## Backends
//!
//! **Ratzilla** provides three backends for rendering terminal UIs in the browser,
//! each with different performance characteristics and trade-offs:
//!
//! - [`WebGl2Backend`]: GPU-accelerated rendering powered by [beamterm][beamterm]. Uses prebuilt
//! or runtime generated font atlases. Very low overhead, typically under 1ms CPU time per frame,
//! even for fullscreen terminals with all cells changing.
//!
//! - [`CanvasBackend`]: Canvas 2D API with Unicode support via browser font rendering.
//! Good fallback for the `WebGl2Backend`, if WebGL2 isn't available. Does not support hyperlinks
//! or text selection, but can render dynamic Unicode and single-cell emoji.
//!
//! - [`DomBackend`]: Renders cells as HTML elements. Most compatible, but slowest for large
//! terminals.
//!
//! [beamterm]: https://github.com/junkdog/beamterm
//!
//! ## Backend Comparison
//!
//! | Feature | DomBackend | CanvasBackend | WebGl2Backend |
//! |------------------------------|------------|---------------|----------------|
//! | **60fps on large terminals** | ✗ | ✗ | ✓ |
//! | **Memory Usage** | Highest | Medium | Lowest |
//! | **Hyperlinks** | ✗ | ✗ | ✓ |
//! | **Text Selection** | Linear | ✗ | Linear/Block |
//! | **Unicode/Emoji Support** | Full | Limited² | Full¹ |
//! | **Dynamic Characters** | ✓ | ✓ | ✓¹ |
//! | **Font Variants** | ✓ | Regular only | ✓ |
//! | **Underline** | ✓ | ✗ | ✓ |
//! | **Strikethrough** | ✓ | ✗ | ✓ |
//! | **Browser Support** | All | All | Modern (2017+) |
//! | **Mouse Events** | Full | Full | Basic |
//!
//! ¹: The [dynamic font atlas](webgl2::FontAtlasConfig::Dynamic) rasterizes
//! glyphs on demand with full Unicode/emoji and font variant support. The
//! [static font atlas](webgl2::FontAtlasConfig::Static) is limited to glyphs
//! compiled into the `.atlas` file.
//! ²: Unicode is supported, but emoji only render correctly when it spans one cell.
//! Most emoji occupy two cells.
//!
//! ### Mouse Event Support
//!
//! All backends support [`WebEventHandler`] for mouse events with grid coordinate translation.
//!
//! | Event Type | DomBackend | CanvasBackend | WebGl2Backend |
//! |-----------------|------------|---------------|---------------|
//! | `Moved` | ✓ | ✓ | ✓ |
//! | `ButtonDown` | ✓ | ✓ | ✓ |
//! | `ButtonUp` | ✓ | ✓ | ✓ |
//! | `SingleClick` | ✓ | ✓ | ✗ |
//! | `DoubleClick` | ✓ | ✓ | ✗ |
//! | `Entered` | ✓ | ✓ | ✗ |
//! | `Exited` | ✓ | ✓ | ✗ |
//!
//! [`WebEventHandler`]: crate::WebEventHandler
//!
//! ## Choosing a Backend
//!
//! - **WebGl2Backend**: Preferred for most applications - consumes the least amount of resources
//! - **CanvasBackend**: When you must support non-WebGL2 browsers
//! - **DomBackend**: When you need better accessibility or CSS styling
/// Canvas backend.
/// DOM backend.
/// WebGL2 backend.
/// Color handling.
/// Event callback management.
pub
/// Backend utilities.
pub
/// Cell size metrics for backends.
/// Cursor shapes.