-
Notifications
You must be signed in to change notification settings - Fork 20
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
Window shadows? #4
Comments
Technically, it's possible, I simply did not have enough motivation to work on it, and opted for a simple 1px border instead. We would have to draw a gradient on all 4 edges, cache it, so it does not get redrawn on every resize (we are software rendered), and update only edges that were affected by the resize. |
I'd take a look at this. Is there any good docs on how to draw gradients? (i have some expirience with rust, just underlated to rendering things). |
You would most likely use tiny_skia::Shader with tiny skia fill_rect() You'd have to render that in top surface/texture Lines 401 to 410 in 0cae30e
Left one: Lines 521 to 540 in 0cae30e
Right one: Lines 564 to 575 in 0cae30e
Bottom one: Lines 470 to 478 in 0cae30e
Basically, there is a texture per edge. |
It's cumbersome to make comfortable shadows, I thought, maybe it would be easier to pre-render and hardcode into the code? |
Currently i don't have much time to spare for this, but if anyone wants to give it a try, it would be great. |
i tried this (here) and it seems to work for basic cases but
idk how to make these better really (especially the first two, which makes me think this is actually.. unusable) |
It looks good, and if that issue with resize handles can be resolved, it would be usable. I think issue with small windows can be ignored for now. Looks like libdecor is ready: kovidgoyal/kitty#3284 (comment), but i haven't seen rust integration. So, we can use this until we have better options. |
I seem to have a little idea, maybe we can set a threshold, and when it is less than this threshold, only the shadows of the four corners are drawn instead of the shadows of the four sides, so as to prevent the overlap problem, can this be achieved? Or we can be more straightforward and stop drawing shadows directly when the window is too small. |
I had a go at this in #43, feedback appreciated. |
Hello.
Recently sctk-adwaita support was added to winit (rust-windowing/winit#1967), and i checked it, looks great. Thank you for this project.
Is there a way to add shadows for a window?
The text was updated successfully, but these errors were encountered: