Lines Matching refs:contrast
24 // The contrast effect transfer function can be approximated with the following
29 // where C is the normalized contrast value [-1..1].
33 // - start off with sampling the AE contrast effect for various contrast/input values [1]
36 // contrast values [2]
39 // * negative contrast appears clamped at -0.5 (-50)
40 // * a,b coefficients vary linearly vs. contrast
41 // * the b coefficient for max contrast (1.0) looks kinda familiar: 3.14757 - coincidence?
64 static sk_sp<SkData> make_contrast_coeffs(float contrast) {
67 coeffs.b = SK_ScalarPI * contrast;
90 // a = -contrast/3π
92 static sk_sp<SkData> make_contrast_coeffs(float contrast) {
93 const auto coeff_a = -contrast / (3 * SK_ScalarPI);
171 // while contrast is
176 // -100 always yields mid-gray: contrast(x, -100) == 0.5
177 // 0 is the neutral value: contrast(x, 0) == x
178 // 100 always yields white: contrast(x, 100) == 1
185 contrast = SkTPin(fContrast , -100.0f, 100.0f) / 100; // [ -1 .. 1]
187 // The component scale is derived from contrast:
191 const auto S = contrast > 0
192 ? 1 / std::max(1 - contrast, SK_ScalarNearlyZero)
193 : 1 + contrast;
195 // The component offset is derived from both brightness and contrast:
201 // Why do these pre/post compose depending on contrast scale, you ask?
217 contrast = SkTPin(fContrast , -50.0f, 100.0f) / 100; // [-0.5 .. 1]
224 : fContrastEffect->makeColorFilter(make_contrast_coeffs(contrast));