Crate ailloli_ui_icon

Source
Expand description

Deterministic, UI-independent validation and rasterization of application SVG icons.

Application icons have stricter size, square-shape, external-resource, and visible-alpha requirements than the legacy arbitrary-SVG adapter. Successful rasters are square premultiplied RGBA8 buffers. The process performs no network or filesystem I/O through this crate.

§Examples

use ailloli_ui_core::AppIcon;
use ailloli_ui_icon::{rasterize_app_icon, validate_app_icon};
const SVG: &[u8] = br#"<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><rect width="10" height="10"/></svg>"#;
let icon = AppIcon::from_static_svg(SVG, "assets/icon.svg");
assert_eq!(validate_app_icon(&icon).unwrap().width, 10.0);
assert_eq!(rasterize_app_icon(&icon, 32).unwrap().rgba.len(), 32 * 32 * 4);

Structs§

RasterizedIcon
Square premultiplied RGBA8 raster output.
ValidatedIcon
Metadata produced after source, geometry, parse, and visible-alpha validation.

Enums§

IconError
Application-icon validation and raster allocation failures.

Constants§

MAX_SVG_BYTES
Maximum accepted application-icon source length: 4 MiB (4,194,304 bytes).
MAX_SVG_DIMENSION
Maximum accepted SVG view-box and parsed-tree dimension, in SVG/CSS pixels.
SQUARE_RELATIVE_EPSILON
Maximum relative width/height delta treated as numerically square.

Functions§

rasterize_app_icon
Validates and rasterizes an app icon, caching by source digest and side length.
rasterize_svg_source
Rasterizes an arbitrary legacy SVG source without application-icon validation.
validate_app_icon
Validates source size, XML/resource structure, square geometry, and visibility.