From ce6d9e1eeef5f7b17fada9f07145e7e430586bf1 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Mon, 13 Dec 2010 14:49:56 +0000 Subject: Adjust to changes in XML Graphics Commons: - equals() to ColorUtil.isSameColor() - ICCColorSpaceExt to ICCColorSpaceWithIntent - int to RenderingIntent enum git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Color@1045155 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/afp/modca/GraphicsObject.java | 9 ++++++++- src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src/java/org/apache/fop/afp') diff --git a/src/java/org/apache/fop/afp/modca/GraphicsObject.java b/src/java/org/apache/fop/afp/modca/GraphicsObject.java index b677a0f7c..350a602bf 100644 --- a/src/java/org/apache/fop/afp/modca/GraphicsObject.java +++ b/src/java/org/apache/fop/afp/modca/GraphicsObject.java @@ -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 AbstractDataObject { } /** {@inheritDoc} */ + @Override public void setViewport(AFPDataObjectInfo dataObjectInfo) { super.setViewport(dataObjectInfo); @@ -145,7 +147,7 @@ public class GraphicsObject extends AbstractDataObject { * @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 AbstractDataObject { } /** {@inheritDoc} */ + @Override public String toString() { return "GraphicsObject: " + getName(); } @@ -354,6 +357,7 @@ public class GraphicsObject extends AbstractDataObject { } /** {@inheritDoc} */ + @Override public void setComplete(boolean complete) { Iterator it = objects.iterator(); while (it.hasNext()) { @@ -364,6 +368,7 @@ public class GraphicsObject extends AbstractDataObject { } /** {@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 AbstractDataObject { } /** {@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); diff --git a/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java b/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java index 054292cc1..2962dc76c 100644 --- a/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java +++ b/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java @@ -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 implements PtocaConstants { * @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) { -- cgit v1.2.3