Expand description
Prelude module for convenient imports.
This module re-exports the most commonly used types from dotmax, allowing you to import everything you need with a single statement:
use dotmax::prelude::*;This follows the standard Rust convention used by libraries like
std::prelude, tokio::prelude, and serde::prelude.
§What’s Included
§Core Types
BrailleGrid: The fundamental braille rendering bufferColor: RGB color for cells and drawing operationsTerminalRenderer: Handles terminal output and cursor managementTerminalBackend: Trait for custom terminal backendsTerminalCapabilities: Terminal feature detectionDotmaxError: Error type for all operationsResult: Convenience type alias (Result<T, DotmaxError>)
§Drawing Primitives
draw_line,draw_line_colored: Line drawing (Bresenham algorithm)draw_circle,draw_circle_colored: Circle drawingdraw_rectangle,draw_rectangle_colored: Rectangle drawingdraw_polygon,draw_polygon_colored: Polygon drawing
§Animation
AnimationLoop,AnimationLoopBuilder: Animation loop managementFrameBuffer: Double-buffered frame storageFrameTimer: Frame rate control and timingDifferentialRenderer: Efficient partial screen updatesPrerenderedAnimation: Pre-computed animation frames
§Color System
ColorScheme,ColorSchemeBuilder: Color scheme typesColorCapability: Terminal color capability detectiondetect_color_capability: Auto-detect terminal color supportapply_color_scheme,apply_colors_to_grid: Apply colors to grids- Built-in schemes:
heat_map,rainbow,grayscale,monochrome,blue_purple,cyan_magenta,green_yellow
§Feature-Gated Exports
With the image feature enabled, also includes:
ImageRenderer: High-level image-to-braille renderingDitheringMethod: Dithering algorithm selection
§Note on Result
This prelude exports dotmax::Result<T> which is an alias for
std::result::Result<T, DotmaxError>. If you need to use a different
error type (like Box<dyn std::error::Error>), use the fully qualified
std::result::Result instead.
§Examples
§Basic Grid Usage
use dotmax::prelude::*;
// Create a grid and draw some shapes
let mut grid = BrailleGrid::new(80, 24)?;
draw_line(&mut grid, 0, 0, 100, 50)?;
draw_circle(&mut grid, 80, 48, 30)?;§Animation Loop
use dotmax::prelude::*;
// AnimationLoop::new(width, height) returns an AnimationLoopBuilder
let animation = AnimationLoop::new(80, 24)
.fps(30);§Color Schemes
use dotmax::prelude::*;
let scheme = heat_map();
let capability = detect_color_capability();§Image Rendering (with image feature)
ⓘ
use dotmax::prelude::*;
use std::path::Path;
let grid = ImageRenderer::new()
.load_from_path(Path::new("image.png"))?
.resize_to_terminal()?
.dithering(DitheringMethod::FloydSteinberg)
.render()?;Re-exports§
pub use crate::BrailleGrid;pub use crate::Color;pub use crate::DotmaxError;pub use crate::Result;pub use crate::TerminalBackend;pub use crate::TerminalCapabilities;pub use crate::TerminalRenderer;pub use crate::primitives::draw_circle;pub use crate::primitives::draw_circle_colored;pub use crate::primitives::draw_line;pub use crate::primitives::draw_line_colored;pub use crate::primitives::draw_polygon;pub use crate::primitives::draw_polygon_colored;pub use crate::primitives::draw_rectangle;pub use crate::primitives::draw_rectangle_colored;pub use crate::AnimationLoop;pub use crate::AnimationLoopBuilder;pub use crate::DifferentialRenderer;pub use crate::FrameBuffer;pub use crate::FrameTimer;pub use crate::PrerenderedAnimation;pub use crate::apply_color_scheme;pub use crate::apply_colors_to_grid;pub use crate::blue_purple;pub use crate::cyan_magenta;pub use crate::detect_color_capability;pub use crate::grayscale;pub use crate::green_yellow;pub use crate::heat_map;pub use crate::monochrome;pub use crate::rainbow;pub use crate::ColorCapability;pub use crate::ColorScheme;pub use crate::ColorSchemeBuilder;pub use crate::quick::grid;pub use crate::quick::grid_sized;pub use crate::quick::show;