com.lowagie.text.pdf.codec
Class CCITTG4Encoder

java.lang.Object
  extended bycom.lowagie.text.pdf.codec.CCITTG4Encoder

public class CCITTG4Encoder
extends Object


Field Summary
private  int bits
          Output bit buffer.
private static int BLACK
          The CCITT numerical definition of black.
private static byte[] byteTable
           
private static int[][] horz
          Black and white horizontal mode table.
private static int[] horzMode
          Horizontal mode table.
private  int lineStride
           
private static int[][] makeupCodes
          Black and white make-up code table.
private static int[] makeupCodesBlack
          Make-up codes for black runs.
private static int[] makeupCodesWhite
          Make-up codes for white runs.
private  int ndex
          Number of bits in the output bit buffer.
private  ByteBuffer outBuf
           
private static int[][] pass
          Black and white pass mode table.
private static int[] passMode
          Pass mode table.
(package private)  byte[] refData
           
private static int[][] termCodes
          Black and white terminating code table.
private static int[] termCodesBlack
          Terminating codes for black runs.
private static int[] termCodesWhite
          Terminating codes for white runs.
private static int[][] vert
          Black and white vertical mode table.
private static int[] vertMode
          Vertical mode table.
private static int WHITE
          The CCITT numerical definition of white.
private  int width
           
 
Constructor Summary
CCITTG4Encoder(int width)
          Constructs a TIFFFaxEncoder for CCITT bilevel encoding.
 
Method Summary
private  void add1DBits(int count, int color)
          Get code for run and add to compressed bitstream.
private  void add2DBits(int[][] mode, int entry)
          Place entry from mode table into compressed bitstream.
private  void addEOFB()
          Add an End-of-Facsimile-Block (EOFB == 0x001001) to the compressed bitstream.
private  void addEOL(boolean is1DMode, boolean addFill, boolean add1)
          Add an End-of-Line (EOL == 0x001) to the compressed bitstream with optional byte alignment.
 byte[] close()
           
static byte[] compress(byte[] data, int width, int height)
           
 void encodeT6Line(byte[] data, int lineAddr)
           
 void encodeT6Lines(byte[] data, int lineAddr, int height)
           
private  void initBitBuf()
          Initialize bit buffer machinery.
private  int nextState(byte[] data, int base, int bitOffset, int maxOffset)
          Return min of maxOffset or offset of first pixel different from pixel at bitOffset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHITE

private static final int WHITE
The CCITT numerical definition of white.

See Also:
Constant Field Values

BLACK

private static final int BLACK
The CCITT numerical definition of black.

See Also:
Constant Field Values

byteTable

private static byte[] byteTable

termCodesBlack

private static int[] termCodesBlack
Terminating codes for black runs.


termCodesWhite

private static int[] termCodesWhite
Terminating codes for white runs.


makeupCodesBlack

private static int[] makeupCodesBlack
Make-up codes for black runs.


makeupCodesWhite

private static int[] makeupCodesWhite
Make-up codes for white runs.


passMode

private static int[] passMode
Pass mode table.


vertMode

private static int[] vertMode
Vertical mode table.


horzMode

private static int[] horzMode
Horizontal mode table.


termCodes

private static int[][] termCodes
Black and white terminating code table.


makeupCodes

private static int[][] makeupCodes
Black and white make-up code table.


pass

private static int[][] pass
Black and white pass mode table.


vert

private static int[][] vert
Black and white vertical mode table.


horz

private static int[][] horz
Black and white horizontal mode table.


bits

private int bits
Output bit buffer.


ndex

private int ndex
Number of bits in the output bit buffer.


outBuf

private ByteBuffer outBuf

width

private int width

lineStride

private int lineStride

refData

byte[] refData
Constructor Detail

CCITTG4Encoder

public CCITTG4Encoder(int width)
Constructs a TIFFFaxEncoder for CCITT bilevel encoding.

Method Detail

compress

public static byte[] compress(byte[] data,
                              int width,
                              int height)

encodeT6Lines

public void encodeT6Lines(byte[] data,
                          int lineAddr,
                          int height)

nextState

private int nextState(byte[] data,
                      int base,
                      int bitOffset,
                      int maxOffset)
Return min of maxOffset or offset of first pixel different from pixel at bitOffset.


initBitBuf

private void initBitBuf()
Initialize bit buffer machinery.


add1DBits

private void add1DBits(int count,
                       int color)
Get code for run and add to compressed bitstream.


add2DBits

private void add2DBits(int[][] mode,
                       int entry)
Place entry from mode table into compressed bitstream.


addEOL

private void addEOL(boolean is1DMode,
                    boolean addFill,
                    boolean add1)
Add an End-of-Line (EOL == 0x001) to the compressed bitstream with optional byte alignment.


addEOFB

private void addEOFB()
Add an End-of-Facsimile-Block (EOFB == 0x001001) to the compressed bitstream.


encodeT6Line

public void encodeT6Line(byte[] data,
                         int lineAddr)

close

public byte[] close()