diff options
author | Jeremias Maerki <jeremias@apache.org> | 2010-06-25 12:17:58 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2010-06-25 12:17:58 +0000 |
commit | 9dc0ea2f7ad8fd77481901e269b6ac2bbb3d0308 (patch) | |
tree | 4a9d835b8edd05b526b51b7939e4ea1a8e3b5e80 /src/java/org/apache/fop/render/pdf | |
parent | 1dc63dc609d2bcb8c865a26595d212f9eb858c14 (diff) | |
download | xmlgraphics-fop-9dc0ea2f7ad8fd77481901e269b6ac2bbb3d0308.tar.gz xmlgraphics-fop-9dc0ea2f7ad8fd77481901e269b6ac2bbb3d0308.zip |
Bugzilla #49403:
Initial support for PDF Separation color spaces (aka spot colors). This is still unfinished but produces valid PDF with Separation colors in simple cases.
Based on work by: Patrick Jaromin <Patrick.at.Jaromin.com>
Note: PDFColor is broken right now, as I'm planning to phase that class out. Squeezing separation colors and what else comes later into that class isn't such a good idea IMO. Instead, PDFColorHandler tries to do all that in a better way based on the new color support classes from XGC.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Color@957913 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/pdf')
-rw-r--r-- | src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java | 6 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/pdf/PDFContentGenerator.java | 13 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java b/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java index 165236359..ff7532639 100644 --- a/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java +++ b/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java @@ -34,6 +34,7 @@ import org.apache.fop.pdf.PDFDocument; import org.apache.fop.pdf.PDFICCBasedColorSpace; import org.apache.fop.pdf.PDFICCStream; import org.apache.fop.pdf.PDFImage; +import org.apache.fop.pdf.PDFName; import org.apache.fop.pdf.PDFReference; import org.apache.fop.util.ColorProfileUtil; @@ -128,13 +129,14 @@ public abstract class AbstractImageAdapter implements PDFImage { } else { if (cs == null && desc.startsWith("sRGB")) { //It's the default sRGB profile which we mapped to DefaultRGB in PDFRenderer - cs = doc.getResources().getColorSpace("DefaultRGB"); + cs = (PDFICCBasedColorSpace)doc.getResources().getColorSpace( + new PDFName("DefaultRGB")); } if (cs == null) { // sRGB hasn't been set up for the PDF document // so install but don't set to DefaultRGB cs = PDFICCBasedColorSpace.setupsRGBColorSpace(doc); - } + } pdfICCStream = cs.getICCStream(); } return pdfICCStream; diff --git a/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java b/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java index fb5fc4e8d..634551baa 100644 --- a/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java +++ b/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java @@ -25,7 +25,7 @@ import java.awt.geom.AffineTransform; import java.io.IOException; import java.io.OutputStream; -import org.apache.fop.pdf.PDFColor; +import org.apache.fop.pdf.PDFColorHandler; import org.apache.fop.pdf.PDFDocument; import org.apache.fop.pdf.PDFFilterList; import org.apache.fop.pdf.PDFNumber; @@ -51,6 +51,8 @@ public class PDFContentGenerator { /** the current stream to add PDF commands to */ private PDFStream currentStream; + private PDFColorHandler colorHandler; + /** drawing state */ protected PDFPaintingState currentState = null; /** Text generation utility holding the current font status */ @@ -80,6 +82,7 @@ public class PDFContentGenerator { }; this.currentState = new PDFPaintingState(); + this.colorHandler = new PDFColorHandler(document.getResources()); } /** @@ -340,8 +343,9 @@ public class PDFContentGenerator { */ public void setColor(Color col, boolean fill, PDFStream stream) { assert stream != null; - PDFColor color = new PDFColor(this.document, col); - stream.add(color.getColorSpaceOut(fill)); + StringBuffer sb = new StringBuffer(); + setColor(col, fill, sb); + stream.add(sb.toString()); } /** @@ -363,8 +367,7 @@ public class PDFContentGenerator { */ protected void setColor(Color col, boolean fill, StringBuffer pdf) { if (pdf != null) { - PDFColor color = new PDFColor(this.document, col); - pdf.append(color.getColorSpaceOut(fill)); + colorHandler.establishColor(pdf, col, fill); } else { setColor(col, fill, this.currentStream); } |