aboutsummaryrefslogtreecommitdiff
path: root/src/window
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-07-16 10:22:03 +0300
committerGitHub <noreply@github.com>2024-07-16 07:22:03 +0000
commit3ace97660fde7fe1f0cc07a3925d1114af9a9c2f (patch)
tree9d736a1d403875737566ad8817bb347a9e8056fe /src/window
parent0824737757d10cbeb844871c3f67756ca969cf7c (diff)
downloadniri-3ace97660fde7fe1f0cc07a3925d1114af9a9c2f.tar.gz
niri-3ace97660fde7fe1f0cc07a3925d1114af9a9c2f.tar.bz2
niri-3ace97660fde7fe1f0cc07a3925d1114af9a9c2f.zip
Implement gradient color interpolation option (#548)
* Added the better color averaging code (tested & functional) * rustfmt * Make Color f32 0..1, clarify premul/unpremul * Fix imports and test name * Premultiply gradient colors matching CSS * Fix indentation * fixup * Add gradient image --------- Co-authored-by: K's Thinkpad <K.T.Kraft@protonmail.com>
Diffstat (limited to 'src/window')
-rw-r--r--src/window/mapped.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/window/mapped.rs b/src/window/mapped.rs
index 178b0a30..9963d7b6 100644
--- a/src/window/mapped.rs
+++ b/src/window/mapped.rs
@@ -2,7 +2,7 @@ use std::cell::{Cell, RefCell};
use std::cmp::{max, min};
use std::time::Duration;
-use niri_config::{CornerRadius, WindowRule};
+use niri_config::{Color, CornerRadius, GradientInterpolation, WindowRule};
use smithay::backend::renderer::element::surface::render_elements_from_surface_tree;
use smithay::backend::renderer::element::{Id, Kind};
use smithay::backend::renderer::gles::GlesRenderer;
@@ -289,8 +289,9 @@ impl Mapped {
return BorderRenderElement::new(
geo.size,
Rectangle::from_loc_and_size((0., 0.), geo.size),
- elem.color(),
- elem.color(),
+ GradientInterpolation::default(),
+ Color::from_array_premul(elem.color()),
+ Color::from_array_premul(elem.color()),
0.,
Rectangle::from_loc_and_size((0., 0.), geo.size),
0.,