Expand description
2D scene graph of oxframe.
Status: oxframe is under very active development. The API is not stable yet and may change from version to version. Pin the exact version in your Cargo.toml and check the changelog before upgrading.
Scene code creates nodes with builders (Rect::new().width(100.0)) and
adds them with Node::add (view.add(..)), which returns a Copy
handle whose zero-argument methods of the same names return
Signals:
ⓘ
let r = view.add(Rect::new().size(200.0).x(-300.0));
r.x().to(300.0, 1.0).await;Renderers consume a flat DrawItem list produced by
SceneGraph::draw_list, so every backend draws exactly the same thing.
Re-exports§
pub use builder::CircleBuilder;pub use builder::CodeBuilder;pub use builder::GridBuilder;pub use builder::GroupBuilder;pub use builder::ImgBuilder;pub use builder::LayoutBuilder;pub use builder::LineBuilder;pub use builder::NodeBuilder;pub use builder::PathBuilder;pub use builder::PolygonBuilder;pub use builder::RectBuilder;pub use builder::StarBuilder;pub use builder::TxtBuilder;pub use graph::Direction;pub use graph::Justify;pub use graph::LayoutAlign;pub use graph::NodeId;pub use graph::SceneGraph;
Structs§
- Circle
- Handle to a
Circlenode in the scene: cheap to copy, its methods return the node’s properties asSignals. Derefs toNode. - Circle
Builder - Builder for a
Circlenode: set the initial values, then pass it toadd. - Code
- Handle to a
Codenode in the scene: cheap to copy, its methods return the node’s properties asSignals. Derefs toNode. - Code
Builder - Builder for a
Codenode: set the initial values, then pass it toadd. - Code
Theme - Colors of a code theme.
- Color
- sRGB color with straight (non-premultiplied) alpha, components in
0..=1. - Draw
Item - One thing to paint, in local coordinates of
transform. Paints already include the node’s opacity (unless the node draws into a layer). - Gradient
- A gradient in the node’s local coordinates (origin at the node center).
- Grid
- Handle to a
Gridnode in the scene: cheap to copy, its methods return the node’s properties asSignals. Derefs toNode. - Grid
Builder - Builder for a
Gridnode: set the initial values, then pass it toadd. - Group
- Handle to a
Groupnode in the scene: cheap to copy, its methods return the node’s properties asSignals. Derefs toNode. - Group
Builder - Builder for a
Groupnode: set the initial values, then pass it toadd. - Img
- Handle to a
Imgnode in the scene: cheap to copy, its methods return the node’s properties asSignals. Derefs toNode. - ImgBuilder
- Builder for a
Imgnode: set the initial values, then pass it toadd. - Layer
- Everything drawn until the matching
Primitive::PopLayeris rendered into its own buffer, filtered, clipped and composited as a whole. - Layout
- Handle to a
Layoutnode in the scene: cheap to copy, its methods return the node’s properties asSignals. Derefs toNode. - Layout
Builder - Places children in a row or column. Children’s
x/ybecome offsets from their layout position. - Line
- Handle to a
Linenode in the scene: cheap to copy, its methods return the node’s properties asSignals. Derefs toNode. - Line
Builder - Builder for a
Linenode: set the initial values, then pass it toadd. - Node
- Untyped node handle with the properties every node has.
- NodeId
- Index of a node in its
SceneGraph. Assigned in creation order, so it is deterministic too. - Path
- Handle to a
Pathnode in the scene: cheap to copy, its methods return the node’s properties asSignals. Derefs toNode. - Path
Builder - Builder for a
Pathnode: set the initial values, then pass it toadd. - Polygon
- Handle to a
Polygonnode in the scene: cheap to copy, its methods return the node’s properties asSignals. Derefs toNode. - Polygon
Builder - Builder for a
Polygonnode: set the initial values, then pass it toadd. - Raster
Image - Decoded raster image: sRGB RGBA8, straight alpha.
- Rect
- Handle to a
Rectnode in the scene: cheap to copy, its methods return the node’s properties asSignals. Derefs toNode. - Rect
Builder - Builder for a
Rectnode: set the initial values, then pass it toadd. - Rich
Span - A run of text with its own look; unset fields use the node’s style.
- Scene
Graph - Arena of nodes for one scene run. Node 0 is the view (root).
- Shadow
- Drop shadow of a layer.
- Signal
- A reactive value.
- Star
- Handle to a
Starnode in the scene: cheap to copy, its methods return the node’s properties asSignals. Derefs toNode. - Star
Builder - Builder for a
Starnode: set the initial values, then pass it toadd. - Stroke
Style - How an outline is drawn.
- Txt
- Handle to a
Txtnode in the scene: cheap to copy, its methods return the node’s properties asSignals. Derefs toNode. - TxtBuilder
- Builder for a
Txtnode: set the initial values, then pass it toadd. - Vector
Image - SVG converted to filled/stroked paths (gradients become their first stop color in v1).
- Vector
Shape - One painted path of a
VectorImage. - View
- Root of a scene. Origin is the center of the frame, y points down.
Enums§
- Blend
Mode - How a node’s layer is composited onto what is below it.
- Direction
- Main axis of a
Layout. - Gradient
Kind - Shape of a
Gradient. - Image
Source - Decoded image data for an
Imgnode. - Justify
- Main-axis distribution of children; only matters with a fixed size.
- Lang
- Language for syntax highlighting.
- Layout
Align - Cross-axis alignment of children in a
Layout. - LineCap
- Shape of the ends of open outlines.
- Line
Join - Shape of outline corners.
- Paint
- What a shape is filled or stroked with.
- Primitive
- A drawing operation in a
DrawItem. - Text
Align - Horizontal alignment of lines.
Constants§
Traits§
- Node
Builder - Describes a node before it is added to the scene.
Functions§
- span
- Shorthand for
RichSpan::new. - trim
- The part of
pathbetween fractionsstartandendof its total length (0 ≤ start ≤ end ≤ 1), as used by thestart/endsignals.