]> git.parisson.com Git - pdf.js.git/commitdiff
Implement ColorSpace IR forms for Pattern and Indexed
authorJulian Viereck <julian.viereck@gmail.com>
Wed, 7 Sep 2011 23:25:51 +0000 (16:25 -0700)
committerJulian Viereck <julian.viereck@gmail.com>
Thu, 15 Sep 2011 15:59:52 +0000 (08:59 -0700)
pdf.js

diff --git a/pdf.js b/pdf.js
index eb7b19c3fd502a3df2177dd0c8aeec01bfe61c28..75795a0299e3bb11fe977fe6070b0a6123daa587 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -5729,7 +5729,17 @@ var ColorSpace = (function() {
       case "DeviceCmykCS":
         return new DeviceCmykCS();
       case "PatternCS":
-        return new PatternCS(raw[1]);
+        var baseCS = raw[1];
+        if (baseCS == null) {
+          return new PatternCS(null);
+        } else {
+          return new PatternCS(ColorSpace.fromIR(baseCS));
+        }
+      case "Indexed":
+        var baseCS = raw[1];
+        var hiVal  = raw[2];
+        var lookup = raw[3];
+        return new IndexedCS(ColorSpace.fromIR(baseCS), hiVal, lookup)
       default:
         error("Unkown name " + name);
     }
@@ -5796,23 +5806,18 @@ var ColorSpace = (function() {
           return "DeviceCmykCS";
         break;
       case 'Pattern':
-        console.log("ColorSpace Pattern");
-        // TODO: IMPLEMENT ME
-
-        // var baseCS = cs[1];
-        // if (baseCS)
-        //   baseCS = ColorSpace.parse(baseCS, xref, res);
-        // return new PatternCS(baseCS);
+        var baseCS = cs[1];
+        if (baseCS)
+          baseCS = ColorSpace.parseToIR(baseCS, xref, res);
+        return ["PatternCS", baseCS];
       case 'Indexed':
-        // TODO: IMPLEMENT ME
+        var baseCS = ColorSpace.parseToIR(cs[1], xref, res);
+        var hiVal = cs[2] + 1;
+        var lookup = xref.fetchIfRef(cs[3]);
+        return ["IndexedCS", baseCS, hiVal, lookup];
+      case 'Separation':      
+        error("Need to implement IR form for SeparationCS");
 
-        // var base = ColorSpace.parse(cs[1], xref, res);
-        // var hiVal = cs[2] + 1;
-        // var lookup = xref.fetchIfRef(cs[3]);
-        // return new IndexedCS(base, hiVal, lookup);
-      case 'Separation':
-        // TODO: IMPLEMENT ME
-      
         // var name = cs[1];
         // var alt = ColorSpace.parse(cs[2], xref, res);
         // var tintFn = new PDFFunction(xref, xref.fetchIfRef(cs[3]));