aboutsummaryrefslogtreecommitdiff
path: root/src/layout/tile.rs
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/layout/tile.rs
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/layout/tile.rs')
-rw-r--r--src/layout/tile.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/layout/tile.rs b/src/layout/tile.rs
index 710add83..167ff2c6 100644
--- a/src/layout/tile.rs
+++ b/src/layout/tile.rs
@@ -1,7 +1,7 @@
use std::rc::Rc;
use std::time::Duration;
-use niri_config::CornerRadius;
+use niri_config::{Color, CornerRadius, GradientInterpolation};
use smithay::backend::allocator::Fourcc;
use smithay::backend::renderer::element::{Element, Kind};
use smithay::backend::renderer::gles::GlesRenderer;
@@ -757,8 +757,9 @@ impl<W: LayoutElement> Tile<W> {
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.,