fix: allow negative values for rotating filter
This commit is contained in:
parent
da1a8351ff
commit
160e881ba7
1 changed files with 4 additions and 0 deletions
|
@ -23,6 +23,10 @@ impl PassThroughFilter {
|
||||||
PassThroughFilter::Rotating(filter_angle) => {
|
PassThroughFilter::Rotating(filter_angle) => {
|
||||||
let mut hsla = color.as_hsla_f32();
|
let mut hsla = color.as_hsla_f32();
|
||||||
hsla[0] = (hsla[0] + filter_angle) % 360.;
|
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])
|
Color::hsla(hsla[0], hsla[1], hsla[2], hsla[3])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue