From: Julian Viereck Date: Wed, 22 Jun 2011 08:40:51 +0000 (+0200) Subject: Get working for not real images X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=39ac389a7e556081f6c47f5b17c6a1453f3f680b;p=pdf.js.git Get working for not real images --- diff --git a/canvas_proxy.js b/canvas_proxy.js index ccc95c7..610cdcd 100644 --- a/canvas_proxy.js +++ b/canvas_proxy.js @@ -1,3 +1,24 @@ +var ImageCanvasProxyCounter = 0; +function ImageCanvasProxy(width, height) { + this.id = ImageCanvasProxyCounter++; + this.width = width; + this.height = height; + + // Using `Uint8ClampedArray` seems to be the type of ImageData - at least + // Firebug tells me so. + this.imgData = { + data: Uint8ClampedArray(width * height * 4) + }; +} + +ImageCanvasProxy.prototype.putImageData = function(imgData) { + // this.ctx.putImageData(imgData, 0, 0); +} + +ImageCanvasProxy.prototype.getCanvas = function() { + return this; +} + function CanvasProxy(width, height) { var stack = this.$stack = []; @@ -51,6 +72,14 @@ function CanvasProxy(width, height) { "$showText" ]; + this.drawImage = function(canvas, x, y) { + if (canvas instanceof ImageCanvasProxy) { + stack.push(["$drawCanvas", [canvas.imgData, x, y, canvas.width, canvas.height]]); + } else { + throw "unkown type to drawImage"; + } + } + function buildFuncCall(name) { return function() { // console.log("funcCall", name) diff --git a/viewer_worker.html b/viewer_worker.html index 930fb6c..07623c5 100644 --- a/viewer_worker.html +++ b/viewer_worker.html @@ -4,11 +4,6 @@