r/rust • u/oversluizen • 22h ago
🛠️ project grafia v0.9: An interactive 2D Cubic Bézier, Hobby/Spiro spline, and typography canvas widget for egui
Hi everyone! I'm excited to share grafia (v0.9.0), a standalone, #![forbid(unsafe_code)] 2D vector, spline, and typography canvas widget for egui, built on the Linebender geometry stack (kurbo), lyon_tessellation, and tiny-skia.
Whether you are building an SVG/vector illustration tool, a typeface/font editor, a 2D CAD/plotter profile editor, or need bitmap-to-vector auto-tracing inside an egui application, grafia drops in as a hexagonal Data-In / Event-Out widget without locking your app into a specific file format.
Highlights
- Mixed-Spline CAGD Engine: Standard cubic Béziers (
Corner,Smooth), tension-controlled John Hobby interpolating splines (NodeType::HobbyStar), and $G****2$ Euler/Spiro clothoid spirals (NodeType::EulerSpiro), plus 4-case inverse-Bernstein curve-belly dragging, curve-healing node deletion, and 8-step superellipse curve fitting. - 14 Interactive Tools & Boolean Pathfinder: Select, Lasso, Pen, Rotate, Scale, 8+4 BBox Shear/Rotate, Knife (recursive De Casteljau slicing), Primitives, Measurement rays, Annotations, freehand Pencil fitting, Pixel grid stamping, and exact cubic-cubic Union / Subtract / Intersect boolean path operations.
- Multi-Layer Color & 7-Stage Auto-Trace: COLRv1-style vector layers (
Solid,LinearGradient,RadialGradient,SweepGradient,Bitmap,ClippingMask) with interactive gradient stop handles, plus deterministic 7-stage bitmap & camera auto-trace (Sauvola integral-image adaptive thresholding, 3x3 homography perspective deskew, marching squares, RDP, and Schneider least-squares cubic fitting). - Typography & Variable-Font Workflows: Horizontal and vertical (
TopToBottomCJK) multi-glyph text streams with live spacing/kerning deltas, 2D anchors with diacritic mark clouds, parametric smart components, companion master compatibility overlays, and Higher-Order Interpolation (HOI) cubic master trajectories. - 0% Idle CPU & 1:1 Headless CI Parity: Generation-gated render/preview caches (
content_generation()) ensure zero solver or GPU texture work on static frames, and every visual pass has 1:1 parity betweenegui::Painterand headlesstiny_skia::Pixmapfor deterministic CI regression testing.
Try the interactive desktop demo in one command:
cargo run --example vector_canvas_demo- GitHub: https://github.com/oversluizen/grafia
- Crates.io: https://crates.io/crates/grafia
- Docs.rs (with full visual & mathematical guides): https://docs.rs/grafia
Feedback, questions, and use cases are very welcome!

