Skip to content

Commit

Permalink
Fix adjustColor color corruption
Browse files Browse the repository at this point in the history
  • Loading branch information
brendan-duncan committed Jan 8, 2025
1 parent a1e23cc commit 4507990
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/src/filter/adjust_color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ Image adjustColor(Image src,
}

final num invSaturation =
saturation != null ? 1.0 - saturation.clamp(0, 2) : 0.0;
final num invContrast = contrast != null ? 1.0 - contrast.clamp(0, 2) : 0.0;
saturation != null ? 1.0 - saturation : 0.0;
final num invContrast = contrast != null ? 1.0 - contrast : 0.0;

if (exposure != null) {
exposure = pow(2.0, exposure);
Expand Down Expand Up @@ -143,7 +143,6 @@ Image adjustColor(Image src,

if (saturation != null) {
final num lum = r * lumCoeffR + g * lumCoeffG + b * lumCoeffB;

r = lum * invSaturation + r * saturation;
g = lum * invSaturation + g * saturation;
b = lum * invSaturation + b * saturation;
Expand Down Expand Up @@ -186,9 +185,9 @@ Image adjustColor(Image src,
b = mix(ob, b, blend);

p
..rNormalized = r
..gNormalized = g
..bNormalized = b;
..rNormalized = r.clamp(0.0, 1.0)
..gNormalized = g.clamp(0.0, 1.0)
..bNormalized = b.clamp(0.0, 1.0);
}
}

Expand Down

0 comments on commit 4507990

Please sign in to comment.