var codeIR = this.getIRQueue(pattern, xref,
dict.get('Resources'), {}, fonts, images, uniquePrefix);
- args = TilingPattern.getIR(codeIR, dict);
+ args = TilingPattern.getIR(codeIR, dict, args);
}
// Type2 is ShadingPattern.
else if (typeNum == 2) {
if (IR[0] == "TilingPatternIR") {
// First, build the `color` var like it's done in the
// Pattern.prototype.parse function.
+ var args = IR[1];
var base = cs.base;
var color;
if (base) {
// Build the pattern based on the IR data.
var pattern = new TilingPatternIR(IR, color, this.ctx);
- } else if (IR[0] == "RadialAxialShading") {
+ } else if (IR[0] == "RadialAxialShading" || IR[0] == "DummyShading") {
var pattern = Pattern.shadingFromIR(this.ctx, IR);
} else {
throw "Unkown IR type";
constructor.prototype = {
getRgb: function sepcs_getRgb(color) {
- var tinted = this.tintFn.func(color);
+ var tinted = this.tintFn(color);
return this.base.getRgb(tinted);
},
getRgbBuffer: function sepcs_getRgbBuffer(input, bits) {
var baseBuf = new Uint8Array(numComps * length);
for (var i = 0; i < length; ++i) {
var scaled = input[i] * scale;
- var tinted = tintFn.func([scaled]);
+ var tinted = tintFn([scaled]);
for (var j = 0; j < numComps; ++j)
baseBuf[pos++] = 255 * tinted[j];
}
function constructor() {
this.type = 'Pattern';
}
+
+ constructor.fromIR = function() {
+ return 'hotpink';
+ }
+
constructor.prototype = {
- getPattern: function dummy_getpattern() {
- return 'hotpink';
+ getIR: function dummpy_getir() {
+ return [ 'DummyShading' ];
}
};
return constructor;
this.type = 'Pattern';
this.ctx = ctx;
-
var cs = dict.get('ColorSpace', 'CS');
cs = ColorSpace.parse(cs, xref, res);
this.cs = cs;
function TilingPatternIR(IR, color, ctx) {
// "Unfolding" the IR.
- var IRQueue = IR[1];
- this.matrix = IR[2];
- var bbox = IR[3];
- var xstep = IR[4];
- var ystep = IR[5];
- var paintType = IR[6];
+ var IRQueue = IR[2];
+ this.matrix = IR[3];
+ var bbox = IR[4];
+ var xstep = IR[5];
+ var ystep = IR[6];
+ var paintType = IR[7];
//
TODO('TilingType');
})();
var TilingPattern = {
- getIR: function(codeIR, dict) {
+ getIR: function(codeIR, dict, args) {
var matrix = dict.get('Matrix');
var bbox = dict.get('BBox');
var xstep = dict.get('XStep');
var ystep = dict.get('YStep');
var paintType = dict.get('PaintType');
- return ["TilingPatternIR", codeIR, matrix, bbox, xstep, ystep, paintType];
+ return ["TilingPatternIR", args, codeIR, matrix, bbox, xstep, ystep, paintType];
}
};
var v2 = rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
// call the appropropriate function
- return fns[i].func([v2]);
+ return fns[i]([v2]);
};
},
return [ CONSTRUCT_POSTSCRIPT ];
},
- constructPostScriptFromIR: function(IR) {
+ constructPostScriptFromIR: function() {
TODO('unhandled type of function');
- this.func = function() {
+ return function() {
return [255, 105, 180];
};
}