From 160e881ba74a6b734000c75c614a830c82346491 Mon Sep 17 00:00:00 2001 From: tuxmain Date: Mon, 29 Aug 2022 09:54:23 +0200 Subject: [PATCH] fix: allow negative values for rotating filter --- src/filters.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/filters.rs b/src/filters.rs index 9a18af2..7596677 100644 --- a/src/filters.rs +++ b/src/filters.rs @@ -23,6 +23,10 @@ impl PassThroughFilter { PassThroughFilter::Rotating(filter_angle) => { let mut hsla = color.as_hsla_f32(); hsla[0] = (hsla[0] + filter_angle) % 360.; + // floating rem is not modulo! + if hsla[0] < 0. { + hsla[0] += 360.; + } Color::hsla(hsla[0], hsla[1], hsla[2], hsla[3]) } }