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::{Element, Scope, Type};
28
29/// Hook up all visualize definitions.
30pub(super) fn define(global: &mut Scope) {
31    global.start_category(crate::Category::Visualize);
32    global.define_type::<Color>();
33    global.define_type::<Gradient>();
34    global.define_type::<Tiling>();
35    global.define_type::<Stroke>();
36    global.define_elem::<ImageElem>();
37    global.define_elem::<LineElem>();
38    global.define_elem::<RectElem>();
39    global.define_elem::<SquareElem>();
40    global.define_elem::<EllipseElem>();
41    global.define_elem::<CircleElem>();
42    global.define_elem::<PolygonElem>();
43    global.define_elem::<CurveElem>();
44    global
45        .define("path", Element::of::<PathElem>())
46        .deprecated("the `path` function is deprecated, use `curve` instead");
47    global
48        .define("pattern", Type::of::<Tiling>())
49        .deprecated("the name `pattern` is deprecated, use `tiling` instead");
50    global.reset_category();
51}