xmlgraphics-commons 1.4

org.apache.xmlgraphics.image.codec.tiff
Class TIFFImageEncoder

java.lang.Object
  extended by org.apache.xmlgraphics.image.codec.util.ImageEncoderImpl
      extended by org.apache.xmlgraphics.image.codec.tiff.TIFFImageEncoder
All Implemented Interfaces:
ImageEncoder

public class TIFFImageEncoder
extends ImageEncoderImpl

A baseline TIFF writer. The writer outputs TIFF images in either Bilevel, Greyscale, Palette color or Full Color modes.


Field Summary
 
Fields inherited from class org.apache.xmlgraphics.image.codec.util.ImageEncoderImpl
output, param
 
Constructor Summary
TIFFImageEncoder(java.io.OutputStream output, ImageEncodeParam param)
           
 
Method Summary
 void encode(java.awt.image.RenderedImage im)
          Encodes a RenderedImage and writes the output to the OutputStream associated with this ImageEncoder.
 java.lang.Object encodeMultiple(java.lang.Object context, java.awt.image.RenderedImage img)
          Encodes a RenderedImage as part of a multi-page file and writes the output to the OutputStream associated with this ImageEncoder.
 void finishMultiple(java.lang.Object context)
          Signals the encoder that you've finished sending pages for a multi-page image files.
 
Methods inherited from class org.apache.xmlgraphics.image.codec.util.ImageEncoderImpl
encode, getOutputStream, getParam, setParam
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TIFFImageEncoder

public TIFFImageEncoder(java.io.OutputStream output,
                        ImageEncodeParam param)
Method Detail

encode

public void encode(java.awt.image.RenderedImage im)
            throws java.io.IOException
Encodes a RenderedImage and writes the output to the OutputStream associated with this ImageEncoder.

Specified by:
encode in interface ImageEncoder
Specified by:
encode in class ImageEncoderImpl
Throws:
java.io.IOException

encodeMultiple

public java.lang.Object encodeMultiple(java.lang.Object context,
                                       java.awt.image.RenderedImage img)
                                throws java.io.IOException
Encodes a RenderedImage as part of a multi-page file and writes the output to the OutputStream associated with this ImageEncoder.

When you sent all pages, make sure you call finishMultiple() in the end. Otherwise, the generated file will be corrupted.

Parameters:
context - the context object you receive as return value to a previous call to encodeMultiple(). Set null for the first image.
img - the image
Returns:
a context object needed for writing multiple pages for a single image file
Throws:
java.io.IOException - In case of an I/O error

finishMultiple

public void finishMultiple(java.lang.Object context)
                    throws java.io.IOException
Signals the encoder that you've finished sending pages for a multi-page image files.

Parameters:
context - the context object you receive as return value to a previous call to encodeMultiple()
Throws:
java.io.IOException - In case of an I/O error

xmlgraphics-commons 1.4

Copyright 1999-2010 The Apache Software Foundation. All Rights Reserved.