Playing with initial decode map impl.
This commit is contained in:
parent
3f8ba7d56a
commit
d76f5f6815
@ -227,7 +227,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
data: new Uint8Array(w * h * 4)
|
data: new Uint8Array(w * h * 4)
|
||||||
};
|
};
|
||||||
var pixels = imgData.data;
|
var pixels = imgData.data;
|
||||||
imageObj.fillRgbaBuffer(pixels, imageObj.decode);
|
imageObj.fillRgbaBuffer(pixels);
|
||||||
handler.send('obj', [objId, 'Image', imgData]);
|
handler.send('obj', [objId, 'Image', imgData]);
|
||||||
}, handler, xref, resources, image, inline);
|
}, handler, xref, resources, image, inline);
|
||||||
}
|
}
|
||||||
|
21
src/image.js
21
src/image.js
@ -104,10 +104,13 @@ var PDFImage = (function PDFImageClosure() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PDFImage.prototype = {
|
PDFImage.prototype = {
|
||||||
getComponents: function getComponents(buffer, decodeMap) {
|
getComponents: function getComponents(buffer) {
|
||||||
var bpc = this.bpc;
|
var bpc = this.bpc;
|
||||||
if (bpc == 8)
|
var decodeMap = this.decode;
|
||||||
return buffer;
|
//if (decodeMap)
|
||||||
|
// debugger;
|
||||||
|
//if (bpc == 8)
|
||||||
|
// return buffer;
|
||||||
|
|
||||||
var width = this.width;
|
var width = this.width;
|
||||||
var height = this.height;
|
var height = this.height;
|
||||||
@ -160,6 +163,14 @@ var PDFImage = (function PDFImageClosure() {
|
|||||||
|
|
||||||
var remainingBits = bits - bpc;
|
var remainingBits = bits - bpc;
|
||||||
output[i] = buf >> remainingBits;
|
output[i] = buf >> remainingBits;
|
||||||
|
if (decodeMap) {
|
||||||
|
var x = output[i];
|
||||||
|
var dmin = decodeMap[0];
|
||||||
|
var dmax = decodeMap[1];
|
||||||
|
var max = Math.pow(2, bpc) - 1;
|
||||||
|
var val = max * (dmin + x * ((dmax - dmin)/(max)));
|
||||||
|
output[i] = val;
|
||||||
|
}
|
||||||
buf = buf & ((1 << remainingBits) - 1);
|
buf = buf & ((1 << remainingBits) - 1);
|
||||||
bits = remainingBits;
|
bits = remainingBits;
|
||||||
}
|
}
|
||||||
@ -210,7 +221,7 @@ var PDFImage = (function PDFImageClosure() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fillRgbaBuffer: function fillRgbaBuffer(buffer, decodeMap) {
|
fillRgbaBuffer: function fillRgbaBuffer(buffer) {
|
||||||
var numComps = this.numComps;
|
var numComps = this.numComps;
|
||||||
var width = this.width;
|
var width = this.width;
|
||||||
var height = this.height;
|
var height = this.height;
|
||||||
@ -221,7 +232,7 @@ var PDFImage = (function PDFImageClosure() {
|
|||||||
var imgArray = this.getImageBytes(height * rowBytes);
|
var imgArray = this.getImageBytes(height * rowBytes);
|
||||||
|
|
||||||
var comps = this.colorSpace.getRgbBuffer(
|
var comps = this.colorSpace.getRgbBuffer(
|
||||||
this.getComponents(imgArray, decodeMap), bpc);
|
this.getComponents(imgArray), bpc);
|
||||||
var compsPos = 0;
|
var compsPos = 0;
|
||||||
var opacity = this.getOpacity();
|
var opacity = this.getOpacity();
|
||||||
var opacityPos = 0;
|
var opacityPos = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user