Fixes Decode-qr (#680)

This commit is contained in:
aashna27
2019-02-09 04:05:32 +05:30
committed by Jeffrey Warren
parent 044a120468
commit f09df0d042
3 changed files with 40 additions and 26 deletions

View File

@@ -8,7 +8,10 @@ module.exports = function DoNothing(options,UI) {
var getPixels = require('get-pixels');
// This function is called everytime a step has to be redrawn
function draw(input,callback) {
function draw(input,callback,progressObj) {
progressObj.stop(true);
progressObj.overrideFlag = true;
var step = this;
@@ -18,16 +21,25 @@ module.exports = function DoNothing(options,UI) {
var w = pixels.shape[0];
var h = pixels.shape[1];
var decoded = jsQR.decodeQRFromImage(pixels.data,w,h);
var decoded = jsQR(pixels.data,w,h);
// This output is accessible to Image Sequencer
step.output = input;
step.output.data = decoded;
// Tell Image Sequencer that this step is complete
callback();
options.step.qrval = decoded;
options.step.qrval = (decoded)?decoded.data:"undefined";
});
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,
format: input.format,
image: options.image,
callback: callback
});
}