Skip to main content

oxframe_2d/
lib.rs

1//! 2D scene graph of oxframe.
2//!
3//! > **Status:** oxframe is under very active development. The API is not stable yet and
4//! > may change from version to version. Pin the exact version in your Cargo.toml and check
5//! > the [changelog](https://github.com/oxygenframe/oxframe-sdk/blob/main/CHANGELOG.md)
6//! > before upgrading.
7//!
8//! Scene code creates nodes with builders (`Rect::new().width(100.0)`) and
9//! adds them with [`Node::add`] (`view.add(..)`), which returns a `Copy`
10//! handle whose zero-argument methods of the same names return
11//! [`Signal`]s:
12//!
13//! ```ignore
14//! let r = view.add(Rect::new().size(200.0).x(-300.0));
15//! r.x().to(300.0, 1.0).await;
16//! ```
17//!
18//! Renderers consume a flat [`DrawItem`] list produced by
19//! [`SceneGraph::draw_list`], so every backend draws exactly the same thing.
20
21#![warn(missing_docs)]
22
23mod builder;
24mod draw;
25mod flex;
26mod graph;
27mod handles;
28mod image;
29mod place;
30mod text;
31mod theme;
32mod trim;
33
34pub use builder::{
35    BaseProps, CameraBuilder, CircleBuilder, CodeBuilder, GridBuilder, GroupBuilder, ImgBuilder,
36    LayoutBuilder, LineBuilder, NodeBuilder, PathBuilder, PolygonBuilder, RectBuilder, StarBuilder,
37    TxtBuilder,
38};
39pub use draw::{DrawItem, Layer, LineCap, LineJoin, Paint, Primitive, Shadow, StrokeStyle};
40pub use graph::{
41    Direction, InspectNode, Justify, LayoutAlign, NodeData, NodeId, NodeKind, SceneGraph,
42};
43pub use handles::{
44    Camera, Circle, Code, Grid, Group, Img, Layout, Line, Node, Path, Polygon, Rect,
45    SLIDE_DISTANCE, Star, Txt, View,
46};
47pub use image::{ImageSource, RasterImage, VectorImage, VectorShape};
48pub use place::{Edge, Percent, Place, SafeArea, Side, Span, pct};
49pub use trim::trim;
50
51pub use oxframe_core::{BlendMode, Color, Gradient, GradientKind, Signal};
52pub use oxframe_text::{Align as TextAlign, Lang, MONO, SANS};
53pub use text::{CodeTheme, RichSpan, span};
54pub use theme::enter as enter_theme;
55pub use theme::{
56    Corner, Ink,
57    Ink::{Accent, Background, Danger, Muted, OnAccent, Success, Surface, Text, Warning},
58    IntoPaint, Len, Motion, Pace,
59    Pace::{Fast, Normal, Slow},
60    Scale, ShadowSpec, Step,
61    Step::{Lg, Md, Sm, Xl, Xs},
62    Theme, TypeRole, TypeScale, TypeStyle,
63};