mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-11 19:00:00 +01:00
* Make progress bars on UI true Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * update docs Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * fix typo Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
module.exports = function Tint(options, UI) {
|
|
|
|
var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
|
|
|
|
var output;
|
|
|
|
function draw(input, callback, progressObj) {
|
|
|
|
var color = options.color || defaults.color;
|
|
color = color.split(' ');
|
|
var factor = options.factor || defaults.factor;
|
|
|
|
progressObj.stop(true);
|
|
progressObj.overrideFlag = true;
|
|
|
|
var step = this;
|
|
|
|
function changePixel(r, g, b, a) {
|
|
|
|
r -= (r - color[0]) * factor;
|
|
g -= (g - color[1]) * factor;
|
|
b -= (b - color[2]) * factor;
|
|
return [r, g, b, a];
|
|
}
|
|
|
|
function output(image, datauri, mimetype) {
|
|
|
|
// This output is accessible by Image Sequencer
|
|
step.output = { src: datauri, format: mimetype };
|
|
|
|
}
|
|
|
|
return require('../_nomodule/PixelManipulation.js')(input, {
|
|
output: output,
|
|
ui: options.step.ui,
|
|
changePixel: changePixel,
|
|
format: input.format,
|
|
image: options.image,
|
|
inBrowser: options.inBrowser,
|
|
callback: callback
|
|
});
|
|
|
|
}
|
|
return {
|
|
options: options,
|
|
draw: draw,
|
|
output: output,
|
|
UI: UI
|
|
};
|
|
};
|