diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index 9cce785..96bb910 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -209,10 +209,15 @@ function Library (ronin) { } this.saturation = (pixel, q = 1) => { - var color = 0.2126 * pixel.r + 0.7152 * pixel.g + 0.0722 * pixel.b + const color = 0.2126 * pixel.r + 0.7152 * pixel.g + 0.0722 * pixel.b return [color, color, color, pixel.a] } + this.contrast = (pixel, q = 1) => { + const intercept = 128 * (1 - q) + return [pixel.r * q + intercept, pixel.g * q + intercept, pixel.b * q + intercept, pixel.a] + } + // Math this.add = (...args) => {