整个函数只是在调用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;
}
答案 0 :(得分:0)
您可能想要替换:
ctx.drawImage(showPicture, 0, 0, Canvas.width, Canvas.height);
使用:
ctx.drawImage(smallPicture, 0, 0, Canvas.width, Canvas.height);