Skip to main content

Crate fenestra_shell

Crate fenestra_shell 

Source
Expand description

OS glue for fenestra: the winit + wgpu windowed runner and the headless renderer. Everything that touches a display server lives here; fenestra-core and fenestra-kit stay windowless.

Re-exports§

pub use vello;
pub use vello::wgpu;
pub use winit;

Modules§

testing
PNG golden testing: tolerance-based image comparison with an update mode, used by every visual test in the workspace.

Structs§

Embedded
A fenestra app embedded in a caller-owned wgpu world. See the module docs for the contract.
EventResponse
What the embedded UI did with one window event.
Harness
A headless app under test. See the module docs for the model.
Headless
A reusable offscreen renderer. Creating one compiles vello’s shaders, so tests should create it once and render many scenes through it.
OsClipboard
Lazy arboard wrapper; failures (no display server) degrade to a no-op.
ScenarioError
A failed step (or a parse failure, step: None), with enough context to fix the scenario without re-running it.
ScenarioReport
What a successful run did.
WindowOptions
Options for the application window.

Enums§

ShellError
Errors from the windowed or headless runners.
SyntheticEvent
A scripted input event for render_app.

Constants§

MAX_FILM_FRAMES
Hard ceiling on frames in Harness::film: a filmstrip is meant for an agent to review in one sitting, and every frame is a full GPU render — this many already takes seconds and produces a strip nobody reviews at a glance. Clamp-over-panic: a hostile or mistaken huge request degrades to this ceiling instead of hanging or exhausting memory rendering it.
MAX_FILM_INTERVAL_MS
Hard ceiling on interval_ms in Harness::film: a span this long turns “watch a transition play” into unrelated snapshots minutes apart. Chain several film calls (or pump between them) to cover a longer timeline at a sensible cadence.

Functions§

apply_element_filter
Applies a foreground ElementFilter to img, deterministically. A blur radius is interpreted in the image’s own (physical) pixels — the caller scales a logical radius first. Brightness and saturation are per-pixel ops that preserve alpha.
box_blur_rgba8
A deterministic Gaussian-approximating blur: three passes of an integer box blur of the given radius (the standard 3-box ≈ Gaussian construction). Edges clamp (samples past an edge repeat the edge pixel). A radius of 0 (or an empty image) returns the input unchanged.
process_specs
Filters each spec’s region of the read-back backdrop, returning the image the final pass draws for that element (keyed by WidgetId). scale maps a spec’s logical rect — and a foreground blur’s logical radius — onto the physical backdrop. Regions that clamp to nothing (off-screen or zero-size) are skipped, so a missing entry simply means “paint normally”.
render_app
Drives an app headlessly: dispatches each event against the current view, applies the emitted messages, then renders one settle frame. Deterministic: scale 1.0, reduced motion, embedded fonts only. The requested size is clamped to the device-supported range (at least 1x1, at most the maximum texture dimension).
render_element
Renders an element tree headlessly at scale factor 1.0 over the theme background, using only the embedded fonts for determinism. This is fenestra’s product thesis: agents render what they build and look at it.
render_element_over
Renders an element tree over a caller-supplied base color at a scale factor — the entry point for offline frame samplers (fenestra-motion) and any render that needs real alpha: Color::TRANSPARENT keeps empty canvas at alpha 0 (note vello output is premultiplied; un-premultiply before writing straight-alpha formats).
render_element_with
Like render_element, but with caller-provided Fonts, so design languages can register Display/Serif faces (Fonts::register) and render through them. The requested size is clamped like render_element’s.
render_element_with_state
Like render_element, but with caller-provided retained state, so tests can render scrolled (and later focused/hovered) configurations. The requested size is clamped like render_element’s.
run_app
Runs an App: the full Elm-shaped loop with hit testing, hover/active/ focus, keyboard navigation, message dispatch, and event-driven repaint (animation frames only while something animates). Calls App::init with a fenestra_core::Proxy before the first frame; proxied messages wake the loop and repaint. Blocks until the window closes.
run_scenario
Runs a JSON scenario against the harness. Screenshots from shot steps land in shots_dir as <name>.png.
run_scene
Opens a window and repaints via paint(scene, logical_w, logical_h, bg) on every redraw. Blocks until the window closes. Low-level escape hatch; element views should prefer run_static (or the M4 App runner).
run_static
Opens a window showing a message-free element view. The view is rebuilt on every redraw; scroll state persists in a FrameState. Blocks until the window closes.
with_fonts
Runs f with the process-wide embedded-only font system used by all headless rendering.
with_headless
Runs f with a process-wide shared Headless renderer. Creating a renderer compiles vello’s shaders, so tests share one.