Skip to main content

bymsdfgen_core/
lib.rs

1//! # bymsdfgen-core
2//!
3//! The core crate of `bymsdfgen`, a **pure-Rust msdf generator** and pure-Rust
4//! alternative to msdfgen: generation of conventional and multi-channel signed
5//! distance fields from vector shapes, with no C++ toolchain and no FFI.
6//!
7//! Design highlights versus the C++ original:
8//! - **Zero-cost dispatch**: edges are a `Copy` [`geometry::EdgeSegment`] enum
9//!   (`match`) instead of a virtual class hierarchy behind heap pointers.
10//! - **Data-oriented layout**: contours store segments in flat, contiguous `Vec`s.
11//! - **Typed coordinate spaces**: [`math::typed`] newtypes make space mismatches a
12//!   compile error rather than a silent logic bug.
13//! - **Fearless parallelism**: row-parallel generation via rayon (feature
14//!   `parallel`) with compile-time data-race freedom.
15
16pub mod bitmap;
17pub mod coloring;
18pub mod correction;
19pub mod distance;
20pub mod generator;
21pub mod geometry;
22pub mod math;
23pub mod raster;
24
25pub use bitmap::Bitmap;
26pub use generator::{
27    DistanceMapping, ErrorCorrectionConfig, ErrorCorrectionMode, GeneratorConfig,
28    MsdfGeneratorConfig, Projection, SdfTransformation, generate_msdf, generate_mtsdf,
29    generate_psdf, generate_sdf,
30};
31pub use geometry::{Bounds, Contour, EdgeColor, EdgeSegment, Shape};
32pub use math::{Range, SignedDistance, Vector2};
33pub use raster::{FillRule, Scanline};