mirror of
https://github.com/publiclab/image-sequencer.git
synced 2026-06-16 04:33:26 +02:00
refactor/speed-up brightness module (#558)
* refactor/speed-up brightness module * changes
This commit is contained in:
Vendored
+6955
-14253
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -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]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user