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/12/13 15:49:56 UTC

svn commit: r1045155 - in /xmlgraphics/fop/branches/Temp_Color: src/java/org/apache/fop/afp/modca/ src/java/org/apache/fop/afp/ptoca/ src/java/org/apache/fop/apps/ src/java/org/apache/fop/fo/properties/ src/java/org/apache/fop/pdf/ src/java/org/apache/...

Author: jeremias
Date: Mon Dec 13 14:49:56 2010
New Revision: 1045155

URL: http://svn.apache.org/viewvc?rev=1045155&view=rev
Log:
Adjust to changes in XML Graphics Commons:
- equals() to ColorUtil.isSameColor()
- ICCColorSpaceExt to ICCColorSpaceWithIntent
- int to RenderingIntent enum

Modified:
    xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/modca/GraphicsObject.java
    xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java
    xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/apps/FopFactory.java
    xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ColorProperty.java
    xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFPaintingState.java
    xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/intermediate/IFSerializer.java
    xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/intermediate/IFState.java
    xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java
    xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/traits/BorderProps.java
    xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/AbstractPaintingState.java
    xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorSpaceCache.java
    xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorUtil.java
    xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/util/ColorUtilTestCase.java

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/modca/GraphicsObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/modca/GraphicsObject.java?rev=1045155&r1=1045154&r2=1045155&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/modca/GraphicsObject.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/modca/GraphicsObject.java Mon Dec 13 14:49:56 2010
@@ -26,6 +26,7 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.xmlgraphics.java2d.color.ColorConverter;
+import org.apache.xmlgraphics.java2d.color.ColorUtil;
 
 import org.apache.fop.afp.AFPDataObjectInfo;
 import org.apache.fop.afp.AFPObjectAreaInfo;
@@ -82,6 +83,7 @@ public class GraphicsObject extends Abst
     }
 
     /** {@inheritDoc} */
+    @Override
     public void setViewport(AFPDataObjectInfo dataObjectInfo) {
         super.setViewport(dataObjectInfo);
 
@@ -145,7 +147,7 @@ public class GraphicsObject extends Abst
      * @param color the active color to use
      */
     public void setColor(Color color) {
-        if (!color.equals(graphicsState.color)) {
+        if (!ColorUtil.isSameColor(color, graphicsState.color)) {
             addObject(new GraphicsSetProcessColor(colorConverter.convert(color)));
             graphicsState.color = color;
         }
@@ -341,6 +343,7 @@ public class GraphicsObject extends Abst
     }
 
     /** {@inheritDoc} */
+    @Override
     public String toString() {
         return "GraphicsObject: " + getName();
     }
@@ -354,6 +357,7 @@ public class GraphicsObject extends Abst
     }
 
     /** {@inheritDoc} */
+    @Override
     public void setComplete(boolean complete) {
         Iterator it = objects.iterator();
         while (it.hasNext()) {
@@ -364,6 +368,7 @@ public class GraphicsObject extends Abst
     }
 
     /** {@inheritDoc} */
+    @Override
     protected void writeStart(OutputStream os) throws IOException {
         super.writeStart(os);
         byte[] data = new byte[17];
@@ -372,12 +377,14 @@ public class GraphicsObject extends Abst
     }
 
     /** {@inheritDoc} */
+    @Override
     protected void writeContent(OutputStream os) throws IOException {
         super.writeContent(os);
         writeObjects(objects, os);
     }
 
     /** {@inheritDoc} */
+    @Override
     protected void writeEnd(OutputStream os) throws IOException {
         byte[] data = new byte[17];
         copySF(data, Type.END, Category.GRAPHICS);

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java?rev=1045155&r1=1045154&r2=1045155&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java Mon Dec 13 14:49:56 2010
@@ -27,6 +27,7 @@ import java.io.OutputStream;
 import org.apache.commons.io.output.ByteArrayOutputStream;
 
 import org.apache.xmlgraphics.java2d.color.CIELabColorSpace;
+import org.apache.xmlgraphics.java2d.color.ColorUtil;
 import org.apache.xmlgraphics.java2d.color.ColorWithAlternatives;
 
 /**
@@ -314,8 +315,7 @@ public abstract class PtocaBuilder imple
      * @throws IOException if an I/O error occurs
      */
     public void setExtendedTextColor(Color col) throws IOException {
-        //Check in both directions
-        if (col.equals(currentColor) && currentColor.equals(col)) {
+        if (ColorUtil.isSameColor(col, currentColor)) {
             return;
         }
         if (col instanceof ColorWithAlternatives) {

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/apps/FopFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/apps/FopFactory.java?rev=1045155&r1=1045154&r2=1045155&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/apps/FopFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/apps/FopFactory.java Mon Dec 13 14:49:56 2010
@@ -40,7 +40,7 @@ import org.apache.commons.logging.LogFac
 
 import org.apache.xmlgraphics.image.loader.ImageContext;
 import org.apache.xmlgraphics.image.loader.ImageManager;
-import org.apache.xmlgraphics.java2d.color.ICCColorSpaceExt;
+import org.apache.xmlgraphics.java2d.color.RenderingIntent;
 
 import org.apache.fop.fo.ElementMapping;
 import org.apache.fop.fo.ElementMappingRegistry;
@@ -157,6 +157,7 @@ public class FopFactory implements Image
         this.fontManager = new FontManager() {
 
             /** {@inheritDoc} */
+            @Override
             public void setFontBaseURL(String fontBase) throws MalformedURLException {
                 super.setFontBaseURL(getFOURIResolver().checkBaseURL(fontBase));
             }
@@ -373,6 +374,7 @@ public class FopFactory implements Image
      * @throws MalformedURLException if there's a problem with a file URL
      * @deprecated use getFontManager().setFontBaseURL(fontBase) instead
      */
+    @Deprecated
     public void setFontBaseURL(String fontBase) throws MalformedURLException {
         getFontManager().setFontBaseURL(fontBase);
     }
@@ -381,6 +383,7 @@ public class FopFactory implements Image
      * @return the font base URL
      * @deprecated use getFontManager().setFontBaseURL(fontBase) instead
      */
+    @Deprecated
     public String getFontBaseURL() {
         return getFontManager().getFontBaseURL();
     }
@@ -491,6 +494,7 @@ public class FopFactory implements Image
      * @return true if kerning on base 14 fonts is enabled
      * @deprecated use getFontManager().isBase14KerningEnabled() instead
      */
+    @Deprecated
     public boolean isBase14KerningEnabled() {
         return getFontManager().isBase14KerningEnabled();
     }
@@ -500,6 +504,7 @@ public class FopFactory implements Image
      * @param value true if kerning should be activated
      * @deprecated use getFontManager().setBase14KerningEnabled(boolean) instead
      */
+    @Deprecated
     public void setBase14KerningEnabled(boolean value) {
         getFontManager().setBase14KerningEnabled(value);
     }
@@ -708,6 +713,7 @@ public class FopFactory implements Image
      * @param useCache use cache or not
      * @deprecated use getFontManager().setUseCache(boolean) instead
      */
+    @Deprecated
     public void setUseCache(boolean useCache) {
         getFontManager().setUseCache(useCache);
     }
@@ -717,6 +723,7 @@ public class FopFactory implements Image
      * @return whether this factory is uses the cache
      * @deprecated use getFontManager().useCache() instead
      */
+    @Deprecated
     public boolean useCache() {
         return getFontManager().useCache();
     }
@@ -726,6 +733,7 @@ public class FopFactory implements Image
      * @return the font cache
      * @deprecated use getFontManager().getFontCache() instead
      */
+    @Deprecated
     public FontCache getFontCache() {
         return getFontManager().getFontCache();
     }
@@ -771,11 +779,11 @@ public class FopFactory implements Image
      * @param profileName the profile name
      * @param baseUri a base URI to resolve relative URIs
      * @param iccProfileSrc ICC Profile source to return a ColorSpace for
-     * @param renderingIntent overriding rendering intent (see {@link ICCColorSpaceExt}.*)
+     * @param renderingIntent overriding rendering intent
      * @return ICC ColorSpace object or null if ColorSpace could not be created
      */
     public ColorSpace getColorSpace(String profileName, String baseUri, String iccProfileSrc,
-            int renderingIntent) {
+            RenderingIntent renderingIntent) {
         return colorSpaceCache.get(profileName, baseUri, iccProfileSrc, renderingIntent);
     }
 

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ColorProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ColorProperty.java?rev=1045155&r1=1045154&r2=1045155&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ColorProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ColorProperty.java Mon Dec 13 14:49:56 2010
@@ -69,6 +69,7 @@ public final class ColorProperty extends
          * @throws PropertyException
          *             for invalid or inconsistent FO input
          */
+        @Override
         public Property convertProperty(Property p,
                                         PropertyList propertyList, FObj fo)
                     throws PropertyException {
@@ -118,11 +119,13 @@ public final class ColorProperty extends
      * @param foUserAgent FOP user agent
      * @return float the AWT color represented by this ColorType instance
      */
+    @Override
     public Color getColor(FOUserAgent foUserAgent) {
         return color;
     }
 
     /** {@inheritDoc} */
+    @Override
     public String toString() {
         return ColorUtil.colorToString(color);
     }
@@ -138,23 +141,27 @@ public final class ColorProperty extends
     /**
      * @return this.colorType cast as an Object
      */
+    @Override
     public Object getObject() {
         return this;
     }
 
     /** {@inheritDoc} */
+    @Override
     public boolean equals(Object o) {
         if (this == o) {
             return true;
         }
 
         if (o instanceof ColorProperty) {
-            return ((ColorProperty) o).color.equals(this.color);
+            return org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor(
+                    ((ColorProperty) o).color, this.color);
         }
         return false;
     }
 
     /** {@inheritDoc} */
+    @Override
     public int hashCode() {
         return this.color.hashCode();
     }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFPaintingState.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFPaintingState.java?rev=1045155&r1=1045154&r2=1045155&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFPaintingState.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFPaintingState.java Mon Dec 13 14:49:56 2010
@@ -19,12 +19,15 @@
 
 package org.apache.fop.pdf;
 
+import java.awt.Color;
 import java.awt.Paint;
 import java.awt.Shape;
 import java.awt.geom.Area;
 import java.awt.geom.GeneralPath;
 import java.util.Iterator;
 
+import org.apache.xmlgraphics.java2d.color.ColorUtil;
+
 import org.apache.fop.util.AbstractPaintingState;
 
 /**
@@ -63,13 +66,18 @@ public class PDFPaintingState extends or
      */
     public boolean setPaint(Paint p) {
         PDFData data = getPDFData();
-        Paint paint = data.paint;
-        if (paint == null) {
+        Paint currentPaint = data.paint;
+        if (currentPaint == null) {
             if (p != null) {
                 data.paint = p;
                 return true;
             }
-        } else if (!paint.equals(p)) {
+        } else if (p instanceof Color && currentPaint instanceof Color) {
+            if (!ColorUtil.isSameColor((Color)p, (Color)currentPaint)) {
+                data.paint = p;
+                return true;
+            }
+        } else if (!currentPaint.equals(p)) {
             data.paint = p;
             return true;
         }
@@ -180,11 +188,13 @@ public class PDFPaintingState extends or
     }
 
     /** {@inheritDoc} */
+    @Override
     protected AbstractData instantiateData() {
         return new PDFData();
     }
 
     /** {@inheritDoc} */
+    @Override
     protected AbstractPaintingState instantiate() {
         return new PDFPaintingState();
     }
@@ -194,6 +204,7 @@ public class PDFPaintingState extends or
      * This call should be used when the q operator is used
      * so that the state is known when popped.
      */
+    @Override
     public void save() {
         AbstractData data = getData();
         AbstractData copy = (AbstractData)data.clone();
@@ -222,6 +233,7 @@ public class PDFPaintingState extends or
         private float characterSpacing = 0f;
 
         /** {@inheritDoc} */
+        @Override
         public Object clone() {
             PDFData obj = (PDFData)super.clone();
             obj.paint = this.paint;
@@ -237,6 +249,7 @@ public class PDFPaintingState extends or
         }
 
         /** {@inheritDoc} */
+        @Override
         public String toString() {
             return super.toString()
                 + ", paint=" + paint
@@ -249,6 +262,7 @@ public class PDFPaintingState extends or
         }
 
         /** {@inheritDoc} */
+        @Override
         protected AbstractData instantiate() {
             return new PDFData();
         }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/intermediate/IFSerializer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/intermediate/IFSerializer.java?rev=1045155&r1=1045154&r2=1045155&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/intermediate/IFSerializer.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/intermediate/IFSerializer.java Mon Dec 13 14:49:56 2010
@@ -33,6 +33,7 @@ import java.util.Map;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
+
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
 
@@ -75,6 +76,7 @@ public class IFSerializer extends Abstra
     }
 
     /** {@inheritDoc} */
+    @Override
     protected String getMainNamespace() {
         return NAMESPACE;
     }
@@ -101,6 +103,7 @@ public class IFSerializer extends Abstra
     }
 
     /** {@inheritDoc} */
+    @Override
     public IFDocumentNavigationHandler getDocumentNavigationHandler() {
         return this;
     }
@@ -146,6 +149,7 @@ public class IFSerializer extends Abstra
     }
 
     /** {@inheritDoc} */
+    @Override
     public void startDocument() throws IFException {
         super.startDocument();
         try {
@@ -161,6 +165,7 @@ public class IFSerializer extends Abstra
     }
 
     /** {@inheritDoc} */
+    @Override
     public void startDocumentHeader() throws IFException {
         try {
             handler.startElement(EL_HEADER);
@@ -170,6 +175,7 @@ public class IFSerializer extends Abstra
     }
 
     /** {@inheritDoc} */
+    @Override
     public void endDocumentHeader() throws IFException {
         try {
             handler.endElement(EL_HEADER);
@@ -179,6 +185,7 @@ public class IFSerializer extends Abstra
     }
 
     /** {@inheritDoc} */
+    @Override
     public void startDocumentTrailer() throws IFException {
         try {
             handler.startElement(EL_TRAILER);
@@ -188,6 +195,7 @@ public class IFSerializer extends Abstra
     }
 
     /** {@inheritDoc} */
+    @Override
     public void endDocumentTrailer() throws IFException {
         try {
             handler.endElement(EL_TRAILER);
@@ -264,6 +272,7 @@ public class IFSerializer extends Abstra
     }
 
     /** {@inheritDoc} */
+    @Override
     public void startPageHeader() throws IFException {
         try {
             handler.startElement(EL_PAGE_HEADER);
@@ -273,6 +282,7 @@ public class IFSerializer extends Abstra
     }
 
     /** {@inheritDoc} */
+    @Override
     public void endPageHeader() throws IFException {
         try {
             handler.endElement(EL_PAGE_HEADER);
@@ -303,6 +313,7 @@ public class IFSerializer extends Abstra
     }
 
     /** {@inheritDoc} */
+    @Override
     public void startPageTrailer() throws IFException {
         try {
             handler.startElement(EL_PAGE_TRAILER);
@@ -312,6 +323,7 @@ public class IFSerializer extends Abstra
     }
 
     /** {@inheritDoc} */
+    @Override
     public void endPageTrailer() throws IFException {
         try {
             commitNavigation();
@@ -604,7 +616,8 @@ public class IFSerializer extends Abstra
                 }
             }
             if (color != null) {
-                changed = !color.equals(state.getTextColor());
+                changed = !org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor(
+                        color, state.getTextColor());
                 if (changed) {
                     state.setTextColor(color);
                     addAttribute(atts, "color", toString(color));

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/intermediate/IFState.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/intermediate/IFState.java?rev=1045155&r1=1045154&r2=1045155&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/intermediate/IFState.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/intermediate/IFState.java Mon Dec 13 14:49:56 2010
@@ -21,6 +21,8 @@ package org.apache.fop.render.intermedia
 
 import java.awt.Color;
 
+import org.apache.xmlgraphics.java2d.color.ColorUtil;
+
 public class IFState {
 
     private IFState parent;
@@ -178,8 +180,7 @@ public class IFState {
      * @param color the new text color
      */
     public void setTextColor(Color color) {
-        //Check in both directions due to limitations of java.awt.Color
-        if (!color.equals(this.textColor) || !this.textColor.equals(color)) {
+        if (!ColorUtil.isSameColor(color, this.textColor)) {
             this.fontChanged = true;
         }
         this.textColor = color;

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java?rev=1045155&r1=1045154&r2=1045155&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java Mon Dec 13 14:49:56 2010
@@ -28,6 +28,8 @@ import java.awt.geom.AffineTransform;
 import java.awt.geom.Area;
 import java.awt.geom.GeneralPath;
 
+import org.apache.xmlgraphics.java2d.color.ColorUtil;
+
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fonts.FontInfo;
 
@@ -103,7 +105,7 @@ public class Java2DGraphicsState {
      * @return true if the background color has changed
      */
     public boolean updateColor(Color col) {
-        if (!col.equals(getGraph().getColor())) {
+        if (!ColorUtil.isSameColor(col, getGraph().getColor())) {
             getGraph().setColor(col);
             return true;
         } else {
@@ -217,12 +219,18 @@ public class Java2DGraphicsState {
      * @return true if the new paint changes the current paint
      */
     public boolean updatePaint(Paint p) {
-        if (getGraph().getPaint() == null) {
+        Paint currentPaint = getGraph().getPaint();
+        if (currentPaint == null) {
             if (p != null) {
                 getGraph().setPaint(p);
                 return true;
             }
-        } else if (!p.equals(getGraph().getPaint())) {
+        } else if (p instanceof Color && currentPaint instanceof Color) {
+            if (!ColorUtil.isSameColor((Color)p, (Color)currentPaint)) {
+                getGraph().setPaint(p);
+                return true;
+            }
+        } else if (!p.equals(currentPaint)) {
             getGraph().setPaint(p);
             return true;
         }
@@ -271,6 +279,7 @@ public class Java2DGraphicsState {
     }
 
     /** {@inheritDoc} */
+    @Override
     public String toString() {
         String s = "Java2DGraphicsState " + currentGraphics.toString()
                 + ", Stroke (width: " + currentStrokeWidth + " style: "

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/traits/BorderProps.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/traits/BorderProps.java?rev=1045155&r1=1045154&r2=1045155&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/traits/BorderProps.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/traits/BorderProps.java Mon Dec 13 14:49:56 2010
@@ -96,11 +96,13 @@ public class BorderProps implements Seri
     }
 
     /** {@inheritDoc} */
+    @Override
     public int hashCode() {
         return toString().hashCode();
     }
 
     /** {@inheritDoc} */
+    @Override
     public boolean equals(Object obj) {
         if (obj == null) {
             return false;
@@ -110,7 +112,8 @@ public class BorderProps implements Seri
             if (obj instanceof BorderProps) {
                 BorderProps other = (BorderProps)obj;
                 return (style == other.style)
-                        && color.equals(other.color)
+                        && org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor(
+                                color, other.color)
                         && width == other.width
                         && mode == other.mode;
             }
@@ -161,6 +164,7 @@ public class BorderProps implements Seri
     }
 
     /** {@inheritDoc} */
+    @Override
     public String toString() {
         StringBuffer sbuf = new StringBuffer();
         sbuf.append('(');

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/AbstractPaintingState.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/AbstractPaintingState.java?rev=1045155&r1=1045154&r2=1045155&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/AbstractPaintingState.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/AbstractPaintingState.java Mon Dec 13 14:49:56 2010
@@ -76,8 +76,7 @@ public abstract class AbstractPaintingSt
      */
     public boolean setColor(Color col) {
         Color other = getData().color;
-        //Check in both directions due to limitations of java.awt.Color
-        if (!col.equals(other) || !other.equals(col)) {
+        if (!org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor(col, other)) {
             getData().color = col;
             return true;
         }
@@ -117,8 +116,7 @@ public abstract class AbstractPaintingSt
      */
     public boolean setBackColor(Color col) {
         Color other = getData().backColor;
-        //Check in both directions due to limitations of java.awt.Color
-        if (!col.equals(other) || !other.equals(col)) {
+        if (!org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor(col, other)) {
             getData().backColor = col;
             return true;
         }
@@ -368,6 +366,7 @@ public abstract class AbstractPaintingSt
     }
 
     /** {@inheritDoc} */
+    @Override
     public Object clone() {
         AbstractPaintingState state = instantiate();
         state.stateStack = new StateStack(this.stateStack);
@@ -376,6 +375,7 @@ public abstract class AbstractPaintingSt
     }
 
     /** {@inheritDoc} */
+    @Override
     public String toString() {
         return ", stateStack=" + stateStack
         + ", currentData=" + data;
@@ -509,6 +509,7 @@ public abstract class AbstractPaintingSt
         }
 
         /** {@inheritDoc} */
+        @Override
         public Object clone() {
             AbstractData data = instantiate();
             data.color = this.color;
@@ -525,6 +526,7 @@ public abstract class AbstractPaintingSt
         }
 
         /** {@inheritDoc} */
+        @Override
         public String toString() {
             return "color=" + color
                 + ", backColor=" + backColor

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorSpaceCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorSpaceCache.java?rev=1045155&r1=1045154&r2=1045155&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorSpaceCache.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorSpaceCache.java Mon Dec 13 14:49:56 2010
@@ -31,7 +31,8 @@ import javax.xml.transform.stream.Stream
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import org.apache.xmlgraphics.java2d.color.ICCColorSpaceExt;
+import org.apache.xmlgraphics.java2d.color.ICCColorSpaceWithIntent;
+import org.apache.xmlgraphics.java2d.color.RenderingIntent;
 
 /**
  * Map with cached ICC based ColorSpace objects.
@@ -41,7 +42,8 @@ public class ColorSpaceCache {
     private static Log log = LogFactory.getLog(ColorSpaceCache.class);
 
     private URIResolver resolver;
-    private Map colorSpaceMap = Collections.synchronizedMap(new java.util.HashMap());
+    private Map<String, ColorSpace> colorSpaceMap
+            = Collections.synchronizedMap(new java.util.HashMap<String, ColorSpace>());
 
     /**
      * Default constructor
@@ -63,11 +65,11 @@ public class ColorSpaceCache {
      * @param profileName the profile name
      * @param base a base URI to resolve relative URIs
      * @param iccProfileSrc ICC Profile source to return a ColorSpace for
-     * @param renderingIntent overriding rendering intent (see {@link ICCColorSpaceExt}.*)
+     * @param renderingIntent overriding rendering intent
      * @return ICC ColorSpace object or null if ColorSpace could not be created
      */
     public ColorSpace get(String profileName, String base, String iccProfileSrc,
-            int renderingIntent) {
+            RenderingIntent renderingIntent) {
         String key = profileName + ":" + base + iccProfileSrc;
         ColorSpace colorSpace = null;
         if (!colorSpaceMap.containsKey(key)) {
@@ -91,7 +93,7 @@ public class ColorSpaceCache {
                     // iccProfile = ICC_Profile.getInstance(iccProfileSrc);
                 }
                 if (iccProfile != null) {
-                    colorSpace = new ICCColorSpaceExt(iccProfile, renderingIntent,
+                    colorSpace = new ICCColorSpaceWithIntent(iccProfile, renderingIntent,
                             profileName, iccProfileSrc);
                 }
             } catch (Exception e) {
@@ -108,7 +110,7 @@ public class ColorSpaceCache {
                 log.warn("Color profile '" + iccProfileSrc + "' not found.");
             }
         } else {
-            colorSpace = (ColorSpace)colorSpaceMap.get(key);
+            colorSpace = colorSpaceMap.get(key);
         }
         return colorSpace;
     }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorUtil.java?rev=1045155&r1=1045154&r2=1045155&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorUtil.java Mon Dec 13 14:49:56 2010
@@ -34,8 +34,8 @@ import org.apache.xmlgraphics.java2d.col
 import org.apache.xmlgraphics.java2d.color.ColorSpaces;
 import org.apache.xmlgraphics.java2d.color.ColorWithAlternatives;
 import org.apache.xmlgraphics.java2d.color.DeviceCMYKColorSpace;
-import org.apache.xmlgraphics.java2d.color.ICCColorSpaceExt;
 import org.apache.xmlgraphics.java2d.color.NamedColorSpace;
+import org.apache.xmlgraphics.java2d.color.RenderingIntent;
 import org.apache.xmlgraphics.java2d.color.profile.NamedColorProfile;
 import org.apache.xmlgraphics.java2d.color.profile.NamedColorProfileParser;
 
@@ -69,7 +69,7 @@ public final class ColorUtil {
      * This map is used to predefine given colors, as well as speeding up
      * parsing of already parsed colors.
      */
-    private static Map colorMap = null;
+    private static Map<String, Color> colorMap = null;
 
     /** Logger instance */
     protected static Log log = LogFactory.getLog(ColorUtil.class);
@@ -116,7 +116,7 @@ public final class ColorUtil {
             return null;
         }
 
-        Color parsedColor = (Color) colorMap.get(value.toLowerCase());
+        Color parsedColor = colorMap.get(value.toLowerCase());
 
         if (parsedColor == null) {
             if (value.startsWith("#")) {
@@ -172,7 +172,7 @@ public final class ColorUtil {
             throw new PropertyException("Unknown color format: " + value
                     + ". Must be system-color(x)");
         }
-        return (Color) colorMap.get(value);
+        return colorMap.get(value);
     }
 
     /**
@@ -408,7 +408,8 @@ public final class ColorUtil {
                 /* Ask FOP factory to get ColorSpace for the specified ICC profile source */
                 if (foUserAgent != null && iccProfileSrc != null) {
                     assert colorSpace == null;
-                    int renderingIntent = ICCColorSpaceExt.AUTO; //TODO connect to fo:color-profile
+                    RenderingIntent renderingIntent = RenderingIntent.AUTO;
+                    //TODO connect to fo:color-profile/@rendering-intent
                     colorSpace = foUserAgent.getFactory().getColorSpace(iccProfileName,
                             foUserAgent.getBaseURL(), iccProfileSrc,
                             renderingIntent);
@@ -496,7 +497,8 @@ public final class ColorUtil {
 
                 /* Ask FOP factory to get ColorSpace for the specified ICC profile source */
                 if (foUserAgent != null && iccProfileSrc != null) {
-                    int renderingIntent = ICCColorSpaceExt.AUTO; //TODO connect to fo:color-profile
+                    RenderingIntent renderingIntent = RenderingIntent.AUTO;
+                    //TODO connect to fo:color-profile/@rendering-intent
                     colorSpace = (ICC_ColorSpace)foUserAgent.getFactory().getColorSpace(
                             iccProfileName,
                             foUserAgent.getBaseURL(), iccProfileSrc,
@@ -804,7 +806,7 @@ public final class ColorUtil {
      * Initializes the colorMap with some predefined values.
      */
     private static void initializeColorMap() {
-        colorMap = Collections.synchronizedMap(new java.util.HashMap());
+        colorMap = Collections.synchronizedMap(new java.util.HashMap<String, Color>());
 
         colorMap.put("aliceblue", createColor(240, 248, 255));
         colorMap.put("antiquewhite", createColor(250, 235, 215));

Modified: xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/util/ColorUtilTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/util/ColorUtilTestCase.java?rev=1045155&r1=1045154&r2=1045155&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/util/ColorUtilTestCase.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/util/ColorUtilTestCase.java Mon Dec 13 14:49:56 2010
@@ -27,8 +27,8 @@ import junit.framework.TestCase;
 
 import org.apache.xmlgraphics.java2d.color.ColorSpaces;
 import org.apache.xmlgraphics.java2d.color.ColorWithAlternatives;
-import org.apache.xmlgraphics.java2d.color.ICCColorSpaceExt;
 import org.apache.xmlgraphics.java2d.color.NamedColorSpace;
+import org.apache.xmlgraphics.java2d.color.RenderingIntent;
 
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.FopFactory;
@@ -89,7 +89,8 @@ public class ColorUtilTestCase extends T
         */
 
         col2 = ColorUtil.parseColorString(null, "fop-rgb-icc(0.5,0.5,0.5,#CMYK,,0.5,0.5,0.5,0.0)");
-        assertFalse(col1.equals(col2));
+        assertTrue(col1.equals(col2));
+        assertFalse(org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor(col1, col2));
     }
 
     /**
@@ -118,7 +119,7 @@ public class ColorUtilTestCase extends T
         URI sRGBLoc = new URI(
                 "file:src/java/org/apache/fop/pdf/sRGB%20Color%20Space%20Profile.icm");
         ColorSpace cs = fopFactory.getColorSpace("sRGBAlt", null, sRGBLoc.toASCIIString(),
-                ICCColorSpaceExt.AUTO);
+                RenderingIntent.AUTO);
         assertNotNull("Color profile not found", cs);
 
         FOUserAgent ua = fopFactory.newFOUserAgent();
@@ -265,7 +266,7 @@ public class ColorUtilTestCase extends T
         FopFactory fopFactory = FopFactory.newInstance();
         URI ncpLoc = new URI("file:test/resources/color/ncp-example.icc");
         ColorSpace cs = fopFactory.getColorSpace("NCP", null, ncpLoc.toASCIIString(),
-                ICCColorSpaceExt.AUTO);
+                RenderingIntent.AUTO);
         assertNotNull("Color profile not found", cs);
 
         FOUserAgent ua = fopFactory.newFOUserAgent();



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