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 icon;
29mod image;
30#[cfg(feature = "math")]
31mod math;
32pub mod node_api;
33mod passes;
34mod place;
35pub mod post;
36mod scale;
37mod shader;
38mod sim;
39mod svg;
40mod text;
41mod theme;
42mod trim;
43pub mod video;
44mod wgsl_cpu;
45pub use video::{VideoInfo, VideoSource, set_video_opener};
46
47pub use builder::{
48    BaseProps, CameraBuilder, CircleBuilder, CodeBuilder, CustomBuilder, EffectBuilder,
49    GridBuilder, GroupBuilder, ImgBuilder, LayoutBuilder, LineBuilder, NodeBuilder,
50    ParticlesBuilder, PathBuilder, PolygonBuilder, RectBuilder, ShaderBuilder, StarBuilder,
51    TxtBuilder, VideoBuilder,
52};
53pub use builder::{lens_drops, ripple, waves};
54pub use draw::{
55    DrawCtx, DrawItem, DrawRng, Layer, LineCap, LineJoin, Paint, Pen, Primitive, Shadow,
56    StrokeStyle,
57};
58pub use graph::{
59    Direction, InspectNode, Justify, LayoutAlign, NodeData, NodeId, NodeKind, SceneGraph, add_site,
60};
61pub use handles::{
62    Camera, Circle, Code, CodeText, CodeTween, Custom, Effect, Grid, Group, Img, Layout, Line,
63    Node, Particles, Path, Polygon, Rect, SLIDE_DISTANCE, Shader, Star, Svg, Txt, Video, View,
64};
65pub use icon::{Icon, IconBuilder, IconStyle};
66pub use image::{ImageSource, RasterImage, VectorImage, VectorShape};
67#[cfg(feature = "math")]
68pub use math::{Math, MathBuilder};
69pub use node_api::Draw;
70pub use passes::{Pass, PassKind, layer_fingerprint, pass_graph, shadow_fingerprint};
71pub use place::{Edge, Percent, Place, SafeArea, Side, Span, pct};
72pub use post::{Input, Shade, ShadeOp, apply as apply_shade, apply_with as apply_shade_with};
73pub use scale::{IntoScale, ScaleSignal};
74pub use shader::CustomShade;
75pub use shader::{ShaderDiag, draft_shaders, set_frame_rate, set_shader_budget_ms};
76pub use trim::trim;
77
78pub use oxframe_core::{BlendMode, Color, Gradient, GradientKind, Signal};
79pub use oxframe_text::{Align as TextAlign, Lang, MONO, SANS};
80pub use text::{CodeTheme, RichSpan, span};
81/// Theme of the scene that is running, or the dark theme outside one.
82pub use theme::current as current_theme;
83pub use theme::enter as enter_theme;
84pub use theme::{
85    Corner, Ink,
86    Ink::{Accent, Background, Danger, Muted, OnAccent, Success, Surface, Text, Warning},
87    IntoPaint, Len, Motion, Pace,
88    Pace::{Fast, Normal, Slow},
89    Scale, ShadowSpec, Step,
90    Step::{Lg, Md, Sm, Xl, Xs},
91    Theme, TypeRole, TypeScale, TypeStyle,
92};