1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#![deny(warnings)]
#![allow(clippy::not_unsafe_ptr_arg_deref)]
#![doc(
    html_logo_url = "https://raw.githubusercontent.com/nongio/layers/refs/heads/main/assets/LayersEngine-dark.png"
)]

//! # Layers Engine
//!
//! **Layers** is an animation and rendering engine designed for user interfaces.
//! It utilizes a scene graph for efficient, retained mode rendering of UI elements,
//! optimizing common interpolations such as opacity, 2D transformations, and blending.
//!
//! ## Key Features
//!
//! - **Scene Graph**: Manages nodes (graphical layers) including text, simple shapes (e.g., rectangles), and external textures.
//! - **Animatable Properties**: Nodes have properties that can be animated, with changes scheduled and executed by the engine using a Command pattern. This ensures a consistent API for both immediate and animated changes.
//! - **Optimized Rendering**: Uses a display list for efficient rendering commands.
//! - **Animation Hooks**: The API exposes hooks at different stages of the animation progress.
//! - **Layout Engine**: Uses the Taffy library for layout calculations.
//! - **Multi-threaded**: Supports concurrent updates to layer properties.
//! - **Spring Physics Animations**: Supports spring physics for animations.
//! - **Easing Functions**: Includes a variety of easing functions for animations.
//! - **Incremental Rendering**: Only redraws the portions of the scene that have changed.
//! - **Debugger**: The engine has a built-in debugger for visualizing the scene graph
//!
//! ## Layer
//!
//! A `Layer` is a 2D object in the engine with the following capabilities:
//!
//! - **Rasterized Content**: Can contain rasterized images or be a container for other layers.
//! - **Transformations**: Supports positioning, rotation, scaling, and animation.
//! - **Nesting**: Layers can be nested to create complex 2D objects, similar to the DOM in web browsers.
//! - **Drawing Properties**: Includes properties such as border, background, shadow, and opacity.
//!
//! ## Rendering Model
//!
//! - **Retained Mode**: The engine maintains a tree of layers and only redraws those that have changed.
//! - **Display List**: Uses a display list to optimize rendering commands.
//! - **Damage tracking**: On every update, the damage of the scene is calculated.
//!
//! ## Multi-threaded Support
//!
//! - **Concurrent Updates**: Layer properties are updated across multiple threads.
//!
//! ## Backend Support (Skia)
//!
//! - **Drawing Library**: Uses the Skia library.
//! - **Supported Backends**:
//!   - **OpenGL**: Using FBO (Framebuffer Objects)
//!   - **EGL**: For OpenGL ES contexts
//!   - **Image**: For testing purposes
//!
//! ## Taffy Layout
//!
//! - **Layout Engine**: Utilizes the Taffy library, based on the Flexbox model.
//!

pub mod api;
pub mod drawing;
mod easing;
pub mod engine;
mod layers;
pub mod prelude;
pub mod renderer;
pub mod types;
pub mod utils;
pub mod view;

#[cfg(feature = "export-skia")]
pub extern crate skia_bindings as sb;
#[cfg(feature = "export-skia")]
pub extern crate skia_safe as skia;
#[cfg(feature = "export-taffy")]
pub extern crate taffy;