Skip to main content

Crate fluor

Crate fluor 

Source
Expand description

Fluor — first-principles GUI compositor library.

Named for fluorite (the mineral that gave us “fluorescence” — glows on a band nothing else occupies) and fluere (Latin: to flow — “liquid stone”). Hard substrate of pane geometry + chrome shared across consumers, fluid center-origin coordinates that scale with the viewport.

Every mainstream layout system is pixel-anchored: Android dp, CSS px, WPF DIPs, iOS pt, Flutter dp — all scale factors on a fixed physical reference. Even CSS vmin (the closest “viewport-relative” unit) uses min(w, h) and inherits a discontinuity at the diagonal. Fluor uses harmonic-mean span 2wh/(w+h) as its scaling base, with the origin at the viewport center and +y down. That combination — center-origin + harmonic-mean unit + default convention (not opt-in) — appears to be unoccupied territory among compositors and toolkits.

Built to deduplicate the chrome / paint / pane code currently duplicated across photon, rhe, and mandelbrot-exploder, and to be the eventual compositor for ferros.

Re-exports§

pub use coord::Coord;
pub use coord::RuVec2;
pub use geom::Viewport;
pub use group::Group;
pub use paint::BlendMode;
pub use pane::Compositor;
pub use pane::Pane;
pub use pane::PaneId;
pub use pixel::Argb8;
pub use region::Region;

Modules§

canvas
Drawing surface that bundles a pixel buffer with automatic damage tracking. Every public rasterizer takes a &mut Canvas instead of a bare &mut [u32] + width + height triple; rasterizers report the pixel rectangle they touched into the canvas’s Damage accumulator. Damage is unforgettable because it’s part of what you draw on, not a side parameter — consumer widgets get differential-redraw support automatically.
coord
Center-origin, +y-down 2D coordinates in f32.
event
Platform-neutral event vocabulary.
geom
Viewport geometry: pixel dimensions, derived universal scaling units, and conversions between RU coordinates and integer pixel coordinates.
group
Group — the unit of hit-routable, text-clippable composite.
host
Host backends — adapters between fluor’s Compositor and the platform’s window/framebuffer system.
paint
Pixel-buffer paint primitives. Packed layout is 0xααRRGGBB (α-byte high, blue low) — top byte is α (opacity), industry-standard direction (α = 0 transparent, α = 0xFF opaque). RGB bytes store darkness (0 = white, 255 = black). See crate::pixel for the locked convention. All inputs are pixel-space, not RU — convert via Viewport::ru_to_px before calling.
pane
Panes — the unit of UI in fluor — and the Compositor that owns them.
pixel
Pixel format + blend trait.
region
Proportional layout primitive — unidirectional nesting, no solver.
stack
Stack Notation compositing engine — layers as operands, blend ops as operators.
text
Text rendering — verbatim port of photon’s text_rasterizing.rs. Built on cosmic-text + swash. Bundles Open Sans Regular + Bold (OFL-licensed) so the default fluor build renders text out of the box; consumers can load additional fonts via the font_system_mut() accessor.
theme
Theme constants — colours and geometry shared between paint primitives, chrome, and (eventually) widgets. Sourced from photon’s theme.rs; names match photon exactly so cross-codebase greps work.
widgets
Widget primitives — single-line textbox today, more to come (button, scroll, etc.). Each widget owns its visual + interaction state and renders into a pixel buffer via the shared paint + text infrastructure.