From a384002ccf7b6021ce82abe49f8621dc4aa17b84 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Mon, 23 Mar 2009 07:47:35 +0000 Subject: [PATCH] Bugzilla #46882: Fixed the handling of CMYK colors in PDFGraphics2D. Suggested by: Yegor Kozlov git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@757338 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/svg/PDFGraphics2D.java | 24 ++++++++----------- status.xml | 3 +++ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index 554d26798..ede368f58 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -59,6 +59,15 @@ import org.apache.batik.ext.awt.RadialGradientPaint; import org.apache.batik.ext.awt.RenderingHintsKeyExt; import org.apache.batik.gvt.GraphicsNode; import org.apache.batik.gvt.PatternPaint; + +import org.apache.xmlgraphics.image.loader.ImageInfo; +import org.apache.xmlgraphics.image.loader.ImageSize; +import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax; +import org.apache.xmlgraphics.image.loader.impl.ImageRawJPEG; +import org.apache.xmlgraphics.image.loader.impl.ImageRendered; +import org.apache.xmlgraphics.java2d.AbstractGraphics2D; +import org.apache.xmlgraphics.java2d.GraphicContext; + import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontSetup; @@ -83,13 +92,6 @@ import org.apache.fop.render.pdf.ImageRawCCITTFaxAdapter; import org.apache.fop.render.pdf.ImageRawJPEGAdapter; import org.apache.fop.render.pdf.ImageRenderedAdapter; import org.apache.fop.util.ColorExt; -import org.apache.xmlgraphics.image.loader.ImageInfo; -import org.apache.xmlgraphics.image.loader.ImageSize; -import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax; -import org.apache.xmlgraphics.image.loader.impl.ImageRawJPEG; -import org.apache.xmlgraphics.image.loader.impl.ImageRendered; -import org.apache.xmlgraphics.java2d.AbstractGraphics2D; -import org.apache.xmlgraphics.java2d.GraphicContext; /** * PDF Graphics 2D. @@ -741,13 +743,7 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand throw new PDFConformanceException( "PDF/A-1 does not allow mixing DeviceRGB and DeviceCMYK."); } - float[] cComps = c.getColorComponents(new float[3]); - double[] cmyk = new double[3]; - for (int i = 0; i < 3; i++) { - // convert the float elements to doubles for pdf - cmyk[i] = cComps[i]; - } - PDFColor currentColour = new PDFColor(cmyk[0], cmyk[1], cmyk[2], cmyk[3]); + PDFColor currentColour = new PDFColor(c); currentStream.write(currentColour.getColorSpaceOut(fill)); } else if (c.getColorSpace().getType() == ColorSpace.TYPE_2CLR) { diff --git a/status.xml b/status.xml index ec311f6a6..5afc7f37e 100644 --- a/status.xml +++ b/status.xml @@ -58,6 +58,9 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> + + Fixed the handling of CMYK colors in PDFGraphics2D. + Fixed a bug when combining a forced break with a "last" page-master. The restart of the algorithm would start at the index of the penalty corresponding to the last -- 2.39.5