typst_library/visualize/
mod.rs

1//! Drawing and visualization.
2
3mod color;
4mod curve;
5mod gradient;
6mod image;
7mod line;
8mod paint;
9mod path;
10mod polygon;
11mod shape;
12mod stroke;
13mod tiling;
14
15pub use self::color::*;
16pub use self::curve::*;
17pub use self::gradient::*;
18pub use self::image::*;
19pub use self::line::*;
20pub use self::paint::*;
21pub use self::path::*;
22pub use self::polygon::*;
23pub use self::shape::*;
24pub use self::stroke::*;
25pub use self::tiling::*;
26
27use crate::foundations::Deprecation;
28use crate::foundations::{Element, Scope, Type};
29
30/// Hook up all visualize definitions.
31pub(super) fn define(global: &mut Scope) {
32    global.start_category(crate::Category::Visualize);
33    global.define_type::<Color>();
34    global.define_type::<Gradient>();
35    global.define_type::<Tiling>();
36    global.define_type::<Stroke>();
37    global.define_elem::<ImageElem>();
38    global.define_elem::<LineElem>();
39    global.define_elem::<RectElem>();
40    global.define_elem::<SquareElem>();
41    global.define_elem::<EllipseElem>();
42    global.define_elem::<CircleElem>();
43    global.define_elem::<PolygonElem>();
44    global.define_elem::<CurveElem>();
45    global.define("path", Element::of::<PathElem>()).deprecated(
46        Deprecation::new()
47            .with_message("the `path` function is deprecated, use `curve` instead"),
48    );
49    global.define("pattern", Type::of::<Tiling>()).deprecated(
50        Deprecation::new()
51            .with_message("the name `pattern` is deprecated, use `tiling` instead")
52            .with_until("0.15.0"),
53    );
54    global.reset_category();
55}