diff options
author | Jeremias Maerki <jeremias@apache.org> | 2011-02-10 14:09:42 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2011-02-10 14:09:42 +0000 |
commit | df68e0c99457e88e53bb6a434487712902ff382d (patch) | |
tree | 919f2e9441c2c188e98ab52a2b1144f7562d5941 /src/java/org/apache/fop/util | |
parent | b190db6910a3e133d8c1696b4730d77383f98c92 (diff) | |
parent | f1269cc280b846cd6da396177bc74c4c9808579e (diff) | |
download | xmlgraphics-fop-df68e0c99457e88e53bb6a434487712902ff382d.tar.gz xmlgraphics-fop-df68e0c99457e88e53bb6a434487712902ff382d.zip |
Merge from Trunk, revisions 1060235 to 1069383.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Color@1069397 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/util')
4 files changed, 18 insertions, 31 deletions
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 645245003..63db937a0 100644 --- a/src/java/org/apache/fop/util/ColorSpaceCache.java +++ b/src/java/org/apache/fop/util/ColorSpaceCache.java @@ -30,6 +30,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; import org.apache.xmlgraphics.java2d.color.ICCColorSpaceWithIntent; import org.apache.xmlgraphics.java2d.color.RenderingIntent; @@ -81,7 +82,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 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 <T> 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> T getLast(List<T> list) { return list.get(list.size() - 1); } /** * Retrieve and remove the last element from a list. * - * @param list - * The list to work on + * @param <T> 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> T removeLast(List<T> list) { return list.remove(list.size() - 1); } } 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; } } |