Skip to main content

oxideav_scene/
lib.rs

1//! A time-based composition model for oxideav.
2//!
3//! The type surface (scene, objects, animations, time-base) is in
4//! place. The full [`SceneRenderer`] driver is still a stub
5//! ([`StubRenderer`] returns `Error::Unsupported`); concrete
6//! per-object rendering lands here piecemeal. The first real piece
7//! is [`text::TextRenderer`] — it composites a [`TextRun`] onto a
8//! straight-alpha RGBA framebuffer via [`oxideav_scribe`] (TrueType
9//! shaping + scanline rasterisation). The caller supplies the
10//! [`oxideav_scribe::Face`]; scene-level font discovery is out of
11//! scope.
12//!
13//! See [`README.md`](../README.md) for the full design + the three
14//! target use cases (PDF pages, RTMP streaming compositor, NLE
15//! timeline).
16//!
17//! # Quick tour
18//!
19//! ```no_run
20//! use oxideav_scene::{Scene, Canvas, SceneDuration, SceneObject};
21//! use oxideav_core::TimeBase;
22//!
23//! let scene = Scene {
24//!     canvas: Canvas::raster(1920, 1080),
25//!     duration: SceneDuration::Finite(30_000),
26//!     time_base: TimeBase::new(1, 1_000),
27//!     sample_rate: 48_000,
28//!     ..Scene::default()
29//! };
30//! assert_eq!(scene.canvas.raster_size(), Some((1920, 1080)));
31//! ```
32//!
33//! The hierarchy:
34//!
35//! - [`Scene`] — root container. Has a [`Canvas`], a [`SceneDuration`],
36//!   and a vector of [`SceneObject`]s.
37//! - [`SceneObject`] — one element on the scene. Carries a
38//!   [`Transform`], a [`Lifetime`], a list of [`Animation`]s, a blend
39//!   mode + effects chain, and an [`ObjectKind`] payload.
40//! - [`Animation`] — a per-property keyframe track. Each
41//!   [`Keyframe`] pins a value at a point in time; consecutive
42//!   keyframes interpolate via [`Easing`].
43//! - [`AudioCue`] — timeline-triggered audio with an animated volume
44//!   envelope.
45//! - [`SceneRenderer`] / [`SceneSampler`] — traits the renderer
46//!   implements. Current default ([`StubRenderer`]) always returns
47//!   `Error::Unsupported`.
48
49pub mod adapt;
50pub mod animation;
51pub mod audio;
52pub mod duration;
53pub mod id;
54pub mod object;
55pub mod ops;
56pub mod page;
57// `raster` was previously gated behind the `raster` cargo feature; with
58// the round-2 text-pipeline migration `oxideav-raster` is a hard
59// dependency (text rendering goes through it), so the gate is dropped
60// here too. The `raster` cargo feature is preserved as a no-op for
61// back-compat.
62pub mod raster;
63pub mod render;
64pub mod scene;
65pub mod source;
66pub mod text;
67
68pub use adapt::{adapt_frame_to, adapt_frame_to_canvas, AdaptedSource};
69pub use animation::{AnimatedProperty, Animation, Easing, Keyframe, KeyframeValue, Repeat};
70pub use audio::{AudioCue, AudioSource, DuckBus};
71pub use duration::{Lifetime, SceneDuration, TimeStamp};
72pub use id::ObjectId;
73pub use object::{
74    BlendMode, Canvas, ClipRect, Effect, ImageSource, LengthUnit, LiveStreamHandle, ObjectKind,
75    SceneObject, Shape, TextRun, Transform, VideoSource,
76};
77pub use ops::{ExportOp, Operation};
78pub use page::Page;
79pub use raster::rasterize_vector;
80pub use render::{RenderedFrame, SceneRenderer, SceneSampler, StubRenderer};
81pub use scene::{Background, Metadata, Scene};
82pub use source::{drive, FnSink, NullSink, RenderedSource, SceneSink, SceneSource, SourceFormat};
83pub use text::TextRenderer;