Gala: Blend mode that increases saturation under areas of low value

Created on 26 Oct 2020  路  4Comments  路  Source: elementary/gala

Problem

Currently shadows overlay black. This only affects value but does not affect saturation as shadows in real life would:

screen2

Proposal

It would be pretty sweet if we could increase saturation under shadows so that they would be tinted with the color of what's beneath them and look more true to life:

screen1

Wishlist Needs Design

Most helpful comment

I made you a dumb example doing this with 2 shadows and simple blending modes in CSS. Not sure you really need a custom shader. Its definitely not flawless but it might be a simple place to start.

https://codepen.io/jassmith87/pen/ExyWgav

All 4 comments

I made you a dumb example doing this with 2 shadows and simple blending modes in CSS. Not sure you really need a custom shader. Its definitely not flawless but it might be a simple place to start.

https://codepen.io/jassmith87/pen/ExyWgav

I don't think this is a feasible thing to do in gala at least partially. Shadows in Gtk3 are being drawn by the client itself, not the WM.
If we were to do it just here in gala we would need to:

  1. Render the window to some offscreen framebuffer first.
  2. Either:
  3. Render our own shadow first. Then render just the window area of the offscreen buffer to the screen (if rectangular it would leave artrifacts on windows with rounded edges).
  4. Apply & composite a shader to the buffer with a mask, which still has the same issue with rounded corners, unless we specifically make the assumption that the rounded corners are always present in all windows.

Both methods assume a lot about how a window looks like but this cannot be fixed either in mutter, because of the chosen architecture by Gtk.

I don't think this is a feasible thing to do in gala at least partially. Shadows in Gtk3 are being drawn by the client itself, not the WM.
If we were to do it just here in gala we would need to:

1. Render the window to some offscreen framebuffer first.

2. Either:


* Render our own shadow first. Then render just the window area of the offscreen buffer to the screen (if rectangular it would leave artrifacts on windows with rounded edges).

* Apply & composite a shader to the buffer with a mask, which still has the same issue with rounded corners, unless we specifically make the assumption that the rounded corners are always present in all windows.

Both methods assume a lot about how a window looks like but this cannot be fixed either in mutter, because of the chosen architecture by Gtk.

I thought Gala used it's own shadows anyway, hence the odd incompatabilites of the stylesheet with other WMs. (I haven't tried it with the new stylesheet though)

I thought Gala used it's own shadows anyway

No, shadows are client-side in the GTK stylesheet, and rendered by GTK.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peteruithoven picture peteruithoven  路  3Comments

worldofpeace picture worldofpeace  路  3Comments

hanaral picture hanaral  路  4Comments

bencemozsar picture bencemozsar  路  3Comments

brigazvi picture brigazvi  路  3Comments