vello_common/
lib.rs

1// Copyright 2025 the Vello Authors
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4//! This crate includes common geometry representations, tiling logic, and other fundamental components used by both [Vello CPU][vello_cpu] and Vello Hybrid.
5//!
6//! ## Usage
7//!
8//! This crate should not be used on its own, and you should instead use one of the renderers which use it.
9//! At the moment, only [Vello CPU][vello_cpu] is published, and you probably want to use that.
10//!
11//! We also develop [Vello](https://crates.io/crates/vello), which makes use of the GPU for 2D rendering and has higher performance than Vello CPU.
12//! Vello CPU is being developed as part of work to address shortcomings in Vello.
13//! Vello does not use this crate.
14//!
15//! ## Features
16//!
17//! - `std` (enabled by default): Get floating point functions from the standard library
18//!   (likely using your target's libc).
19//! - `libm`: Use floating point implementations from [libm].
20//! - `png` (enabled by default): Allow loading [`Pixmap`][crate::pixmap::Pixmap]s from PNG images.
21//!   Also required for rendering glyphs with an embedded PNG.
22//!   Implies `std`.
23//! - `simd`: Allows requesting SIMD execution modes.
24//!   Note that SIMD is not yet implemented.
25//!
26//! At least one of `std` and `libm` is required; `std` overrides `libm`.
27//!
28//! ## Contents
29//!
30//! - Shared data structures for paths, tiles, and strips
31//! - Geometry processing utilities
32//! - Common logic for rendering stages
33//!
34//! This crate acts as a foundation for `vello_cpu` and `vello_hybrid`, providing essential components to minimize duplication.
35//!
36//! [vello_cpu]: https://crates.io/crates/vello_cpu
37
38// LINEBENDER LINT SET - lib.rs - v3
39// See https://linebender.org/wiki/canonical-lints/
40// These lints shouldn't apply to examples or tests.
41#![cfg_attr(not(test), warn(unused_crate_dependencies))]
42// These lints shouldn't apply to examples.
43#![warn(clippy::print_stdout, clippy::print_stderr)]
44// Targeting e.g. 32-bit means structs containing usize can give false positives for 64-bit.
45#![cfg_attr(target_pointer_width = "64", warn(clippy::trivially_copy_pass_by_ref))]
46// END LINEBENDER LINT SET
47#![cfg_attr(docsrs, feature(doc_auto_cfg))]
48#![forbid(unsafe_code)]
49#![expect(
50    clippy::cast_possible_truncation,
51    reason = "We temporarily ignore those because the casts\
52only break in edge cases, and some of them are also only related to conversions from f64 to f32."
53)]
54#![no_std]
55
56// Suppress the unused_crate_dependencies lint when both std and libm are specified.
57#[cfg(all(feature = "std", feature = "libm"))]
58use libm as _;
59
60extern crate alloc;
61#[cfg(feature = "std")]
62extern crate std;
63
64pub mod blurred_rounded_rect;
65pub mod coarse;
66#[cfg(feature = "text")]
67pub mod colr;
68pub mod encode;
69pub mod flatten;
70pub(crate) mod flatten_simd;
71#[cfg(feature = "text")]
72pub mod glyph;
73pub mod mask;
74pub mod math;
75pub mod paint;
76#[doc(hidden)]
77#[cfg(feature = "pico_svg")]
78pub mod pico_svg;
79pub mod pixmap;
80pub mod recording;
81pub mod simd;
82pub mod strip;
83pub mod strip_generator;
84pub mod tile;
85pub mod util;
86
87pub use fearless_simd;
88pub use peniko;
89pub use peniko::color;
90pub use peniko::kurbo;