From: Jeremias Maerki Date: Thu, 8 Jul 2010 08:50:19 +0000 (+0000) Subject: Bugfix for gradients with mixed color spaces: the original color was not replaced... X-Git-Tag: fop-1_1rc1old~290^2~22 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c4066cb3196d6b8cdf542c27786a3cf00dceee64;p=xmlgraphics-fop.git Bugfix for gradients with mixed color spaces: the original color was not replaced in the list which cause faulty PDFs. Switched to using a more accurate conversion method to sRGB. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Color@961641 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/pdf/PDFFactory.java b/src/java/org/apache/fop/pdf/PDFFactory.java index 152f75285..b7ce6618d 100644 --- a/src/java/org/apache/fop/pdf/PDFFactory.java +++ b/src/java/org/apache/fop/pdf/PDFFactory.java @@ -42,6 +42,7 @@ import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.xmlgraphics.java2d.color.ColorUtil; import org.apache.xmlgraphics.java2d.color.NamedColorSpace; import org.apache.xmlgraphics.xmp.Metadata; @@ -776,14 +777,16 @@ public class PDFFactory { Color currentColor = (Color)theColors.get(currentPosition); Color nextColor = (Color)theColors.get(currentPosition + 1); - // colorspace must be consistant + // colorspace must be consistent, so we simply convert to sRGB where necessary if (!currentColor.getColorSpace().isCS_sRGB()) { //Convert to sRGB - theColors.set(currentPosition, new Color(currentColor.getRGB())); + currentColor = ColorUtil.toSRGBColor(currentColor); + theColors.set(currentPosition, currentColor); } if (!nextColor.getColorSpace().isCS_sRGB()) { //Convert to sRGB - theColors.set(currentPosition + 1, new Color(nextColor.getRGB())); + nextColor = ColorUtil.toSRGBColor(nextColor); + theColors.set(currentPosition + 1, nextColor); } theCzero = toColorVector(currentColor);