aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java
diff options
context:
space:
mode:
authorMehdi Houshmand <mehdi@apache.org>2012-08-28 15:08:23 +0000
committerMehdi Houshmand <mehdi@apache.org>2012-08-28 15:08:23 +0000
commit008bf019ad96ab80f1b8b1897180e30dd3c56925 (patch)
treeca349d363132404b2e823bbb0361e7d5422d972a /src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java
parent488c642a7a872f15bf0ae2b5d29f0746e181eca6 (diff)
downloadxmlgraphics-fop-008bf019ad96ab80f1b8b1897180e30dd3c56925.tar.gz
xmlgraphics-fop-008bf019ad96ab80f1b8b1897180e30dd3c56925.zip
Bugzilla#53790: Prevented the TIFF configurator from overriding the Bitmap configurator unless CCITT compression is enabled.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1378163 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java')
-rw-r--r--src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java37
1 files changed, 11 insertions, 26 deletions
diff --git a/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java b/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java
index b10f2a381..593934b45 100644
--- a/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java
+++ b/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java
@@ -19,13 +19,9 @@
package org.apache.fop.render.bitmap;
-import java.awt.image.BufferedImage;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.xmlgraphics.image.writer.ImageWriterParams;
-
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.render.Renderer;
@@ -33,9 +29,7 @@ import org.apache.fop.render.RendererConfig.RendererConfigParser;
import org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigParser;
import org.apache.fop.render.intermediate.IFDocumentHandler;
-import static org.apache.fop.render.bitmap.TIFFCompressionValues.CCITT_T4;
-import static org.apache.fop.render.bitmap.TIFFCompressionValues.CCITT_T6;
-import static org.apache.fop.render.bitmap.TIFFCompressionValues.NONE;
+import static org.apache.fop.render.bitmap.TIFFCompressionValue.NONE;
/**
* TIFF Renderer configurator
@@ -62,43 +56,34 @@ public class TIFFRendererConfigurator extends BitmapRendererConfigurator {
final TIFFRendererConfig config = (TIFFRendererConfig) getRendererConfig(renderer);
if (config != null) {
TIFFRenderer tiffRenderer = (TIFFRenderer) renderer;
- //set compression
- tiffRenderer.setBufferedImageType(getCompressionType(config, tiffRenderer.getWriterParams()));
+ setCompressionMethod(config.getCompressionType(), tiffRenderer.getRenderingSettings());
}
super.configure(renderer);
}
- private int getCompressionType(TIFFRendererConfig config, ImageWriterParams writerParms)
- throws FOPException {
- //Some compression formats need a special image format:
- TIFFCompressionValues compression = config.getCompressionType();
+ private void setCompressionMethod(TIFFCompressionValue compression,
+ BitmapRenderingSettings settings) throws FOPException {
if (compression != null) {
if (compression != NONE) {
- writerParms.setCompressionMethod(compression.getName());
+ settings.setCompressionMethod(compression.getName());
}
if (LOG.isInfoEnabled()) {
LOG.info("TIFF compression set to " + compression.getName());
}
- }
- return getBufferedImageTypeFor(compression);
- }
-
- private int getBufferedImageTypeFor(TIFFCompressionValues compressionType) {
- if (compressionType == CCITT_T6 || compressionType == CCITT_T4) {
- return BufferedImage.TYPE_BYTE_BINARY;
- } else {
- return BufferedImage.TYPE_INT_ARGB;
+ if (compression.hasCCITTCompression()) {
+ settings.setBufferedImageType(compression.getImageType());
+ }
}
}
/** {@inheritDoc} */
public void configure(IFDocumentHandler documentHandler) throws FOPException {
- final TIFFRendererConfig tiffConfig = (TIFFRendererConfig) getRendererConfig(documentHandler);
- if (tiffConfig != null) {
+ final TIFFRendererConfig config = (TIFFRendererConfig) getRendererConfig(documentHandler);
+ if (config != null) {
TIFFDocumentHandler tiffHandler = (TIFFDocumentHandler) documentHandler;
BitmapRenderingSettings settings = tiffHandler.getSettings();
configure(documentHandler, settings, new TIFFRendererConfigParser());
- settings.setBufferedImageType(getCompressionType(tiffConfig, settings.getWriterParams()));
+ setCompressionMethod(config.getCompressionType(), settings);
}
}