diff options
author | Jeremias Maerki <jeremias@apache.org> | 2006-03-18 20:28:33 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2006-03-18 20:28:33 +0000 |
commit | 148095dd2eb3b68a27f0d76a13beff79cc8b4336 (patch) | |
tree | 4fa5912c2c32e9d56a71fd29396dd9504563bbbf /src | |
parent | 97a13831e8fce797ad4d321b778ba0af69d6eddf (diff) | |
download | xmlgraphics-fop-148095dd2eb3b68a27f0d76a13beff79cc8b4336.tar.gz xmlgraphics-fop-148095dd2eb3b68a27f0d76a13beff79cc8b4336.zip |
Bugfix: CCITT Group 4 encoded TIFF images were not properly embedded in PDF files. FopPDFImage always used the bits/pixel and color space of the original image although our image adapter mostly convert all images to 24bit RGB. One day, we will need to improve the image handling.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@386879 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/image/AbstractFopImage.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/pdf/FopPDFImage.java | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/image/AbstractFopImage.java b/src/java/org/apache/fop/image/AbstractFopImage.java index f64fdfb72..af4593038 100644 --- a/src/java/org/apache/fop/image/AbstractFopImage.java +++ b/src/java/org/apache/fop/image/AbstractFopImage.java @@ -216,7 +216,7 @@ public abstract class AbstractFopImage implements FopImage { try { this.raw = IOUtils.toByteArray(inputStream); } catch (java.io.IOException ex) { - log.error("Error while loading image (EMF): " + ex.getMessage(), ex); + log.error("Error while reading raw image: " + ex.getMessage(), ex); return false; } finally { IOUtils.closeQuietly(inputStream); diff --git a/src/java/org/apache/fop/render/pdf/FopPDFImage.java b/src/java/org/apache/fop/render/pdf/FopPDFImage.java index e709b26ad..d35204e9e 100644 --- a/src/java/org/apache/fop/render/pdf/FopPDFImage.java +++ b/src/java/org/apache/fop/render/pdf/FopPDFImage.java @@ -150,14 +150,24 @@ public class FopPDFImage implements PDFImage { */ public PDFColorSpace getColorSpace() { // DeviceGray, DeviceRGB, or DeviceCMYK - return toPDFColorSpace(fopImage.getColorSpace()); + if (isCCF || isDCT || isPS) { + return toPDFColorSpace(fopImage.getColorSpace()); + } else { + return toPDFColorSpace(ColorSpace.getInstance(ColorSpace.CS_sRGB)); + } } /** * @see org.apache.fop.pdf.PDFImage#getBitsPerPixel() */ public int getBitsPerPixel() { - return fopImage.getBitsPerPixel(); + if (isCCF) { + return fopImage.getBitsPerPixel(); + } else { + return 8; //TODO This is suboptimal, handling everything as RGB + //The image wrappers can mostly only return RGB bitmaps right now. This should + //be improved so the renderers can deal directly with RenderedImage instances. + } } /** |