<transparent-page-background>true</transparent-page-background>
<compression>CCITT T.6</compression>
<single-strip>true</single-strip>
+ <endianness>default</endianness>
<fonts><!-- described elsewhere --></fonts>
</renderer>]]></source>
<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>
+ <p>
+ The default value for <code>"endianness"</code> is <code>"default"</code>, which results in the
+ default endianness for the output format being generated. Note that not all image formats allow
+ specifying the endianness.
+ </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;
TIFFDocumentHandler(IFContext context) {
super(context);
- getSettings().getWriterParams().setResolutionUnit(ResolutionUnit.CENTIMETER);
}
/** {@inheritDoc} */
import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.xmlgraphics.image.writer.Endianness;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.MimeConstants;
public enum TIFFRendererOption implements RendererConfigOption {
COMPRESSION("compression", PACKBITS),
/** option to encode one row per strip or a all rows in a single strip*/
- SINGLE_STRIP("single-strip", Boolean.FALSE);
+ SINGLE_STRIP("single-strip", Boolean.FALSE),
+ /** option to determine whether to use little or big endian encoding */
+ ENDIANNESS("endianness", Endianness.DEFAULT);
private final String name;
private final Object defaultValue;
return (Boolean) params.get(TIFFRendererOption.SINGLE_STRIP);
}
+ /**
+ * @return returns an object to determine whether little or big endian encoding is used
+ */
+ public Endianness getEndianness() {
+ return (Endianness) params.get(TIFFRendererOption.ENDIANNESS);
+ }
+
/**
* The TIFF renderer configuration parser.
*/
TIFFCompressionValue.getType(getValue(cfg, TIFFRendererOption.COMPRESSION)));
setParam(TIFFRendererOption.SINGLE_STRIP, Boolean.valueOf(getValue(cfg,
TIFFRendererOption.SINGLE_STRIP)));
+ setParam(TIFFRendererOption.ENDIANNESS,
+ Endianness.getEndianType(getValue(cfg, TIFFRendererOption.ENDIANNESS)));
}
return config;
}
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.xmlgraphics.image.writer.Endianness;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.render.Renderer;
return singleRowPerStrip == null ? false : singleRowPerStrip;
}
+ private Endianness getEndianness(TIFFRendererConfig config) {
+ Endianness endianMode = config.getEndianness();
+ return endianMode == null ? Endianness.DEFAULT : endianMode;
+ }
+
@Override
public void configure(IFDocumentHandler documentHandler) throws FOPException {
final TIFFRendererConfig config = (TIFFRendererConfig) getRendererConfig(documentHandler);
configure(documentHandler, settings, new TIFFRendererConfigParser());
setCompressionMethod(config.getCompressionType(), settings);
settings.getWriterParams().setSingleStrip(isSingleStrip(config));
+ settings.getWriterParams().setEndianness(getEndianness(config));
}
}
package org.apache.fop.apps;
import static org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererOption.COMPRESSION;
+import static org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererOption.ENDIANNESS;
import static org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererOption.SINGLE_STRIP;
public class TIFFRendererConfBuilder extends BitmapRendererConfBuilder {
createTextElement(SINGLE_STRIP, String.valueOf(single));
return this;
}
+
+ public TIFFRendererConfBuilder setEndianness(String endianness) {
+ createTextElement(ENDIANNESS, endianness);
+ return this;
+ }
}
import org.junit.Test;
+import org.apache.xmlgraphics.image.writer.Endianness;
+
import org.apache.fop.apps.FopConfBuilder;
import org.apache.fop.apps.TIFFRendererConfBuilder;
import org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigParser;
parseConfig(createRenderer().setSingleStrip(false));
assertFalse(getConfig().isSingleStrip());
}
+
+ @Test
+ public void testEndianness() throws Exception {
+ for (Endianness value : Endianness.values()) {
+ parseConfig(createRenderer().setEndianness(value.toString()));
+ assertEquals(value, getConfig().getEndianness());
+ }
+ }
}
import org.junit.Test;
+import org.apache.xmlgraphics.image.writer.Endianness;
import org.apache.fop.apps.FopConfBuilder;
import org.apache.fop.apps.MimeConstants;
assertFalse(settings.getWriterParams().isSingleStrip());
}
+ @Test
+ public void testEndianness() throws Exception {
+ for (Endianness value : Endianness.values()) {
+ parseConfig(createBuilder().setEndianness(value.toString()));
+ assertEquals(value, settings.getWriterParams().getEndianness());
+ }
+ }
+
}