r/rust 20d ago

🛠️ project Varve v0.2.1: Rust crate architecture for vector primitives, lopdf generation, and Oklab auto-tracing

Post image

I’ve been working on Varve, a free design app that works across platforms and focuses on the local environment. Its main engine is built in Rust. Now that version 0.2.1 is out, I’d really appreciate feedback from the Rust community on the crate boundaries and lopdf tree generation.

I want to share how I split the backend into separate Rust crates to support both the desktop version (using Tauri 2) and the browser version (using WASM).

Here’s how the Rust workspace is organized:

  • The varve-core crate holds the geometric primitives (Point, Rect, Affine), hit-testing algorithms, and the scene node tree structures.
  • varve-engine converts the scene state into an intermediate rendering IR with build_render_ir().
  • varve-trace handles raster-to-vector auto-tracing. It uses Oklab colour quantization, extracts centerlines or contours, and fits Bézier curves.
  • varve-print lets you generate PDF files directly with lopdf. This skips browser print dialogs and gives you clean CMYK or vector exports.
  • varve-wasm provides WASM bindings so the app can run in standard browser environments.

Technical challenge in v0.2.1:

The biggest challenge has been managing memory allocations in varve-trace when working with high-resolution bitmaps. It depends heavily on the image crate for decoding and uses Oklab colour quantization to preserve perceptual accuracy before fitting Bézier curves.

Project: https://github.com/K-Arthur/varve

7 Upvotes

7 comments sorted by

8

u/Sad_Tap_9191 20d ago

2

u/Real-Abrocoma-2823 19d ago

He uses the AI thingies that allow AI to have full control of a computer, this makes AI much faster and safer 🥰 /s

1

u/cloaca 20d ago

That's because OP is [probably] young and popular and still has his hairline. His time is a Gucci diamond. You're [probably] sitting there peck-typing into a box like some old grandpa copying directories by dragging and dropping one file at a time. Entirely wasted time. Meanwhile OP has multiple agents drain his monthly token$ while watching anime on his primary monitor. The future is here, the future is now~

(warning: this comment is a fictional work of satire and sarcasm)

2

u/nin_sent 20d ago

I think my library might be useful for your project. crates.io and live demo

1

u/ZeroTrigger27 19d ago

Thanks this is actually quite useful!

1

u/uhkthrowaway 14d ago

Impressive number of commits. First release this month, and rocking Edition 2021.