]> git.parisson.com Git - pdf.js.git/commitdiff
Add shading support for setFillColorN_IR - is that used at all?
authorJulian Viereck <julian.viereck@gmail.com>
Wed, 7 Sep 2011 20:30:12 +0000 (13:30 -0700)
committerJulian Viereck <julian.viereck@gmail.com>
Thu, 15 Sep 2011 15:21:23 +0000 (08:21 -0700)
pdf.js

diff --git a/pdf.js b/pdf.js
index 49ce746c99236055778801d1dccce83e6c8669b4..a7fe1e29c1e37b9e1419d0d604ab021cedd3cf94 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -4222,6 +4222,8 @@ var PartialEvaluator = (function() {
           // TODO figure out how to type-check vararg functions
 
           if ((cmd == 'SCN' || cmd == 'scn') && !args[args.length - 1].code) {
+            fn = "setFillColorN_IR";
+            
             // compile tiling patterns
             var patternName = args[args.length - 1];
             // SCN/scn applies patterns along with normal colors
@@ -4237,11 +4239,15 @@ var PartialEvaluator = (function() {
                   var codeIR = this.evalRaw(pattern, xref,
                                     dict.get('Resources'), fonts);
                   
-                  fn = "setFillColorN_IR";
                   args = TilingPattern.getIR(codeIR, dict);
 
                   //patternName.code = this.evalRaw(pattern, xref,
                   //    dict.get('Resources'), fonts);
+                } else {
+                  var shading = xref.fetchIfRef(dict.get('Shading'));
+                  var matrix = dict.get('Matrix');
+                  var pattern = Pattern.parseShading(shading, matrix, xref, res, null /*ctx*/);
+                  args = pattern.getPatternRaw();
                 }
               }
             }
@@ -5309,6 +5315,8 @@ var CanvasGraphics = (function() {
 
           // Build the pattern based on the IR data.
           var pattern = new TilingPatternIR(IR, color, this.ctx);
+        } else if (IR[0] == "RadialAxialShading") {
+          var pattern = Pattern.shadingFromRaw(this.ctx, IR); 
         } else {
           throw "Unkown IR type";
         }