A Rust library for software rendering onto raw RGBA pixel buffers. It provides
glyph rasterization, Nerd Font icon rendering, text layout, progress bars,
and a builder-pattern render context — all without requiring a windowing
system or GPU. Colors use the generic Color<T> type from
smearor-commons-color (Color<f64> normalized, Color<u8> pixel-native).
- Pixel Operations —
fill_background,blend_pixel, and bitmap text fallback - Glyph Rendering — Single-glyph rasterization with alpha blending using
ab_glyph, plus glyph scale caching - Icon Rendering — Draw Nerd Font icons by name or codepoint, icon placeholders, and icon grids
- Text Rendering — Label text at bottom, centered text at arbitrary positions, with font fallback and truncation
- Progress Bars — Horizontal progress bar with configurable colors
- RenderContext — Builder pattern combining background, icon, and label rendering
- Rust toolchain (Edition 2024)
nerd-fonts-gtkas a path dependency (for font loading)
[dependencies]
pixel-drawing = { path = "../pixel-drawing" }
nerd-fonts-gtk = { path = "../nerd-fonts-gtk", default-features = false, features = ["render", "embed-fonts"] }use pixel_drawing::pixel_buffer::PixelBuffer;
use pixel_drawing::render_context::RenderContext;
use pixel_drawing::size::Size;
use smearor_commons_color::Color;
// PixelBuffer methods
let mut buf = PixelBuffer::new(Size::new(96, 96));
buf.fill_background(Color::<f64>::new(0.1, 0.1, 0.1));
buf.draw_nerd_font_icon(
"nf-fa-gamepad",
true,
|name| Some('\u{F11B}'),
Some(Color::<f64>::new(0.4, 0.7, 1.0)),
);
buf.draw_label_text("gamepad", false, None);
// RenderContext builder
let mut buf = PixelBuffer::new(Size::new(96, 96));
let mut ctx = RenderContext::new(&mut buf)
.background(Color::new(0.12, 0.12, 0.12))
.icon_color(Color::new(0.4, 0.7, 1.0))
.active(true);
ctx.fill_background();
ctx.draw_icon('\u{F11B}');
ctx.draw_label("gamepad");cargo run --example interactive_demoThe interactive demo is a GTK4 application that demonstrates all rendering
methods: fill_background, draw_nerd_font_icon, draw_icon_placeholder,
draw_nerd_font_codepoint, draw_icon_grid, draw_progress_bar,
draw_label_text, draw_text_centered, and RenderContext.
- User Guide: mdBook
- API Reference: docs.rs
- Changelog: CHANGELOG.md
Contributions are welcome. Please read the Code of Conduct before contributing.
Licensed under the MIT License.