diff options
author | Luis Bernardo <lbernardo@apache.org> | 2012-11-25 23:24:41 +0000 |
---|---|---|
committer | Luis Bernardo <lbernardo@apache.org> | 2012-11-25 23:24:41 +0000 |
commit | 89dbe6e14282ecdcfc2ec252c5ccfb1ab1d802c6 (patch) | |
tree | 575ca367712c830de1f2acdbc2ef67863803b7a9 /src/java/org | |
parent | 638ea00309ef225858fdc2b5ab2889e1236d783d (diff) | |
download | xmlgraphics-fop-89dbe6e14282ecdcfc2ec252c5ccfb1ab1d802c6.tar.gz xmlgraphics-fop-89dbe6e14282ecdcfc2ec252c5ccfb1ab1d802c6.zip |
bugzilla #54196: configure big / little endian support for TIFF images; patch 29628 applied; submitted by Robert Meyer
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1413442 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
3 files changed, 22 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 0de02c766..48e79520f 100644 --- a/src/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java +++ b/src/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java @@ -19,8 +19,6 @@ 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; @@ -34,7 +32,6 @@ 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 1e44397f6..f2535d456 100644 --- a/src/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java +++ b/src/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java @@ -23,6 +23,8 @@ import java.util.EnumMap; 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; @@ -40,7 +42,9 @@ public final class TIFFRendererConfig extends BitmapRendererConfig { 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; @@ -79,6 +83,13 @@ public final class TIFFRendererConfig extends BitmapRendererConfig { } /** + * @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. */ public static final class TIFFRendererConfigParser extends BitmapRendererConfigParser { @@ -107,6 +118,8 @@ public final class TIFFRendererConfig extends BitmapRendererConfig { 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; } diff --git a/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java b/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java index 19abb8131..fb24fa7bf 100644 --- a/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java +++ b/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java @@ -22,6 +22,8 @@ package org.apache.fop.render.bitmap; 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; @@ -81,6 +83,11 @@ public class TIFFRendererConfigurator extends BitmapRendererConfigurator { 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); @@ -90,6 +97,7 @@ public class TIFFRendererConfigurator extends BitmapRendererConfigurator { configure(documentHandler, settings, new TIFFRendererConfigParser()); setCompressionMethod(config.getCompressionType(), settings); settings.getWriterParams().setSingleStrip(isSingleStrip(config)); + settings.getWriterParams().setEndianness(getEndianness(config)); } } |