Skip to main content

Module drop_shadow

Module drop_shadow 

Source
Expand description

Drop shadow filter implementation.

This implements the feDropShadow primitive from SVG Filter Effects 2. The drop shadow effect is a shorthand for a commonly used sequence of filter operations:

  1. Extract alpha channel
  2. Offset the alpha
  3. Blur the offset alpha
  4. Composite shadow color with blurred alpha
  5. Composite shadow with original graphic

@see https://drafts.fxtf.org/filter-effects-2/#feDropShadowElement

Functions§

apply_drop_shadow 🔒
Apply drop shadow effect.
compose_src_over 🔒
Composite two pixels using Porter-Duff “source over” operator.
norm_to_u8 🔒
Convert a normalized f32 (0.0-1.0) to u8 color component (0-255).
src_over_channel 🔒
Blend a single channel using Porter-Duff “source over” operator.
u8_to_norm 🔒
Convert a u8 color component (0-255) to normalized f32 (0.0-1.0).
write_colored_shadow 🔒
Apply the shadow color and optionally composite with the original.