skia_engine_core/lib.rs
1//! Core element types and Skia rendering for `skia-engine`.
2//!
3//! Build an [`ElementNode`] tree from the node property types in [`nodes`],
4//! create a Skia canvas, and draw the tree with [`renderer::render_tree`].
5pub mod nodes;
6pub mod renderer;
7
8/// A renderable UI element.
9///
10/// Containers own child elements; image, rectangle, and text nodes are leaves.
11pub enum ElementNode {
12 /// A layout container that can draw a background and render child elements.
13 Container {
14 /// Size, position, alignment, and appearance of the container.
15 props: nodes::container::Props,
16 /// Child elements, rendered in vector order.
17 children: Vec<ElementNode>,
18 },
19 /// An image loaded from a local file or, when an HTTP client feature is
20 /// enabled, a URL.
21 Image {
22 /// Size, position, source, sampling, and appearance of the image.
23 props: nodes::image::Props,
24 },
25 /// A filled rectangle.
26 Rect {
27 /// Size, position, alignment, fill color, and corner radius.
28 props: nodes::rect::Props,
29 },
30 /// Text rendered from a string.
31 Text {
32 /// Font, layout, position, alignment, color, and overflow settings.
33 props: nodes::text::Props,
34 /// Text content rendered by the node.
35 content: &'static str,
36 },
37}