<source><![CDATA[<renderer mime="image/tiff">
<transparent-page-background>true</transparent-page-background>
<compression>CCITT T.6</compression>
+ <single-strip>true</single-strip>
<fonts><!-- described elsewhere --></fonts>
</renderer>]]></source>
<p>
added separately. The internal TIFF codec from XML Graphics Commons only supports PackBits,
Deflate and JPEG compression for writing.
</note>
+ <p>
+ The default value for the <code>"single-strip"</code> is <code>"false"</code> resulting in the RowsPerStrip Tiff Tag equal to the number of rows.
+ If set to <code>true</code> RowsPerStrip is set to 1.
+ </p>
</section>
<section id="bitmap-rendering-options">
<title>Runtime Rendering Options</title>
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;
/**
TIFFDocumentHandler(IFContext context) {
super(context);
+ getSettings().getWriterParams().setResolutionUnit(ResolutionUnit.CENTIMETER);
}
/** {@inheritDoc} */
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;
return (TIFFCompressionValue) params.get(TIFFRendererOption.COMPRESSION);
}
+ /**
+ * @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.
*/
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;
}
}
}
- /** {@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) {
BitmapRenderingSettings settings = tiffHandler.getSettings();
configure(documentHandler, settings, new TIFFRendererConfigParser());
setCompressionMethod(config.getCompressionType(), settings);
+ settings.getWriterParams().setSingleStrip(isSingleStrip(config));
}
}
documents. Example: the fix of marks layering will be such a case when it's done.
-->
<release version="FOP Trunk" date="TBD">
+ <action context="Renderers" dev="PH" type="add" fixes-bug="53865" importance="low">
+ Added configuration for RowPerStrip configuration in the Tiff renderer.
+ RowsPerStrip can be configured to 1 or to the total # of rows.
+ See docs for fop.xconf configuration details.
+ </action>
<action context="Layout" dev="VH" type="fix" fixes-bug="53598" due-to="Robert Meyer">
Always set the breakClass field to a legal value in BreakElement, so as to avoid
IllegalArgumentExceptions in other parts of the code.
package org.apache.fop.apps;
import static org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererOption.COMPRESSION;
-
+import static org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererOption.SINGLE_STRIP;
public class TIFFRendererConfBuilder extends BitmapRendererConfBuilder {
public TIFFRendererConfBuilder() {
createTextElement(COMPRESSION, mode);
return this;
}
+
+ public TIFFRendererConfBuilder setSingleStrip(boolean single) {
+ createTextElement(SINGLE_STRIP, String.valueOf(single));
+ return this;
+ }
}
import org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigParser;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
public class TIFFRendererConfigParserTestCase
- extends AbstractBitmapRendererConfigParserTester {
+extends AbstractBitmapRendererConfigParserTester {
public TIFFRendererConfigParserTestCase() {
super(new TIFFRendererConfigParser());
assertEquals(value, getConfig().getCompressionType());
}
}
+
+ @Test
+ public void testSingleStrip() throws Exception {
+ parseConfig(createRenderer().setSingleStrip(true));
+ assertTrue(getConfig().isSingleStrip());
+ parseConfig(createRenderer().setSingleStrip(false));
+ assertFalse(getConfig().isSingleStrip());
+ }
}
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
import org.apache.fop.apps.FopConfBuilder;
import org.apache.fop.apps.MimeConstants;
import static org.apache.fop.render.bitmap.TIFFCompressionValue.CCITT_T4;
import static org.apache.fop.render.bitmap.TIFFCompressionValue.CCITT_T6;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
public class TIFFRendererConfiguratorTestCase extends AbstractBitmapRendererConfiguratorTest {
}
}
}
+
+ @Test
+ public void testSingleStrip() throws Exception {
+ parseConfig(createBuilder().setSingleStrip(true));
+ assertTrue(settings.getWriterParams().isSingleStrip());
+ parseConfig(createBuilder().setSingleStrip(false));
+ assertFalse(settings.getWriterParams().isSingleStrip());
+ }
+
}