Expand description
§Asvgard
asvgard is a lightweight, dependency-free (mostly) graphics rendering library written in Rust.
It provides a unified interface for loading, decoding, and rasterizing various image formats
including SVG, PNG, and TGA.
§Features
- SVG Support: Custom-built XML parser and rasterizer supporting paths, shapes, strokes, and fills.
- PNG Support: From-scratch implementation of DEFLATE (zlib) decompression and filtering.
- TGA Support: Native support for uncompressed and RLE-compressed TGA files.
- No External Image Crates: All decoding logic is implemented internally for educational and lightweight purposes.
§Usage
use asvgard::prelude::*;
// Load an image from bytes (detects format automatically)
let data = include_bytes!("../test.png");
let width = 800;
let height = 600;
match load_image(data, width, height) {
Ok(buffer) => {
println!("Image loaded! Buffer size: {}", buffer.len());
// buffer contains ARGB u32 pixels
}
Err(e) => eprintln!("Failed to load image: {}", e),
}Modules§
- png
- PNG decoding and rendering.
- prelude
- Common types and functions for easy import.
- svg
- SVG parsing and rasterization.
- tga
- utils
Enums§
- Image
Type - Supported image formats.
Functions§
- detect_
type - Detects the image format based on magic bytes or file heuristics.
- load_
image - Loads and rasterizes an image from raw bytes into a pixel buffer.