Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement drop shadows using blurring techniques #34

Open
jserv opened this issue Aug 11, 2024 · 1 comment
Open

Implement drop shadows using blurring techniques #34

jserv opened this issue Aug 11, 2024 · 1 comment
Assignees

Comments

@jserv
Copy link
Contributor

jserv commented Aug 11, 2024

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:

weihsinyeh added a commit to weihsinyeh/mado that referenced this issue Oct 6, 2024
Use Pascal's Triangle to approximate a 5x5 Gaussian Kernel, and apply
Gaussian blur on the 'twin_pixmap_t' to implement the blurring
technique.

See: sysprog21#34
weihsinyeh added a commit to weihsinyeh/mado that referenced this issue Oct 6, 2024
Use Pascal's Triangle to approximate a 5x5 Gaussian Kernel, and apply
Gaussian blur on the 'twin_pixmap_t' to implement the blurring
technique.

See: sysprog21#34
weihsinyeh added a commit to weihsinyeh/mado that referenced this issue Oct 6, 2024
Use Pascal's Triangle to approximate a 5x5 Gaussian Kernel, and apply
Gaussian blur on the 'twin_pixmap_t' to implement the blurring
technique.

See: sysprog21#34
weihsinyeh added a commit to weihsinyeh/mado that referenced this issue Oct 6, 2024
Use Pascal's Triangle to approximate a 5x5 Gaussian Kernel, and apply
Gaussian blur on the 'twin_pixmap_t' to implement the blurring
technique.

See: sysprog21#34
@jserv
Copy link
Contributor Author

jserv commented Nov 25, 2024

ctx is a renderer and serialization format for 2D vector graphics, aiming for compatibility with HTML5 Canvas' 2D context. Search CTX_ENABLE_SHADOW_BLUR in ctx repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants