aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorPeter Hancock <phancock@apache.org>2012-09-13 12:45:27 +0000
committerPeter Hancock <phancock@apache.org>2012-09-13 12:45:27 +0000
commitd99dc75ffa1d37817ce18cff188fdabc29f9f73e (patch)
tree57e54bc96b79ce2980a5ed00afb0bd5ff313aab6 /src/java
parent03bedaf0caa6c39823437e43b2f8547d476d24e7 (diff)
downloadxmlgraphics-fop-d99dc75ffa1d37817ce18cff188fdabc29f9f73e.tar.gz
xmlgraphics-fop-d99dc75ffa1d37817ce18cff188fdabc29f9f73e.zip
Bugzilla #53865: Add Rows per Strip configuration for Tiff renderer
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1384310 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java4
-rw-r--r--src/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java19
-rw-r--r--src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java8
3 files changed, 27 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java b/src/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java
index 48e79520f..d536167c3 100644
--- a/src/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java
+++ b/src/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java
@@ -19,9 +19,12 @@
package org.apache.fop.render.bitmap;
+import org.apache.xmlgraphics.image.writer.ResolutionUnit;
+
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigParser;
import org.apache.fop.render.intermediate.IFContext;
+import org.apache.fop.render.intermediate.IFDocumentHandler;
import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
/**
@@ -32,6 +35,7 @@ public class TIFFDocumentHandler extends AbstractBitmapDocumentHandler {
TIFFDocumentHandler(IFContext context) {
super(context);
+ getSettings().getWriterParams().setResolutionUnit(ResolutionUnit.CENTIMETER);
}
/** {@inheritDoc} */
diff --git a/src/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java b/src/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java
index 3c833d3b0..1e44397f6 100644
--- a/src/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java
+++ b/src/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java
@@ -23,21 +23,24 @@ import java.util.EnumMap;
import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.xmlgraphics.util.MimeConstants;
-
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.MimeConstants;
import org.apache.fop.fonts.DefaultFontConfig;
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser;
import org.apache.fop.render.RendererConfigOption;
+import static org.apache.fop.render.bitmap.TIFFCompressionValue.PACKBITS;
+
/**
* The renderer configuration object for the TIFF renderer.
*/
public final class TIFFRendererConfig extends BitmapRendererConfig {
public enum TIFFRendererOption implements RendererConfigOption {
- COMPRESSION("compression", TIFFCompressionValue.PACKBITS);
+ COMPRESSION("compression", PACKBITS),
+ /** option to encode one row per strip or a all rows in a single strip*/
+ SINGLE_STRIP("single-strip", Boolean.FALSE);
private final String name;
private final Object defaultValue;
@@ -68,6 +71,14 @@ public final class TIFFRendererConfig extends BitmapRendererConfig {
}
/**
+ * @return True if all rows are contained in a single strip, False each strip contains one row or null
+ * if not set.
+ */
+ public Boolean isSingleStrip() {
+ return (Boolean) params.get(TIFFRendererOption.SINGLE_STRIP);
+ }
+
+ /**
* The TIFF renderer configuration parser.
*/
public static final class TIFFRendererConfigParser extends BitmapRendererConfigParser {
@@ -94,6 +105,8 @@ public final class TIFFRendererConfig extends BitmapRendererConfig {
if (cfg != null) {
setParam(TIFFRendererOption.COMPRESSION,
TIFFCompressionValue.getType(getValue(cfg, TIFFRendererOption.COMPRESSION)));
+ setParam(TIFFRendererOption.SINGLE_STRIP, Boolean.valueOf(getValue(cfg,
+ TIFFRendererOption.SINGLE_STRIP)));
}
return config;
}
diff --git a/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java b/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java
index 593934b45..19abb8131 100644
--- a/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java
+++ b/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java
@@ -76,7 +76,12 @@ public class TIFFRendererConfigurator extends BitmapRendererConfigurator {
}
}
- /** {@inheritDoc} */
+ private boolean isSingleStrip(TIFFRendererConfig config) {
+ Boolean singleRowPerStrip = config.isSingleStrip();
+ return singleRowPerStrip == null ? false : singleRowPerStrip;
+ }
+
+ @Override
public void configure(IFDocumentHandler documentHandler) throws FOPException {
final TIFFRendererConfig config = (TIFFRendererConfig) getRendererConfig(documentHandler);
if (config != null) {
@@ -84,6 +89,7 @@ public class TIFFRendererConfigurator extends BitmapRendererConfigurator {
BitmapRenderingSettings settings = tiffHandler.getSettings();
configure(documentHandler, settings, new TIFFRendererConfigParser());
setCompressionMethod(config.getCompressionType(), settings);
+ settings.getWriterParams().setSingleStrip(isSingleStrip(config));
}
}