dotmax
High-performance terminal braille rendering for Rust
Features
- ðĻ 4à Resolution Advantage - Braille 2Ã4 dot matrix provides superior detail over ASCII art
- ⥠Blazing Fast - <50ms image rendering, 60-120fps animation
- ð Universal Compatibility - Works in any Unicode-capable terminal
- ðĶ Zero-Cost Abstractions - Memory-safe Rust with minimal overhead
- ð Rich Graphics - Images, shapes, colors, and animations in your terminal
Installation
Add dotmax to your Cargo project:
Or add to Cargo.toml:
[]
= "0.1"
Quick Start
use ;
See examples/ for more usage patterns including images, animations, and color schemes.
Visual Demo
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â âĄâĒâ â â â â â â â â â â â â â â â â â â â Braille rendering provides â
â â â âĒâĄâ â â â â â â â â â â â â â â â â â 4x the resolution of ASCII â
â â â â â âĒâĄâ â â â â â â â â â â â â â â â art. Each character cell â
â â â â â â â âĒâĄâ â â â â â â â â â â â â â contains a 2Ã4 dot matrix. â
â â â â â â â â â âĒâĄâ â â â â â â â â â â â â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Feature Flags
| Flag | Description | Dependencies |
|---|---|---|
default |
Core braille rendering only | ratatui, crossterm, thiserror |
image |
PNG, JPG, GIF, BMP, WebP, TIFF support | image, imageproc |
svg |
SVG vector graphics rendering | resvg, usvg |
video |
Video playback (Phase 2) | ffmpeg (future) |
raytrace |
3D raytracing (Phase 3) | TBD (future) |
Enable features in your Cargo.toml:
[]
= { = "0.1", = ["image", "svg"] }
Animation
Dotmax provides a comprehensive animation system for smooth, flicker-free terminal animations:
use AnimationLoop;
Animation Components
| Component | Purpose |
|---|---|
AnimationLoop |
High-level animation abstraction (recommended) |
FrameTimer |
Consistent frame rate control |
FrameBuffer |
Double-buffering for flicker-free updates |
PrerenderedAnimation |
Cached frame sequences for looping |
DifferentialRenderer |
Only render changed cells (90%+ savings) |
Animation Examples
For comprehensive documentation, see docs/animation_guide.md.
Examples
| Example | Description | Features |
|---|---|---|
hello_braille |
Minimal braille demo | - |
load_image |
Load and display images | image |
simple_animation |
Basic animation loop | - |
color_schemes_demo |
Color scheme showcase | - |
shapes_demo |
Drawing primitives | - |
See examples/README.md for all 49 examples.
# Core examples
# Image rendering (requires feature)
# Animation examples
Documentation
- API Reference: docs.rs/dotmax
- Getting Started: docs/getting_started.md
- Animation Guide: docs/animation_guide.md
- Performance Guide: docs/performance.md
- Troubleshooting: docs/troubleshooting.md
Logging
Dotmax uses the tracing crate for structured logging. The library does not initialize a tracing subscriber - your application must do this if you want to see log output.
Enabling Logging in Your Application
Add tracing-subscriber to your Cargo.toml:
[]
= "0.1"
= "0.3"
Initialize the subscriber in your application:
use tracing_subscriber;
Log Levels
Dotmax uses appropriate log levels for different operations:
| Level | Usage | Examples |
|---|---|---|
ERROR |
Operation failures | Out-of-bounds errors, invalid dimensions |
WARN |
Degraded operation | Terminal lacks Unicode support (future) |
INFO |
Major operations | Grid creation, rendering complete |
DEBUG |
Detailed flow | Resize operations, color changes |
TRACE |
Hot path internals | Not used by default (performance) |
Controlling Log Output
Use environment variables to control logging:
# Show all logs
RUST_LOG=dotmax=trace
# Show only INFO and above
RUST_LOG=dotmax=info
# Show logs from multiple crates
RUST_LOG=dotmax=debug,my_app=info
Performance Considerations
Dotmax is designed for zero-cost logging when disabled:
- Hot paths (
set_dot,get_dot) do not emit debug logs - Logging overhead is compile-time removed when no subscriber is initialized
- Enabling logging has minimal performance impact (~<1%)
Example
See examples/logging_demo.rs for a complete demonstration:
For more information, see the tracing documentation.
Performance
Dotmax is designed for "efficiency so fast, it's invisible". Here are the benchmark results:
Core Rendering
| Operation | 80x24 Terminal | 200x50 Terminal |
|---|---|---|
| Grid creation | ~173ns | ~743ns |
| Grid clear | ~40ns | ~150ns |
| Unicode conversion | ~1.7Ξs | ~7.1Ξs |
| Full frame cycle | ~2.1Ξs | ~9.1Ξs |
Image Processing (--features image)
| Operation | 800x600 Source | Target |
|---|---|---|
| Resize to 80x24 | ~1.5ms | <10ms |
| Full pipeline (resize + threshold + braille) | ~10ms | <25ms |
| Floyd-Steinberg dithering | ~66Ξs | <15ms |
| Load + render (with I/O) | ~6ms | <50ms |
Animation
| Operation | 80x24 | 200x50 |
|---|---|---|
| Frame swap | ~23ns | ~23ns |
| Single frame preparation | ~2.0Ξs | ~9.0Ξs |
| 100 frames sustained | ~164Ξs | ~766Ξs |
| Per-frame budget | ~1.6Ξs | ~7.7Ξs |
60fps requires <16.67ms per frame. Dotmax achieves ~1.6Ξs (10,000x faster than required).
Memory
- Baseline: <5MB
- Per frame: <500KB (80x24 grid)
- Binary size: <2MB addition to your compiled binary
Running Benchmarks
# Core benchmarks (no features)
# Image processing benchmarks
# Animation benchmarks
# All benchmarks
Comparison to Alternatives
| Feature | dotmax | drawille (Python) | Sixel | Kitty Protocol |
|---|---|---|---|---|
| Resolution | 2Ã4 dots/char | 2Ã4 dots/char | True pixels | True pixels |
| Terminal Support | Universal (Unicode) | Universal | Limited | Kitty only |
| Language | Rust | Python | Various | Various |
| Performance | ~2Ξs/frame | ~10ms/frame | Varies | Fast |
| Animation | Built-in | Manual | Manual | Built-in |
| Colors | RGB + Schemes | Limited | Full | Full |
| Dependencies | Minimal | Minimal | Native | Native |
When to use dotmax:
- Need universal terminal compatibility (SSH, tmux, etc.)
- Want Rust performance with zero-cost abstractions
- Building CLI tools or TUI applications
- Need smooth 60fps animations
When to use Sixel/Kitty:
- Control both ends (local terminal)
- Need true pixel-level detail (photos)
- Terminal supports the protocol
Platform Support
- â Windows (x86_64)
- â Linux (x86_64)
- â macOS (x86_64, ARM64)
Development
Code Quality
This project enforces high code quality standards using automated tooling. All checks run in CI and must pass before merging.
Linting (Clippy)
Run Clippy to catch common mistakes and enforce Rust idioms:
Examples are also checked by Clippy in CI. All code in examples/ must pass clippy checks with no warnings. To check examples specifically:
Fix any warnings before committing. For false positives, use #[allow(clippy::lint_name)] with a comment explaining why.
Formatting (Rustfmt)
Format code before committing:
Check formatting without modifying files:
License and Security (cargo-deny)
Install cargo-deny:
Check licenses, advisories, and dependencies:
This validates that all dependencies use permissive licenses (MIT, Apache-2.0, BSD, etc.) and have no known security vulnerabilities.
Running All Checks
Before pushing code, ensure all quality checks pass:
CI enforces these checks on every push. Pull requests will fail if any check reports violations.
Contributing
Contributions welcome! Please see CONTRIBUTING.md for guidelines (coming soon).
Before submitting pull requests, ensure all code quality checks pass:
License
Licensed under either of:
- MIT License (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)
at your option.
Acknowledgments
Dotmax extracts and professionalizes the braille rendering system from crabmusic, where it has proven exceptional output quality.