-1

整个函数在调用 ctx.DrawImage 时才停止,这是与调用相关的所有信息。我无法弄清楚问题是什么。

附加信息:我正在使用 DevExtreme,所以它在 android 操作系统上运行

var Canvas = document.createElement("canvas");
var ctx = Canvas.getContext("2d");
Canvas.width=640;
Canvas.height=480;
var resultArray = [];
var workerCount = 0;


function onPhotoDataSuccess(imageData) {
   smallPicture = document.getElementById('smallImage');
    alert("1");
    smallPicture.onload = function () {
        alert("3");
        ctx.drawImage(showPicture, 0, 0, Canvas.width, Canvas.height);
        alert("4");
        resultArray = [];
        alert("5");
        workerCount = 2;
        alert("6");
        barcodeNum = "";
        DecodeWorker.postMessage({ ImageData: ctx.getImageData(0, 0, Canvas.width, Canvas.height).data, Width: Canvas.width, Height: Canvas.height, cmd: "normal" });
                };

    alert("2");
    smallPicture.src = "data:image/jpeg;base64," + imageData;
}
4

1 回答 1

0

您可能想要替换:

ctx.drawImage(showPicture, 0, 0, Canvas.width, Canvas.height);

和:

ctx.drawImage(smallPicture, 0, 0, Canvas.width, Canvas.height);
于 2014-10-17T07:52:12.303 回答