Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update saturation and contrast #634

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading