From ce3cf9985ed273d50a9a5e17c0f1c5a8c389ce3f Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 15 Jul 2019 22:09:03 +0900 Subject: [PATCH] Completed desaturation filter --- desktop/sources/scripts/library.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index 6dd82f8..c962ad5 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -211,7 +211,7 @@ function Library (ronin) { this.saturation = (pixel, q = 1) => { const color = 0.2126 * pixel.r + 0.7152 * pixel.g + 0.0722 * pixel.b - return [color, color, color, pixel.a] + return [(color * (1 - q)) + (pixel.r * q), (color * (1 - q)) + (pixel.g * q), (color * (1 - q)) + (pixel.b * q), pixel.a] } this.contrast = (pixel, q = 1) => {