Skip to main content

Crate solium_effects

Crate solium_effects 

Source
Expand description

Solium’s vertex deformations: the shapes a rectangle cannot hold.

A genie, a fold, a curl, a page turn. Each is a named function with parameters saying where a point of a window’s unit square is drawn, and how finely the window has to be cut for the result to read as a curve rather than as a fan of flat pieces. Everything else – capture, projection, damage, blending between two of them – is the same code for all of them and lives in the compositor.

§Why this is a crate and not a shader

Two reasons, both hard, both in docs/design/2026-09-12-panes-and-effects-design.md:

  • The damage tracker needs the deformed bounding box before anything is drawn, and a shader cannot tell it one. A wrong damage rect is a corrupt screen; a wrong fragment shader is only a wrong picture.
  • An effect you can only judge by launching a compositor is an effect nobody tunes. Everything here is arithmetic on f64, so the same code that bends real windows is driven by the unit tests below and by the preview page in preview/ with live sliders.

§What it deliberately does not know

What a pane is. The two rectangles a deformation morphs between arrive already resolved: this crate is handed numbers, and the compositor is what turns “the dock icon” into a rectangle, once per frame. See Deform::place.

use solium_effects::{Axis, Deform, Rect};

let window = Rect::new(0.0, 0.0, 800.0, 600.0);
let icon = Rect::new(400.0, 1000.0, 64.0, 32.0);
let genie = Deform::Genie { progress: 1.0, spread: 1.0, axis: Axis::Down };

// All the way in: every corner of the window is inside the icon.
let (x, y) = genie.place(window, icon, 0.0, 0.0);
assert!((x - icon.x).abs() < 1e-9 && (y - icon.y).abs() < 1e-9);

Modules§

ffi
A C ABI over the deformations, so they can be called from outside Rust.
fragment
What an effect reads, which is what decides whether a frame needs a pass.

Structs§

Rect
A rectangle, in whatever coordinates the caller is using.

Enums§

Axis
Which way an effect sweeps across the window.
Deform
A deformation a rectangle cannot express.

Traits§

Params
Where an effect’s parameters come from.

Functions§

lerp 🔒
Interpolate between two values.
number 🔒
One parameter, narrowed to what a vertex function needs.
tidy 🔒
One name, in the form a lookup compares.