Browse Source

Merge pull request #2406 from yurydelendik/issue-2006

Fixes function array support for radial/axial pattern
Brendan Dahl 13 years ago
parent
commit
00fad28284
  1. 28
      src/pattern.js
  2. 1
      test/pdfs/issue2006.pdf.link
  3. 8
      test/test_manifest.json

28
src/pattern.js

@ -115,11 +115,29 @@ Shadings.RadialAxial = (function RadialAxialClosure() {
this.extendEnd = extendEnd; this.extendEnd = extendEnd;
var fnObj = dict.get('Function'); var fnObj = dict.get('Function');
if (isArray(fnObj)) var fn;
error('No support for array of functions'); if (isArray(fnObj)) {
if (!isPDFFunction(fnObj)) var fnArray = [];
error('Invalid function'); for (var j = 0, jj = fnObj.length; j < jj; j++) {
var fn = PDFFunction.parse(xref, fnObj); var obj = xref.fetchIfRef(fnObj[j]);
if (!isPDFFunction(obj)) {
error('Invalid function');
}
fnArray.push(PDFFunction.parse(xref, obj));
}
fn = function radialAxialColorFunction(arg) {
var out = [];
for (var i = 0, ii = fnArray.length; i < ii; i++) {
out.push(fnArray[i](arg)[0]);
}
return out;
};
} else {
if (!isPDFFunction(fnObj)) {
error('Invalid function');
}
fn = PDFFunction.parse(xref, fnObj);
}
// 10 samples seems good enough for now, but probably won't work // 10 samples seems good enough for now, but probably won't work
// if there are sharp color changes. Ideally, we would implement // if there are sharp color changes. Ideally, we would implement

1
test/pdfs/issue2006.pdf.link

@ -0,0 +1 @@
http://pages.sencha.com/rs/sencha/images/Sencha-WP-Dev-Mgrs-Guide-to-HTML5.pdf

8
test/test_manifest.json

@ -713,6 +713,14 @@
"link": true, "link": true,
"type": "eq" "type": "eq"
}, },
{ "id": "issue2006",
"file": "pdfs/issue2006.pdf",
"md5": "71ec73831ece9b508ad20efa6ff28642",
"rounds": 1,
"pageLimit": 1,
"link": true,
"type": "eq"
},
{ "id": "issue1729", { "id": "issue1729",
"file": "pdfs/issue1729.pdf", "file": "pdfs/issue1729.pdf",
"md5": "29b0eddc3e1dcb23a44384037032d470", "md5": "29b0eddc3e1dcb23a44384037032d470",

Loading…
Cancel
Save