
embedded-rgba
A lightweight, no_std RGBA framebuffer and canvas abstraction for the embedded-graphics ecosystem. It adds alpha blending, buffering strategies, and a practical way to manage drawing pipelines on microcontrollers and resource‑constrained devices.
Check out the MiniType for a font format that takes full advantage of RGBA canvas.
✨ Features
- ✅ Alpha blending – draw
Rgbapixels onto RGB framebuffers with fast per‑pixel transparency. - ✅ Flexible buffering – choose between double buffering, single buffering, or scanline buffering (coming soon) depending on memory and performance tradeoffs.
- ✅ Drop‑in integration with
embedded-graphics’sDrawTargetandPixelColor. - ✅ No heap allocation – designed for MCUs without a heap.
- ✅ Optimized for speed – fast fill paths and alpha blending.
🚀 Usage
Create a canvas
use Canvas;
use MockDisplay;
use Rgb565;
let display = new;
// Create a double buffered canvas
let mut canvas = 240 * 320}, 240, 320>double_buffered;
// or a single buffer
let mut canvas = 240 * 320}, 240, 320>single_buffered;
✨ Draw with Rgba colors
// `Rgba` is a normal embedded_graphics color
let transparent_orange = new;
let style = new.fill_color.build;
// `canvas.alpha()` is a temporary draw target that can be drawn onto with `Rgba` color
new.draw_styled?;
// Commit the update pixels to the display
canvas.flush.unwrap;
📊 When to use which buffer?
- Double buffer → flicker‑free updates, at the cost of RAM (2 full framebuffers).
- Single buffer → less RAM, may tear if drawn while refreshing.
- Line buffer → minimal RAM (1 row), best for preplanned scanline rendering.
🔮 Roadmap
- SIMD‑style blending optimizations for all RGB colors
- Region‑based dirty rectangle updates
- Line buffer