}
function error(msg) {
- console.trace();
throw new Error(msg);
}
}
constructor.prototype = {
- getByte: function() {
- // dummy method to pass IsStream test
- error("shouldnt be called");
- },
+ getChar: function() {
+ },
+
getImage: function() {
return this.domImage;
}
var predictor = this.stream.getByte();
var rawBytes = this.stream.getBytes(rowBytes - pixBytes);
- var i;
switch (predictor) {
case 0:
currentRow[i] = (currentRow[i] + rawBytes[j]) & 0xFF;
break;
case 3:
- for (i = pixBytes, j = 0; i < rowBytes; ++i, ++j)
+ for (var i = pixBytes, j = 0; i < rowBytes; ++i, ++j)
currentRow[i] = (((currentRow[i] + currentRow[i - pixBytes])
>> 1) + rawBytes[j]) & 0xFF;
break;
}
constructor.prototype = {
- toString: function() {
- return this.name;
- }
};
return constructor;
}
constructor.prototype = {
- toString: function() {
- return this.cmd;
- }
};
return constructor;
constructor.prototype = {
get: function(key) {
- return this.map[key];
- },
- get2: function(key1, key2) {
- return this.get(key1) || this.get(key2);
- },
- has: function(key) {
- return key in this.map;
- },
- set: function(key, value) {
- this.map[key] = value;
- },
- forEach: function(aCallback) {
- for (var key in this.map)
- aCallback(key, this.map[key]);
+ return this.map[key];
+ },
+ get2: function(key1, key2) {
+ return this.get(key1) || this.get(key2);
+ },
+ has: function(key) {
+ return key in this.map;
+ },
+ set: function(key, value) {
+ this.map[key] = value;
+ },
+ forEach: function(aCallback) {
+ for (var key in this.map)
+ aCallback(key, this.map[key]);
}
};
-
return constructor;
})();
}
function IsStream(v) {
- return typeof v == "object" && "getByte" in v;
+ return typeof v == "object" && "getChar" in v;
}
function IsRef(v) {
},
makeFilter: function(stream, name, length, params) {
if (name == "FlateDecode" || name == "Fl") {
-/* var flateStr = new FlateStream(stream);
- if (IsDict(params)) {
- var predType = params.get("Predictor");
- if (predType && predType > 1) {
- var colors = params.get("Colors");
- if (!colors)
- colors = 1;
- var bpc = params.get("BitsPerComponent");
- if (!bpc)
- bpc = 8;
- var cols = params.get("Columns");
- if (!cols)
- cols = 1;
-
- log("Predictor being used");
- flateStr = new FilterPredictor(flateStr, predType, cols,
- colors, bpc);
- }
- }
- return flateStr;
-*/
if (params) {
return new PredictorStream(new FlateStream(stream), params);
}
error("unhandled number of bits per component");
if (smask) {
- //if (maskColorSpace.numComps != 1)
- // error("Incorrect number of components in smask");
+ if (maskColorSpace.numComps != 1)
+ error("Incorrect number of components in smask");
var numComps = colorSpace.numComps;
var imgArray = image.getBytes(numComps * w * h);