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 - v4
16// See https://linebender.org/wiki/canonical-lints/
17// These lints shouldn't apply to examples or tests.
18#![cfg_attr(not(test), warn(unused_crate_dependencies))]
19// These lints shouldn't apply to examples.
20#![warn(clippy::print_stdout, clippy::print_stderr)]
21// Targeting e.g. 32-bit means structs containing usize can give false positives for 64-bit.
22#![cfg_attr(target_pointer_width = "64", warn(clippy::trivially_copy_pass_by_ref))]
23// END LINEBENDER LINT SET
24#![cfg_attr(docsrs, feature(doc_cfg))]
25#![no_std]
26
27mod blend;
28mod brush;
29mod gradient;
30mod image;
31mod style;
32
33#[cfg(feature = "bytemuck")]
34mod impl_bytemuck;
35
36/// Re-export of the color library.
37pub use color;
38
39/// Re-export of the kurbo 2D curve library.
40pub use kurbo;
41
42/// Re-export of the linebender resource handle library types.
43pub use linebender_resource_handle::{self, Blob, FontData, WeakBlob};
44
45pub use blend::{BlendMode, Compose, Mix};
46pub use brush::{Brush, BrushRef, Extend};
47pub use gradient::{
48 ColorStop, ColorStops, ColorStopsSource, Gradient, GradientKind, InterpolationAlphaSpace,
49 LinearGradientPosition, RadialGradientPosition, SweepGradientPosition,
50};
51pub use image::{
52 ImageAlphaType, ImageBrush, ImageBrushRef, ImageData, ImageFormat, ImageQuality, ImageSampler,
53};
54pub use style::{Fill, Style, StyleRef};
55
56/// A convenient alias for the color type used for [`Brush`].
57pub type Color = color::AlphaColor<color::Srgb>;