aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Reischenbacher <matthias@apache.org>2015-11-26 18:53:01 +0000
committerMatthias Reischenbacher <matthias@apache.org>2015-11-26 18:53:01 +0000
commitff9fc9454ed9c1b8ca930b206a1a90f227639b4b (patch)
tree367114d7176f8fa772900229ceef33aa6ee705b6
parent7525cefbad4cc2d1712d0875e2825e8b67cd6aaf (diff)
downloadxmlgraphics-fop-ff9fc9454ed9c1b8ca930b206a1a90f227639b4b.tar.gz
xmlgraphics-fop-ff9fc9454ed9c1b8ca930b206a1a90f227639b4b.zip
FOP-2512: fix issue with transparent PNGs with indexed color model
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1716758 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java b/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java
index f1e816233..c1eaa07c9 100644
--- a/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java
+++ b/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java
@@ -23,6 +23,7 @@ import java.awt.color.ICC_ColorSpace;
import java.awt.color.ICC_Profile;
import java.awt.image.ColorModel;
import java.awt.image.IndexColorModel;
+import java.awt.image.Raster;
import java.awt.image.RenderedImage;
import java.io.IOException;
import java.io.OutputStream;
@@ -30,6 +31,7 @@ import java.io.OutputStream;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.xmlgraphics.image.GraphicsUtil;
import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
import org.apache.xmlgraphics.ps.ImageEncodingHelper;
@@ -124,8 +126,11 @@ public class ImageRenderedAdapter extends AbstractImageAdapter {
//TODO Implement code to combine image with background color if transparency is not
//allowed (need BufferedImage support for that)
- AlphaRasterImage alphaImage = new AlphaRasterImage("Mask:" + getKey(), ri);
- this.softMask = doc.addImage(null, alphaImage).makeReference();
+ Raster raster = GraphicsUtil.getAlphaRaster(ri);
+ if (raster != null) {
+ AlphaRasterImage alphaImage = new AlphaRasterImage("Mask:" + getKey(), raster);
+ this.softMask = doc.addImage(null, alphaImage).makeReference();
+ }
}
}