Skip to main content

Crate bymsdfgen_core

Crate bymsdfgen_core 

Source
Expand description

§bymsdfgen-core

The core crate of bymsdfgen, a pure-Rust msdf generator and pure-Rust alternative to msdfgen: generation of conventional and multi-channel signed distance fields from vector shapes, with no C++ toolchain and no FFI.

Design highlights versus the C++ original:

  • Zero-cost dispatch: edges are a Copy geometry::EdgeSegment enum (match) instead of a virtual class hierarchy behind heap pointers.
  • Data-oriented layout: contours store segments in flat, contiguous Vecs.
  • Typed coordinate spaces: math::typed newtypes make space mismatches a compile error rather than a silent logic bug.
  • Fearless parallelism: row-parallel generation via rayon (feature parallel) with compile-time data-race freedom.

Re-exports§

pub use bitmap::Bitmap;
pub use generator::DistanceMapping;
pub use generator::ErrorCorrectionConfig;
pub use generator::ErrorCorrectionMode;
pub use generator::GeneratorConfig;
pub use generator::MsdfGeneratorConfig;
pub use generator::Projection;
pub use generator::SdfTransformation;
pub use generator::generate_msdf;
pub use generator::generate_mtsdf;
pub use generator::generate_psdf;
pub use generator::generate_sdf;
pub use geometry::Bounds;
pub use geometry::Contour;
pub use geometry::EdgeColor;
pub use geometry::EdgeSegment;
pub use geometry::Shape;
pub use math::Range;
pub use math::SignedDistance;
pub use math::Vector2;
pub use raster::FillRule;
pub use raster::Scanline;

Modules§

bitmap
Owning, channel-generic pixel buffer. Port of core/Bitmap.h + BitmapRef.hpp.
coloring
Edge coloring heuristics. Port of core/edge-coloring.cpp.
correction
MSDF error correction. Port of core/MSDFErrorCorrection.cpp and core/msdf-error-correction.cpp (modern, non-legacy path).
distance
Per-edge distance selection and per-contour combination.
generator
Distance-field generation: projection/mapping, configs, and the generators.
geometry
Data-oriented shape geometry: edge segments, contours, shapes.
math
Math foundations: vectors, scalar helpers, signed distance, ranges and the zero-cost coordinate-space newtypes.
raster
Scanline rasterization and sign correction.