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/render/pdf/AbstractImageAdapter.java11
-rw-r--r--src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java3
-rw-r--r--src/java/org/apache/fop/render/ps/PSImageHandlerRenderedImage.java2
3 files changed, 13 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java b/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java
index 40e5225d2..58299c528 100644
--- a/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java
+++ b/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java
@@ -20,13 +20,16 @@
package org.apache.fop.render.pdf;
import java.awt.color.ColorSpace;
import java.awt.color.ICC_Profile;
+import java.awt.image.DataBufferByte;
import java.awt.image.IndexColorModel;
+import java.awt.image.Raster;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.xmlgraphics.image.loader.Image;
+import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
import org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil;
import org.apache.fop.pdf.PDFArray;
@@ -257,7 +260,13 @@ public abstract class AbstractImageAdapter implements PDFImage {
indexed.add(baout.toByteArray());
dict.put("ColorSpace", indexed);
- dict.put("BitsPerComponent", icm.getPixelSize());
+
+ Raster raster = ((ImageRendered)image).getRenderedImage().getTile(0, 0);
+ if (raster.getDataBuffer() instanceof DataBufferByte) {
+ dict.put("BitsPerComponent", icm.getPixelSize());
+ } else {
+ dict.put("BitsPerComponent", 8);
+ }
Integer index = getIndexOfFirstTransparentColorInPalette(icm);
if (index != null) {
diff --git a/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java b/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java
index b0b7b79d1..1b87958c2 100644
--- a/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java
+++ b/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java
@@ -63,7 +63,7 @@ public class ImageRenderedAdapter extends AbstractImageAdapter {
*/
public ImageRenderedAdapter(ImageRendered image, String key) {
super(image, key);
- this.encodingHelper = new ImageEncodingHelper(image.getRenderedImage(), true);
+ this.encodingHelper = new ImageEncodingHelper(image.getRenderedImage());
}
/**
@@ -195,6 +195,7 @@ public class ImageRenderedAdapter extends AbstractImageAdapter {
/** {@inheritDoc} */
public void outputContents(OutputStream out) throws IOException {
long start = System.currentTimeMillis();
+ encodingHelper.setBWInvert(true);
encodingHelper.encode(out);
long duration = System.currentTimeMillis() - start;
if (log.isDebugEnabled()) {
diff --git a/src/java/org/apache/fop/render/ps/PSImageHandlerRenderedImage.java b/src/java/org/apache/fop/render/ps/PSImageHandlerRenderedImage.java
index 46597e46d..d943f1ce8 100644
--- a/src/java/org/apache/fop/render/ps/PSImageHandlerRenderedImage.java
+++ b/src/java/org/apache/fop/render/ps/PSImageHandlerRenderedImage.java
@@ -69,7 +69,7 @@ public class PSImageHandlerRenderedImage implements PSImageHandler {
ImageEncodingHelper helper = new ImageEncodingHelper(ri);
ColorModel cm = helper.getEncodedColorModel();
- PSImageUtils.writeImage(encoder, imgDim, imgDescription, targetRect, cm, gen);
+ PSImageUtils.writeImage(encoder, imgDim, imgDescription, targetRect, cm, gen, ri);
}
/** {@inheritDoc} */