duckOS icon indicating copy to clipboard operation
duckOS copied to clipboard

Window blur

Open byteduck opened this issue 3 years ago • 1 comments

These changes allow windows to apply blur to whatever is behind them via a new window hint. There are currently visual artifacts (such as when moving the cursor by a blurred window) that need to be ironed out, due to the way partial redraws of the display work (essentially, when only part of a blurred window is redrawn, it samples the already-blurred area that's not being redrawn, resulting in a weird double-blur).

The blur is currently done by applying multiple passes of a box blur to approximate a gaussian blur, but if anyone has suggestions for a faster algorithm I'm all ears.

Here's what it currently looks like (The opacity of the terminal background is lower than it will be in the final version to show off the blur): Screenshot 2023-02-23 at 3 10 37 PM

byteduck avatar Feb 23 '23 23:02 byteduck

I made it so that if an area touching a blurred window needs to be redrawn, the entire blurred window is redrawn.

Obviously, this is far from ideal. Really, we'd want to redraw as little as possible. I tried an approach with using a hidden buffer to store the unblurred contents behind the window so that partial redraws are possible without "double-blurring", but, I feel like that's a little memory intensive. What's the best tradeoff here - keeping a whole new buffer for each window, or incurring some extra performance cost?

byteduck avatar Feb 24 '23 05:02 byteduck