From 893ebb6461c7c20eeb858565e3a1778e2f7dd236 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Thu, 17 Dec 2015 11:40:18 +0000 Subject: [PATCH] FOP-2553: Support PDF shading to PS git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1720523 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/render/gradient/Function.java | 31 +++++++++++++++++++ .../apache/fop/render/gradient/Pattern.java | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/fop/render/gradient/Function.java b/src/java/org/apache/fop/render/gradient/Function.java index 5099fce96..848b1cdb7 100644 --- a/src/java/org/apache/fop/render/gradient/Function.java +++ b/src/java/org/apache/fop/render/gradient/Function.java @@ -113,6 +113,9 @@ public class Function { */ private List bounds; + private byte[] datasource; + private List 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 makeEncode(List encode) { if (encode != null) { return encode; @@ -205,6 +216,15 @@ public class Function { this.range = range; } + public Function(List domain, List range, List encode, byte[] datasource, int bitsPerSample, + List 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); diff --git a/src/java/org/apache/fop/render/gradient/Pattern.java b/src/java/org/apache/fop/render/gradient/Pattern.java index cc244f58c..eb473e922 100644 --- a/src/java/org/apache/fop/render/gradient/Pattern.java +++ b/src/java/org/apache/fop/render/gradient/Pattern.java @@ -27,7 +27,7 @@ public class Pattern { private final List matrix; - Pattern(int patternType, Shading shading, List matrix) { + public Pattern(int patternType, Shading shading, List matrix) { this.patternType = patternType; this.shading = shading; this.matrix = matrix; -- 2.39.5