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
//! Terminal rendering system for TUI applications
//!
//! Double buffering and efficient diff-based updates for optimal performance.
//!
//! # Architecture
//!
//! The rendering system is composed of:
//!
//! | Component | Description | Module |
//! |-----------|-------------|--------|
//! | **Backend** | Low-level terminal I/O abstraction | [`backend`] |
//! | **Buffer** | Double-buffered screen state | (see [`Buffer`]) |
//! | **Cell** | Individual terminal cell (char, colors, modifiers) | (see [`Cell`]) |
//! | **Terminal** | High-level diff-based renderer | (see [`Terminal`]) |
//! | **Diff** | Efficient buffer diffing algorithm | (see [`diff`](diff())) |
//! | **Images** | Kitty, iTerm2, and Sixel graphics | Available with `image` feature |
//!
//! # Quick Start
//!
//! ```rust,ignore
//! use revue::render::{Terminal, Buffer};
//!
//! // Create terminal
//! let mut terminal = Terminal::new()?;
//!
//! // Create buffer matching terminal size
//! let mut buffer = Buffer::new(terminal.size()?);
//!
//! // Draw to buffer
//! buffer.set_string(0, 0, "Hello, World!", style);
//!
//! // Render with diffing
//! terminal.draw(&buffer)?;
//! ```
//!
//! # Double Buffering
//!
//! Revue uses double buffering for efficient rendering:
//!
//! 1. Two buffers of the same size are allocated
//! 2. Each frame renders to the "back" buffer
//! 3. Buffers are compared to find minimal changes
//! 4. Only changed cells are written to the terminal
//! 5. Buffers are swapped for the next frame
//!
//! # Cell Rendering
//!
//! ```rust,ignore
//! use revue::render::{Cell, Modifier};
//!
//! // Create a styled cell
//! let cell = Cell::new('A')
//! .fg(Color::Blue)
//! .bg(Color::Black)
//! .modifier(Modifier::BOLD);
//! ```
//!
//! # Image Support
//!
//! ```rust,ignore
//! use revue::render::image_protocol::KittyImage;
//!
//! // Detect image support
//! if let Some(protocol) = KittyImage::detect() {
//! // Render image
//! protocol.draw_image(x, y, &image_data)?;
//! }
//! ```
//!
//! # Performance
//!
//! - Diff-based updates minimize terminal writes
//! - Batch operations group multiple cell updates
//! - ANSI escape sequences are cached
//! - Terminal capabilities are detected once
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;