| Crates.io | blinc_svg |
| lib.rs | blinc_svg |
| version | 0.1.12 |
| created_at | 2026-01-14 17:32:53.491694+00 |
| updated_at | 2026-01-19 01:05:41.757864+00 |
| description | SVG loading and rendering for Blinc UI framework |
| homepage | |
| repository | https://github.com/project-blinc/Blinc |
| max_upload_size | |
| id | 2043303 |
| size | 49,251 |
Part of the Blinc UI Framework
This crate is a component of Blinc, a GPU-accelerated UI framework for Rust. For full documentation and guides, visit the Blinc documentation.
SVG loading and rendering for Blinc UI.
blinc_svg provides SVG parsing and rendering capabilities using usvg and resvg.
use blinc_svg::SvgDocument;
// Load SVG from file
let svg = SvgDocument::load("icon.svg")?;
// Load from string
let svg = SvgDocument::parse(r#"
<svg viewBox="0 0 24 24">
<path d="M12 2L2 7v10l10 5 10-5V7z"/>
</svg>
"#)?;
// Get dimensions
let (width, height) = svg.size();
use blinc_svg::RasterizedSvg;
// Rasterize at specific size
let rasterized = svg.rasterize(64, 64)?;
// Get pixel data
let pixels = rasterized.pixels();
let width = rasterized.width();
let height = rasterized.height();
use blinc_layout::prelude::*;
use blinc_icons::icons;
// SVG from string
svg(r#"<svg>...</svg>"#)
.size(24.0, 24.0)
// SVG from icon constant
svg(icons::CHECK)
.size(16.0, 16.0)
.color(Color::GREEN)
// Custom SVG file
svg_file("assets/logo.svg")
.size(100.0, 50.0)
// Apply solid color tint
svg(icons::HEART)
.size(24.0, 24.0)
.color(Color::RED)
// SVGs are rendered with the tint color applied
// to all fill and stroke elements
For best performance:
blinc_svg
├── document.rs # SVG document parsing
├── rasterize.rs # CPU rasterization via resvg
├── tessellate.rs # Path tessellation via lyon
└── commands.rs # Drawing command generation
MIT OR Apache-2.0