return a dummy fill style for NYI shading

This commit is contained in:
Chris Jones 2011-07-09 23:30:16 -07:00
parent 671dd3b0e8
commit 56b1f3b333

15
pdf.js
View File

@ -4313,19 +4313,20 @@ var CanvasGraphics = (function() {
}, },
getShading: function(shading) { getShading: function(shading) {
shading = this.xref.fetchIfRef(shading); shading = this.xref.fetchIfRef(shading);
var dict = IsStream(shading) ? shading.dict : shading;
var bbox = shading.get('BBox'); var bbox = dict.get('BBox');
if (bbox && IsArray(bbox) && 4 == bbox.length) { if (bbox && IsArray(bbox) && 4 == bbox.length) {
this.rectangle.apply(this, bbox); this.rectangle.apply(this, bbox);
this.clip(); this.clip();
this.endPath(); this.endPath();
} }
var background = shading.get('Background'); var background = dict.get('Background');
if (background) if (background)
TODO('handle background colors'); TODO('handle background colors');
var cs = shading.get('ColorSpace', 'CS'); var cs = dict.get('ColorSpace', 'CS');
cs = ColorSpace.parse(cs, this.xref, this.res); cs = ColorSpace.parse(cs, this.xref, this.res);
var types = [null, var types = [null,
@ -4333,13 +4334,15 @@ var CanvasGraphics = (function() {
this.getAxialShading, this.getAxialShading,
this.getRadialShading]; this.getRadialShading];
var typeNum = shading.get('ShadingType'); var typeNum = dict.get('ShadingType');
var shadingFn = types[typeNum]; var shadingFn = types[typeNum];
// Most likely we will not implement other types of shading // Most likely we will not implement other types of shading
// unless the browser supports them // unless the browser supports them
if (!shadingFn) if (!shadingFn) {
TODO("Unknown or NYI type of shading '"+ typeNum +"'"); warn("Unknown or NYI type of shading '"+ typeNum +"'");
return 'hotpink';
}
return shadingFn.call(this, shading, cs); return shadingFn.call(this, shading, cs);
}, },