sysprog21/mado

Implement drop shadows using blurring techniques

Opened this issue · 0 comments

Drop shadow is one of the most popular visual effects rendered in modern window systems and compositing window managers. Gaussian blur works by setting the value of each pixel in the active layer or selection to the average of all pixel values within a defined radius. A higher radius value will produce a greater amount of blur. This task aims to create the graphical effect of a visually elevated shape with a shadow underneath the window frame, managed by the built-in window management system. In other words, an additional operation redirects all windows to offscreen pixmaps and tracks when painting occurs on those offscreen pixmaps, adding the drop shadow effect.

image
(An experimental popup modifier theme that incorporates blurring, alpha blending, gradients, and a drop shadow, taken from PicoGUI.)

The stack blur algorithm was invented by Mario Klingemann. Compared to Mario's original source code, the lookup table in lasem has been removed as the benefit doesn't justify the memory usage in cases of large radii. See also:

Expected Outcome:
A polished drop shadow effect that enhances the window rendering of Mado, with minimal performance overhead and flexibility to customize the appearance.

Reference implementations: