You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2010/07/08 10:50:19 UTC

svn commit: r961641 - /xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFFactory.java

Author: jeremias
Date: Thu Jul  8 08:50:19 2010
New Revision: 961641

URL: http://svn.apache.org/viewvc?rev=961641&view=rev
Log:
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.

Modified:
    xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFFactory.java

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFFactory.java?rev=961641&r1=961640&r2=961641&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFFactory.java Thu Jul  8 08:50:19 2010
@@ -42,6 +42,7 @@ import org.apache.commons.io.output.Byte
 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);



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org