Skip to main content

Module shadow

Module shadow 

Source
Expand description

Box shadow via separable 1-D Gaussian blur with a kernel cache. Box-shadow via separable 1-D Gaussian blur with a cached kernel.

A drop shadow is rendered by:

  1. Painting the shadow rectangle at (rect + offset) in the shadow colour.
  2. Extracting the alpha channel of that rectangle.
  3. Applying a separable horizontal + vertical Gaussian blur to the alpha.
  4. Compositing the blurred shadow alpha under the framebuffer content.

All operations are pure Rust — no SIMD, no FFT, no external crates.

Structs§

GaussianCache
A cache that stores pre-computed Gaussian kernels keyed by blur-radius bits.

Functions§

box_shadow
Render a drop (or inset) box shadow for a rectangle rect into fb.
gaussian_blur_alpha
Apply a separable Gaussian blur to the alpha channel of a rectangular region within alpha (a flat width × height f32 buffer).
gaussian_kernel
Compute a normalised 1-D Gaussian kernel with sigma = blur_radius / 2.