Move getting the Pattern from IR form out and make setStrokeColorN_IR work
This commit is contained in:
parent
9e3de8b339
commit
5543d6f448
59
pdf.js
59
pdf.js
@ -4222,7 +4222,8 @@ var PartialEvaluator = (function() {
|
|||||||
// TODO figure out how to type-check vararg functions
|
// TODO figure out how to type-check vararg functions
|
||||||
|
|
||||||
if ((cmd == 'SCN' || cmd == 'scn') && !args[args.length - 1].code) {
|
if ((cmd == 'SCN' || cmd == 'scn') && !args[args.length - 1].code) {
|
||||||
fn = "setFillColorN_IR";
|
// Use the IR version for setStroke/FillColorN.
|
||||||
|
fn += '_IR';
|
||||||
|
|
||||||
// compile tiling patterns
|
// compile tiling patterns
|
||||||
var patternName = args[args.length - 1];
|
var patternName = args[args.length - 1];
|
||||||
@ -5276,28 +5277,7 @@ var CanvasGraphics = (function() {
|
|||||||
this.setStrokeColor.apply(this, arguments);
|
this.setStrokeColor.apply(this, arguments);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setFillColor: function(/*...*/) {
|
getColorN_IR_Pattern: function(IR) {
|
||||||
var cs = this.current.fillColorSpace;
|
|
||||||
var color = cs.getRgb(arguments);
|
|
||||||
this.setFillRGBColor.apply(this, color);
|
|
||||||
},
|
|
||||||
setFillColorN: function(/*...*/) {
|
|
||||||
var cs = this.current.fillColorSpace;
|
|
||||||
|
|
||||||
if (cs.name == 'Pattern') {
|
|
||||||
// wait until fill to actually get the pattern
|
|
||||||
var pattern = Pattern.parse(arguments, cs, this.xref, this.res,
|
|
||||||
this.ctx);
|
|
||||||
this.current.fillColor = pattern;
|
|
||||||
} else {
|
|
||||||
this.setFillColor.apply(this, arguments);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setFillColorN_IR: function(/*...*/) {
|
|
||||||
var cs = this.current.fillColorSpace;
|
|
||||||
|
|
||||||
if (cs.name == 'Pattern') {
|
|
||||||
var IR = arguments;
|
|
||||||
if (IR[0] == "TilingPatternIR") {
|
if (IR[0] == "TilingPatternIR") {
|
||||||
// First, build the `color` var like it's done in the
|
// First, build the `color` var like it's done in the
|
||||||
// Pattern.prototype.parse function.
|
// Pattern.prototype.parse function.
|
||||||
@ -5320,11 +5300,44 @@ var CanvasGraphics = (function() {
|
|||||||
} else {
|
} else {
|
||||||
throw "Unkown IR type";
|
throw "Unkown IR type";
|
||||||
}
|
}
|
||||||
|
return pattern;
|
||||||
|
},
|
||||||
|
setStrokeColorN_IR: function(/*...*/) {
|
||||||
|
var cs = this.current.strokeColorSpace;
|
||||||
|
|
||||||
|
if (cs.name == 'Pattern') {
|
||||||
|
this.current.strokeColor = this.getColorN_IR_Pattern(arguments);
|
||||||
|
} else {
|
||||||
|
this.setStrokeColor.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
setFillColor: function(/*...*/) {
|
||||||
|
var cs = this.current.fillColorSpace;
|
||||||
|
var color = cs.getRgb(arguments);
|
||||||
|
this.setFillRGBColor.apply(this, color);
|
||||||
|
},
|
||||||
|
setFillColorN: function(/*...*/) {
|
||||||
|
var cs = this.current.fillColorSpace;
|
||||||
|
|
||||||
|
if (cs.name == 'Pattern') {
|
||||||
|
// wait until fill to actually get the pattern
|
||||||
|
var pattern = Pattern.parse(arguments, cs, this.xref, this.res,
|
||||||
|
this.ctx);
|
||||||
this.current.fillColor = pattern;
|
this.current.fillColor = pattern;
|
||||||
} else {
|
} else {
|
||||||
this.setFillColor.apply(this, arguments);
|
this.setFillColor.apply(this, arguments);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setFillColorN_IR: function(/*...*/) {
|
||||||
|
var cs = this.current.fillColorSpace;
|
||||||
|
|
||||||
|
if (cs.name == 'Pattern') {
|
||||||
|
this.current.fillColor = this.getColorN_IR_Pattern(arguments);
|
||||||
|
} else {
|
||||||
|
this.setFillColor.apply(this, arguments);
|
||||||
|
}
|
||||||
|
},
|
||||||
setStrokeGray: function(gray) {
|
setStrokeGray: function(gray) {
|
||||||
this.setStrokeRGBColor(gray, gray, gray);
|
this.setStrokeRGBColor(gray, gray, gray);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user