Skip to content

Commit

Permalink
Update saturation and contrast
Browse files Browse the repository at this point in the history
  • Loading branch information
refotografia committed Apr 3, 2024
1 parent dc715ec commit 8548e85
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/src/filter/adjust_color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import '../util/math_util.dart';
///
/// [whites] defines the white level of the image, as a color.
///
/// [mids] defines the mid level of hte image, as a color.
/// [mids] defines the mid level of the image, as a color.
///
/// [contrast] increases (> 1) / decreases (< 1) the contrast of the image by
/// pushing colors away/toward neutral gray, where at 0.0 the image is entirely
Expand Down Expand Up @@ -57,8 +57,8 @@ Image adjustColor(Image src,
return src;
}

contrast = contrast?.clamp(0, 1);
saturation = saturation?.clamp(0, 1);
contrast = contrast?.clamp(0, 2);
saturation = saturation?.clamp(0, 2);
gamma = gamma?.clamp(0, 1000);
exposure = exposure?.clamp(0, 1000);
amount = amount.clamp(0, 1000);
Expand Down Expand Up @@ -94,8 +94,8 @@ Image adjustColor(Image src,
}

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

if (exposure != null) {
exposure = pow(2.0, exposure);
Expand Down

0 comments on commit 8548e85

Please sign in to comment.