org.libtiff.jai.codecimpl
Class XTIFFPackTileCodec

java.lang.Object
  extended by org.libtiff.jai.codec.XTIFFTileCodecImpl
      extended by org.libtiff.jai.codecimpl.XTIFFPackTileCodec
All Implemented Interfaces:
XTIFFTileCodec

public class XTIFFPackTileCodec
extends XTIFFTileCodecImpl

This codec encapsulates all the logic for the default TIFF "packbits" bit-packing codec algorithm.


Constructor Summary
XTIFFPackTileCodec()
           
 
Method Summary
 boolean canEncode()
          Indicate whether this codec can encode data.
 XTIFFTileCodec create()
          Implement this to return the corresponding empty codec object.
 void decodeTilePixels(byte[] input, java.awt.Rectangle newRect, byte[] bdata)
          Decode a rectangle of pixels
 void decodeTilePixels(byte[] input, java.awt.Rectangle newRect, short[] sdata)
          Decode a rectangle of pixels
 int encodeTilePixels(int[] pixels, java.awt.Rectangle newRect, byte[] bpixels)
          encode the tile into bpixels and return the byte size (uncompressed packing algorithm).
 void register()
          Registration method.
 
Methods inherited from class org.libtiff.jai.codec.XTIFFTileCodecImpl
create, create, decode, encode, getCompressedTileSize, getCompression, initialize, initializeDecoding, initializeEncoding, register
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XTIFFPackTileCodec

public XTIFFPackTileCodec()
Method Detail

create

public XTIFFTileCodec create()
Description copied from class: XTIFFTileCodecImpl
Implement this to return the corresponding empty codec object.

Specified by:
create in class XTIFFTileCodecImpl

canEncode

public boolean canEncode()
Description copied from class: XTIFFTileCodecImpl
Indicate whether this codec can encode data. Override to return true only if your codec implments encoding.

Overrides:
canEncode in class XTIFFTileCodecImpl

register

public void register()
Description copied from class: XTIFFTileCodecImpl
Registration method. Must be implemented by the extended class to register itself with the XTIFFDirectory for all compression codes it supports (e.g Fax codec supports 3 codes).

Specified by:
register in interface XTIFFTileCodec
Specified by:
register in class XTIFFTileCodecImpl
See Also:
XTIFFDirectory

encodeTilePixels

public int encodeTilePixels(int[] pixels,
                            java.awt.Rectangle newRect,
                            byte[] bpixels)
encode the tile into bpixels and return the byte size (uncompressed packing algorithm). The padding has already been done, so we may safely assume that pixels is exactly rows by cols by numBands ints.

Overrides:
encodeTilePixels in class XTIFFTileCodecImpl
Parameters:
pixels - input pixels
newRect - the array dimensions of samples
bpixels - the target array of compressed byte data

decodeTilePixels

public void decodeTilePixels(byte[] input,
                             java.awt.Rectangle newRect,
                             byte[] bdata)
Decode a rectangle of pixels

Specified by:
decodeTilePixels in class XTIFFTileCodecImpl
Parameters:
input - the byte array of compressed input data
newRect - the rectangular shape of the target pixels
bdata - the target decompressed pixels.

decodeTilePixels

public void decodeTilePixels(byte[] input,
                             java.awt.Rectangle newRect,
                             short[] sdata)
Decode a rectangle of pixels

Specified by:
decodeTilePixels in class XTIFFTileCodecImpl
Parameters:
input - the byte array of compressed input data
newRect - the rectangular shape of the target pixels
sdata - the target decompressed pixels.