mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Get working for not real images
This commit is contained in:
parent
b151516416
commit
d99dc718c5
3 changed files with 42 additions and 39 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue