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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to