refactor/speed-up brightness module (#558)

* refactor/speed-up brightness module

* changes
This commit is contained in:
Mridul97
2019-01-05 21:53:29 +05:30
committed by Jeffrey Warren
parent 107b4c22e4
commit 69ed689ad7
3 changed files with 6962 additions and 14260 deletions
+6955 -14253
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
File diff suppressed because one or more lines are too long
+6 -6
View File
@@ -4,10 +4,13 @@
module.exports = function Brightness(options,UI){
var output;
function draw(input,callback,progressObj){
options.brightness = parseInt(options.brightness) || 100;
var val = (options.brightness)/100.0;
progressObj.stop(true);
progressObj.overrideFlag = true;
@@ -20,13 +23,10 @@ module.exports = function Brightness(options,UI){
var step = this;
function changePixel(r, g, b, a){
options.brightness =
options.brightness || 100
var val = (options.brightness)/100.0
r = val*r<255?val*r:255
g = val*g<255?val*g:255
b = val*b<255?val*b:255
r = Math.min(val*r, 255)
g = Math.min(val*g, 255)
b = Math.min(val*b, 255)
return [r, g, b, a]
}