aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org')
-rw-r--r--src/java/org/apache/fop/afp/modca/GraphicsObject.java9
-rw-r--r--src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java4
-rw-r--r--src/java/org/apache/fop/apps/FopFactory.java14
-rw-r--r--src/java/org/apache/fop/fo/properties/ColorProperty.java9
-rw-r--r--src/java/org/apache/fop/pdf/PDFPaintingState.java20
-rw-r--r--src/java/org/apache/fop/render/intermediate/IFSerializer.java15
-rw-r--r--src/java/org/apache/fop/render/intermediate/IFState.java5
-rw-r--r--src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java15
-rw-r--r--src/java/org/apache/fop/traits/BorderProps.java6
-rw-r--r--src/java/org/apache/fop/util/AbstractPaintingState.java10
-rw-r--r--src/java/org/apache/fop/util/ColorSpaceCache.java14
-rw-r--r--src/java/org/apache/fop/util/ColorUtil.java16
12 files changed, 103 insertions, 34 deletions
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) {
diff --git a/src/java/org/apache/fop/apps/FopFactory.java b/src/java/org/apache/fop/apps/FopFactory.java
index 15279dc01..7e97442e6 100644
--- a/src/java/org/apache/fop/apps/FopFactory.java
+++ b/src/java/org/apache/fop/apps/FopFactory.java
@@ -40,7 +40,7 @@ import org.apache.commons.logging.LogFactory;
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 ImageContext {
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 ImageContext {
* @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 ImageContext {
* @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 ImageContext {
* @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 ImageContext {
* @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 ImageContext {
* @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 ImageContext {
* @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 ImageContext {
* @return the font cache
* @deprecated use getFontManager().getFontCache() instead
*/
+ @Deprecated
public FontCache getFontCache() {
return getFontManager().getFontCache();
}
@@ -771,11 +779,11 @@ public class FopFactory implements ImageContext {
* @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);
}
diff --git a/src/java/org/apache/fop/fo/properties/ColorProperty.java b/src/java/org/apache/fop/fo/properties/ColorProperty.java
index 925d275af..4bbf94b74 100644
--- a/src/java/org/apache/fop/fo/properties/ColorProperty.java
+++ b/src/java/org/apache/fop/fo/properties/ColorProperty.java
@@ -69,6 +69,7 @@ public final class ColorProperty extends Property {
* @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 Property {
* @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 Property {
/**
* @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();
}
diff --git a/src/java/org/apache/fop/pdf/PDFPaintingState.java b/src/java/org/apache/fop/pdf/PDFPaintingState.java
index ebe2b383b..29d022f61 100644
--- a/src/java/org/apache/fop/pdf/PDFPaintingState.java
+++ b/src/java/org/apache/fop/pdf/PDFPaintingState.java
@@ -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 org.apache.fop.util.AbstractPaintingState
*/
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 org.apache.fop.util.AbstractPaintingState
}
/** {@inheritDoc} */
+ @Override
protected AbstractData instantiateData() {
return new PDFData();
}
/** {@inheritDoc} */
+ @Override
protected AbstractPaintingState instantiate() {
return new PDFPaintingState();
}
@@ -194,6 +204,7 @@ public class PDFPaintingState extends org.apache.fop.util.AbstractPaintingState
* 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 org.apache.fop.util.AbstractPaintingState
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 org.apache.fop.util.AbstractPaintingState
}
/** {@inheritDoc} */
+ @Override
public String toString() {
return super.toString()
+ ", paint=" + paint
@@ -249,6 +262,7 @@ public class PDFPaintingState extends org.apache.fop.util.AbstractPaintingState
}
/** {@inheritDoc} */
+ @Override
protected AbstractData instantiate() {
return new PDFData();
}
diff --git a/src/java/org/apache/fop/render/intermediate/IFSerializer.java b/src/java/org/apache/fop/render/intermediate/IFSerializer.java
index 37806cb8e..2c45bfcd6 100644
--- a/src/java/org/apache/fop/render/intermediate/IFSerializer.java
+++ b/src/java/org/apache/fop/render/intermediate/IFSerializer.java
@@ -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 AbstractXMLWritingIFDocumentHandler
}
/** {@inheritDoc} */
+ @Override
protected String getMainNamespace() {
return NAMESPACE;
}
@@ -101,6 +103,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
}
/** {@inheritDoc} */
+ @Override
public IFDocumentNavigationHandler getDocumentNavigationHandler() {
return this;
}
@@ -146,6 +149,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
}
/** {@inheritDoc} */
+ @Override
public void startDocument() throws IFException {
super.startDocument();
try {
@@ -161,6 +165,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
}
/** {@inheritDoc} */
+ @Override
public void startDocumentHeader() throws IFException {
try {
handler.startElement(EL_HEADER);
@@ -170,6 +175,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
}
/** {@inheritDoc} */
+ @Override
public void endDocumentHeader() throws IFException {
try {
handler.endElement(EL_HEADER);
@@ -179,6 +185,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
}
/** {@inheritDoc} */
+ @Override
public void startDocumentTrailer() throws IFException {
try {
handler.startElement(EL_TRAILER);
@@ -188,6 +195,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
}
/** {@inheritDoc} */
+ @Override
public void endDocumentTrailer() throws IFException {
try {
handler.endElement(EL_TRAILER);
@@ -264,6 +272,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
}
/** {@inheritDoc} */
+ @Override
public void startPageHeader() throws IFException {
try {
handler.startElement(EL_PAGE_HEADER);
@@ -273,6 +282,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
}
/** {@inheritDoc} */
+ @Override
public void endPageHeader() throws IFException {
try {
handler.endElement(EL_PAGE_HEADER);
@@ -303,6 +313,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
}
/** {@inheritDoc} */
+ @Override
public void startPageTrailer() throws IFException {
try {
handler.startElement(EL_PAGE_TRAILER);
@@ -312,6 +323,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
}
/** {@inheritDoc} */
+ @Override
public void endPageTrailer() throws IFException {
try {
commitNavigation();
@@ -604,7 +616,8 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
}
}
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));
diff --git a/src/java/org/apache/fop/render/intermediate/IFState.java b/src/java/org/apache/fop/render/intermediate/IFState.java
index 5d669d3ef..e5b031dd3 100644
--- a/src/java/org/apache/fop/render/intermediate/IFState.java
+++ b/src/java/org/apache/fop/render/intermediate/IFState.java
@@ -21,6 +21,8 @@ package org.apache.fop.render.intermediate;
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;
diff --git a/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java b/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java
index a40ee1d5c..b0c003b91 100644
--- a/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java
+++ b/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java
@@ -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: "
diff --git a/src/java/org/apache/fop/traits/BorderProps.java b/src/java/org/apache/fop/traits/BorderProps.java
index 5bd4feec5..d6265fb50 100644
--- a/src/java/org/apache/fop/traits/BorderProps.java
+++ b/src/java/org/apache/fop/traits/BorderProps.java
@@ -96,11 +96,13 @@ public class BorderProps implements Serializable {
}
/** {@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 Serializable {
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 Serializable {
}
/** {@inheritDoc} */
+ @Override
public String toString() {
StringBuffer sbuf = new StringBuffer();
sbuf.append('(');
diff --git a/src/java/org/apache/fop/util/AbstractPaintingState.java b/src/java/org/apache/fop/util/AbstractPaintingState.java
index a5280c361..bd1bbb87b 100644
--- a/src/java/org/apache/fop/util/AbstractPaintingState.java
+++ b/src/java/org/apache/fop/util/AbstractPaintingState.java
@@ -76,8 +76,7 @@ public abstract class AbstractPaintingState implements Cloneable, Serializable {
*/
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 AbstractPaintingState implements Cloneable, Serializable {
*/
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 AbstractPaintingState implements Cloneable, Serializable {
}
/** {@inheritDoc} */
+ @Override
public Object clone() {
AbstractPaintingState state = instantiate();
state.stateStack = new StateStack(this.stateStack);
@@ -376,6 +375,7 @@ public abstract class AbstractPaintingState implements Cloneable, Serializable {
}
/** {@inheritDoc} */
+ @Override
public String toString() {
return ", stateStack=" + stateStack
+ ", currentData=" + data;
@@ -509,6 +509,7 @@ public abstract class AbstractPaintingState implements Cloneable, Serializable {
}
/** {@inheritDoc} */
+ @Override
public Object clone() {
AbstractData data = instantiate();
data.color = this.color;
@@ -525,6 +526,7 @@ public abstract class AbstractPaintingState implements Cloneable, Serializable {
}
/** {@inheritDoc} */
+ @Override
public String toString() {
return "color=" + color
+ ", backColor=" + backColor
diff --git a/src/java/org/apache/fop/util/ColorSpaceCache.java b/src/java/org/apache/fop/util/ColorSpaceCache.java
index e124232f3..645245003 100644
--- a/src/java/org/apache/fop/util/ColorSpaceCache.java
+++ b/src/java/org/apache/fop/util/ColorSpaceCache.java
@@ -31,7 +31,8 @@ import javax.xml.transform.stream.StreamSource;
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;
}
diff --git a/src/java/org/apache/fop/util/ColorUtil.java b/src/java/org/apache/fop/util/ColorUtil.java
index 608023b76..5a53a816c 100644
--- a/src/java/org/apache/fop/util/ColorUtil.java
+++ b/src/java/org/apache/fop/util/ColorUtil.java
@@ -34,8 +34,8 @@ import org.apache.xmlgraphics.java2d.color.ColorSpaceOrigin;
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));