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
//! Animation and frame management for flicker-free terminal graphics.
//!
//! This module provides the core infrastructure for building smooth, professional-quality
//! terminal animations. The key component is [`FrameBuffer`], which implements double buffering
//! to eliminate visual tearing and flickering during frame updates.
//!
//! # Double Buffering Explained
//!
//! Double buffering is a technique where two buffers are maintained:
//! - **Front buffer**: Currently displayed on screen (read-only during drawing)
//! - **Back buffer**: Being prepared for the next frame (where you draw)
//!
//! The workflow is:
//! 1. Clear the back buffer
//! 2. Draw the next frame to the back buffer
//! 3. Instantly swap front and back buffers (O(1) pointer swap)
//! 4. Render the new front buffer to the terminal
//! 5. Repeat
//!
//! This eliminates flickering because the user only sees complete frames - never
//! partially drawn content.
//!
//! # Example
//!
//! ```no_run
//! use dotmax::animation::FrameBuffer;
//! use dotmax::TerminalRenderer;
//!
//! // Create a double-buffered frame system
//! let mut buffer = FrameBuffer::new(80, 24);
//!
//! // Get mutable access to the back buffer for drawing
//! let back = buffer.get_back_buffer();
//! back.clear();
//! back.set_dot(10, 10).unwrap(); // Draw something
//!
//! // Swap buffers - instant O(1) operation
//! buffer.swap_buffers();
//!
//! // Render the front buffer to terminal
//! // let mut renderer = TerminalRenderer::new().unwrap();
//! // buffer.render(&mut renderer).unwrap();
//! ```
//!
//! # Performance
//!
//! - Buffer swap time: <1ms (pointer swap, not data copy)
//! - Designed for 60+ fps animations
//! - Memory efficient: buffers are reused, not reallocated
pub use DifferentialRenderer;
pub use FrameBuffer;
pub use ;
pub use PrerenderedAnimation;
pub use FrameTimer;