Skip to content

Commit

Permalink
fixed saturate/desaturate blending modes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeDavisson committed Sep 8, 2018
1 parent e73b95b commit 4d49861
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Blend.cxx
Expand Up @@ -398,7 +398,7 @@ int Blend::saturate(const int &c1, const int &c2, const int &t)
const rgba_type rgba = getRgba(c1);

rgbToHsv(rgba.r, rgba.g, rgba.b, &h, &s, &v);
s += (255 - t);
s += std::sqrt(255 - t);
s = std::min(s, 255);
hsvToRgb(h, s, v, &r, &g, &b);

Expand All @@ -412,7 +412,7 @@ int Blend::desaturate(const int &c1, const int &c2, const int &t)
const rgba_type rgba = getRgba(c1);

rgbToHsv(rgba.r, rgba.g, rgba.b, &h, &s, &v);
s -= (255 - t);
s -= std::sqrt(255 - t);
s = std::max(s, 0);
hsvToRgb(h, s, v, &r, &g, &b);

Expand Down

0 comments on commit 4d49861

Please sign in to comment.