peniko/
lib.rs

1// Copyright 2022 the Peniko Authors
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4//! A Rust 2D graphics type library
5//!
6//! The `peniko` library builds on top of [`kurbo`] and [`color`] and provides a set of
7//! generic types that define styles for rendering and composition.
8//!
9//! The name "peniko" is Esperanto for "brush" which is one family of types that the library
10//! contains.
11//!
12//! [`kurbo`]: https://crates.io/crates/kurbo
13//! [`color`]: https://crates.io/crates/color
14
15// LINEBENDER LINT SET - lib.rs - v1
16// See https://linebender.org/wiki/canonical-lints/
17// These lints aren't included in Cargo.toml because they
18// shouldn't apply to examples and tests
19#![warn(unused_crate_dependencies)]
20#![warn(clippy::print_stdout, clippy::print_stderr)]
21// END LINEBENDER LINT SET
22#![cfg_attr(docsrs, feature(doc_cfg))]
23#![no_std]
24#![expect(
25    clippy::exhaustive_enums,
26    reason = "Most of the enums are correctly exhaustive as this is a vocabulary crate."
27)]
28
29mod blend;
30mod brush;
31mod gradient;
32mod image;
33mod style;
34
35#[cfg(feature = "bytemuck")]
36mod impl_bytemuck;
37
38/// Re-export of the color library.
39pub use color;
40
41/// Re-export of the kurbo 2D curve library.
42pub use kurbo;
43
44/// Re-export of the linebender resource handle library types.
45pub use linebender_resource_handle::{self, Blob, FontData, WeakBlob};
46
47pub use blend::{BlendMode, Compose, Mix};
48pub use brush::{Brush, BrushRef, Extend};
49pub use gradient::{
50    ColorStop, ColorStops, ColorStopsSource, Gradient, GradientKind, InterpolationAlphaSpace,
51    LinearGradientPosition, RadialGradientPosition, SweepGradientPosition,
52};
53pub use image::{
54    ImageAlphaType, ImageBrush, ImageBrushRef, ImageData, ImageFormat, ImageQuality, ImageSampler,
55};
56pub use style::{Fill, Style, StyleRef};
57
58/// A convenient alias for the color type used for [`Brush`].
59pub type Color = color::AlphaColor<color::Srgb>;