tiny_skia/
lib.rs

1/*!
2`tiny-skia` is a tiny [Skia](https://skia.org/) subset ported to Rust.
3
4`tiny-skia` API is a bit unconventional.
5It doesn't look like cairo, QPainter (Qt), HTML Canvas or even Skia itself.
6Instead, `tiny-skia` provides a set of low-level drawing APIs
7and a user should manage the world transform, clipping mask and style manually.
8
9See the `examples/` directory for usage examples.
10*/
11
12#![no_std]
13#![warn(missing_docs)]
14#![warn(missing_copy_implementations)]
15#![warn(missing_debug_implementations)]
16#![allow(clippy::approx_constant)]
17#![allow(clippy::clone_on_copy)]
18#![allow(clippy::collapsible_else_if)]
19#![allow(clippy::collapsible_if)]
20#![allow(clippy::comparison_chain)]
21#![allow(clippy::enum_variant_names)]
22#![allow(clippy::excessive_precision)]
23#![allow(clippy::identity_op)]
24#![allow(clippy::manual_range_contains)]
25#![allow(clippy::needless_range_loop)]
26#![allow(clippy::too_many_arguments)]
27#![allow(clippy::wrong_self_convention)]
28
29#[cfg(not(any(feature = "std", feature = "no-std-float")))]
30compile_error!("You have to activate either the `std` or the `no-std-float` feature.");
31
32#[cfg(feature = "std")]
33extern crate std;
34
35extern crate alloc;
36
37mod alpha_runs;
38mod blend_mode;
39mod blitter;
40mod color;
41mod edge;
42mod edge_builder;
43mod edge_clipper;
44mod fixed_point;
45mod geom;
46mod line_clipper;
47mod mask;
48mod math;
49mod path64;
50mod path_geometry;
51mod pipeline;
52mod pixmap;
53mod scan;
54mod shaders;
55mod wide;
56
57mod painter; // Keep it under `pixmap` for a better order in the docs.
58
59pub use blend_mode::BlendMode;
60pub use color::{Color, ColorU8, PremultipliedColor, PremultipliedColorU8};
61pub use color::{ALPHA_OPAQUE, ALPHA_TRANSPARENT, ALPHA_U8_OPAQUE, ALPHA_U8_TRANSPARENT};
62pub use mask::{Mask, MaskType};
63pub use painter::{FillRule, Paint};
64pub use pixmap::{Pixmap, PixmapMut, PixmapRef, BYTES_PER_PIXEL};
65pub use shaders::{FilterQuality, GradientStop, PixmapPaint, SpreadMode};
66pub use shaders::{LinearGradient, Pattern, RadialGradient, Shader};
67
68pub use tiny_skia_path::{IntRect, IntSize, NonZeroRect, Point, Rect, Size, Transform};
69pub use tiny_skia_path::{LineCap, LineJoin, Stroke, StrokeDash};
70pub use tiny_skia_path::{Path, PathBuilder, PathSegment, PathSegmentsIter, PathStroker};
71
72/// An integer length that is guarantee to be > 0
73type LengthU32 = core::num::NonZeroU32;