]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
FOP-2553: Support PDF shading to PS
authorSimon Steiner <ssteiner@apache.org>
Thu, 17 Dec 2015 11:40:18 +0000 (11:40 +0000)
committerSimon Steiner <ssteiner@apache.org>
Thu, 17 Dec 2015 11:40:18 +0000 (11:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1720523 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/gradient/Function.java
src/java/org/apache/fop/render/gradient/Pattern.java

index 5099fce96dd3a45fd8cd1cf2e2cd4528448c985a..848b1cdb7c8b8aaad4da67cc25f7e2b9a1ca663a 100644 (file)
@@ -113,6 +113,9 @@ public class Function {
      */
     private List<Float> bounds;
 
+    private byte[] datasource;
+    private List<Integer> size;
+
     /**
      * create an complete Function object of Type 2, an Exponential Interpolation function.
      *
@@ -186,6 +189,14 @@ public class Function {
         this.encode = makeEncode(encode);
     }
 
+    public void setCZero(float[] cZero) {
+        this.cZero = cZero;
+    }
+
+    public void setCOne(float[] cOne) {
+        this.cOne = cOne;
+    }
+
     private List<Double> makeEncode(List<Double> encode) {
         if (encode != null) {
             return encode;
@@ -205,6 +216,15 @@ public class Function {
         this.range = range;
     }
 
+    public Function(List<Double> domain, List<Double> range, List<Double> encode, byte[] datasource, int bitsPerSample,
+                    List<Integer> size) {
+        this(0, domain, range);
+        this.encode = encode;
+        this.datasource = datasource;
+        this.bitsPerSample = bitsPerSample;
+        this.size = size;
+    }
+
     /**
      * Gets the function type
      */
@@ -295,6 +315,17 @@ public class Function {
             outputBitsPerSample(out);
             outputOrder(out);
             outputRange(out, doubleFormatter);
+            out.append("\n/DataSource <");
+            for (byte b : datasource) {
+                out.append(String.format("%02x", b & 0xff));
+            }
+            out.append(">\n");
+            out.append("/Size [");
+            for (Integer i : size) {
+                out.append(i);
+                out.append(" ");
+            }
+            out.append("]\n");
             out.append(">>");
         } else if (functionType == 2) {
             outputRange(out, doubleFormatter);
index cc244f58c0a6ddcd7aeeb9026c2c8998c9417fe3..eb473e922e388a5b8c3a3a72706193bafc4d4a7e 100644 (file)
@@ -27,7 +27,7 @@ public class Pattern {
 
     private final List<Double> matrix;
 
-    Pattern(int patternType, Shading shading, List<Double> matrix) {
+    public Pattern(int patternType, Shading shading, List<Double> matrix) {
         this.patternType = patternType;
         this.shading = shading;
         this.matrix = matrix;