From 3c839549f3deefeba13214cf950aee3b5b832523 Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Tue, 1 Feb 2011 20:03:46 +0000 Subject: Bugzilla 50698: Changes after updating XGC JAR git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1066182 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/util/ColorProfileUtil.java | 30 +++++----------------- src/java/org/apache/fop/util/ColorSpaceCache.java | 9 ++++--- 2 files changed, 12 insertions(+), 27 deletions(-) (limited to 'src/java/org/apache/fop/util') diff --git a/src/java/org/apache/fop/util/ColorProfileUtil.java b/src/java/org/apache/fop/util/ColorProfileUtil.java index 35b6660dc..9ee34d2b6 100644 --- a/src/java/org/apache/fop/util/ColorProfileUtil.java +++ b/src/java/org/apache/fop/util/ColorProfileUtil.java @@ -19,13 +19,11 @@ package org.apache.fop.util; -import java.awt.color.ColorSpace; -import java.awt.color.ICC_ColorSpace; import java.awt.color.ICC_Profile; -import java.io.UnsupportedEncodingException; /** * Helper methods for handling color profiles. + * @deprecated use org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil directly */ public final class ColorProfileUtil { @@ -36,21 +34,11 @@ public final class ColorProfileUtil { * Returns the profile description of an ICC profile * @param profile the profile * @return the description + * @deprecated use org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil directly */ public static String getICCProfileDescription(ICC_Profile profile) { - byte[] data = profile.getData(ICC_Profile.icSigProfileDescriptionTag); - if (data == null) { - return null; - } else { - //Info on the data format: http://www.color.org/ICC-1_1998-09.PDF - int length = (data[8] << 3 * 8) | (data[9] << 2 * 8) | (data[10] << 8) | data[11]; - length--; //Remove trailing NUL character - try { - return new String(data, 12, length, "US-ASCII"); - } catch (UnsupportedEncodingException e) { - throw new UnsupportedOperationException("Incompatible VM"); - } - } + return org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil + .getICCProfileDescription(profile); } /** @@ -58,14 +46,10 @@ public final class ColorProfileUtil { * provided by the Java class library. * @param profile the color profile to check * @return true if it is the default sRGB profile + * @deprecated use org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil directly */ public static boolean isDefaultsRGB(ICC_Profile profile) { - ColorSpace sRGB = ColorSpace.getInstance(ColorSpace.CS_sRGB); - ICC_Profile sRGBProfile = null; - if (sRGB instanceof ICC_ColorSpace) { - sRGBProfile = ((ICC_ColorSpace)sRGB).getProfile(); - } - return profile == sRGBProfile; + return org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil + .isDefaultsRGB(profile); } - } diff --git a/src/java/org/apache/fop/util/ColorSpaceCache.java b/src/java/org/apache/fop/util/ColorSpaceCache.java index 7b3f409e0..63d8746f7 100644 --- a/src/java/org/apache/fop/util/ColorSpaceCache.java +++ b/src/java/org/apache/fop/util/ColorSpaceCache.java @@ -31,6 +31,7 @@ import javax.xml.transform.stream.StreamSource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil; /** * Map with cached ICC based ColorSpace objects. @@ -40,7 +41,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 colorSpaceMap + = Collections.synchronizedMap(new java.util.HashMap()); /** * Default constructor @@ -74,7 +76,7 @@ public class ColorSpaceCache { if (src != null && src instanceof StreamSource) { // FOP URI resolver found ICC profile - create ICC profile // from the Source - iccProfile = ICC_Profile.getInstance(((StreamSource) src) + iccProfile = ColorProfileUtil.getICC_Profile(((StreamSource) src) .getInputStream()); } else { // TODO - Would it make sense to fall back on VM ICC @@ -102,8 +104,7 @@ public class ColorSpaceCache { log.warn("Color profile '" + iccProfileSrc + "' not found."); } } else { - colorSpace = (ColorSpace)colorSpaceMap.get(base - + iccProfileSrc); + colorSpace = colorSpaceMap.get(base + iccProfileSrc); } return colorSpace; } -- cgit v1.2.3 From 99958ef6253a233b4ffeabf5711ba65ac4b71061 Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Wed, 2 Feb 2011 20:57:06 +0000 Subject: Generify ListUtil methods git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1066626 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/util/ListUtil.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/java/org/apache/fop/util') diff --git a/src/java/org/apache/fop/util/ListUtil.java b/src/java/org/apache/fop/util/ListUtil.java index d97457510..8e88e4cbf 100644 --- a/src/java/org/apache/fop/util/ListUtil.java +++ b/src/java/org/apache/fop/util/ListUtil.java @@ -34,22 +34,22 @@ public final class ListUtil { /** * Retrieve the last element from a list. * - * @param list - * The list to work on + * @param the type of objects stored in the list + * @param list the list to work on * @return last element */ - public static Object getLast(List list) { + public static T getLast(List list) { return list.get(list.size() - 1); } /** * Retrieve and remove the last element from a list. * - * @param list - * The list to work on + * @param the type of objects stored in the list + * @param list the list to work on * @return previous last element */ - public static Object removeLast(List list) { + public static T removeLast(List list) { return list.remove(list.size() - 1); } } -- cgit v1.2.3 From 970c98732f842b3bf9700cc218434f0e893f79fa Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Mon, 7 Feb 2011 08:36:51 +0000 Subject: Bugfix: toBufferedImage() didn't actually transfer the image data at all. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1067879 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/java/org/apache/fop/util') diff --git a/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java b/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java index b2706c5c2..4bfc74a39 100644 --- a/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java +++ b/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java @@ -213,7 +213,9 @@ public final class BitmapImageUtil { WritableRaster wr = img.getColorModel().createCompatibleWritableRaster( img.getWidth(), img.getHeight()); boolean premult = img.getColorModel().isAlphaPremultiplied(); - return new BufferedImage(img.getColorModel(), wr, premult, null); + BufferedImage buf = new BufferedImage(img.getColorModel(), wr, premult, null); + transferImage(img, buf); + return buf; } } -- cgit v1.2.3