Add some comments + fix getColorN_IR_Pattern
This commit is contained in:
parent
5543d6f448
commit
5bfa9e4f3b
17
pdf.js
17
pdf.js
@ -4234,21 +4234,22 @@ var PartialEvaluator = (function() {
|
|||||||
var dict = IsStream(pattern) ? pattern.dict : pattern;
|
var dict = IsStream(pattern) ? pattern.dict : pattern;
|
||||||
var typeNum = dict.get('PatternType');
|
var typeNum = dict.get('PatternType');
|
||||||
|
|
||||||
// Type1 is TilingPattern, Type2 is ShadingPattern.
|
// Type1 is TilingPattern
|
||||||
if (typeNum == 1) {
|
if (typeNum == 1) {
|
||||||
// Create an IR of the pattern code.
|
// Create an IR of the pattern code.
|
||||||
var codeIR = this.evalRaw(pattern, xref,
|
var codeIR = this.evalRaw(pattern, xref,
|
||||||
dict.get('Resources'), fonts);
|
dict.get('Resources'), fonts);
|
||||||
|
|
||||||
args = TilingPattern.getIR(codeIR, dict);
|
args = TilingPattern.getIR(codeIR, dict);
|
||||||
|
}
|
||||||
//patternName.code = this.evalRaw(pattern, xref,
|
// Type2 is ShadingPattern.
|
||||||
// dict.get('Resources'), fonts);
|
else if (typeNum == 2) {
|
||||||
} else {
|
|
||||||
var shading = xref.fetchIfRef(dict.get('Shading'));
|
var shading = xref.fetchIfRef(dict.get('Shading'));
|
||||||
var matrix = dict.get('Matrix');
|
var matrix = dict.get('Matrix');
|
||||||
var pattern = Pattern.parseShading(shading, matrix, xref, res, null /*ctx*/);
|
var pattern = Pattern.parseShading(shading, matrix, xref, res, null /*ctx*/);
|
||||||
args = pattern.getPatternRaw();
|
args = pattern.getPatternRaw();
|
||||||
|
} else {
|
||||||
|
error("Unkown PatternType " + typeNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5277,7 +5278,7 @@ var CanvasGraphics = (function() {
|
|||||||
this.setStrokeColor.apply(this, arguments);
|
this.setStrokeColor.apply(this, arguments);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getColorN_IR_Pattern: function(IR) {
|
getColorN_IR_Pattern: function(IR, cs) {
|
||||||
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.
|
||||||
@ -5306,7 +5307,7 @@ var CanvasGraphics = (function() {
|
|||||||
var cs = this.current.strokeColorSpace;
|
var cs = this.current.strokeColorSpace;
|
||||||
|
|
||||||
if (cs.name == 'Pattern') {
|
if (cs.name == 'Pattern') {
|
||||||
this.current.strokeColor = this.getColorN_IR_Pattern(arguments);
|
this.current.strokeColor = this.getColorN_IR_Pattern(arguments, cs);
|
||||||
} else {
|
} else {
|
||||||
this.setStrokeColor.apply(this, arguments);
|
this.setStrokeColor.apply(this, arguments);
|
||||||
}
|
}
|
||||||
@ -5333,7 +5334,7 @@ var CanvasGraphics = (function() {
|
|||||||
var cs = this.current.fillColorSpace;
|
var cs = this.current.fillColorSpace;
|
||||||
|
|
||||||
if (cs.name == 'Pattern') {
|
if (cs.name == 'Pattern') {
|
||||||
this.current.fillColor = this.getColorN_IR_Pattern(arguments);
|
this.current.fillColor = this.getColorN_IR_Pattern(arguments, cs);
|
||||||
} else {
|
} else {
|
||||||
this.setFillColor.apply(this, arguments);
|
this.setFillColor.apply(this, arguments);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user