Package com.aowagie.text.pdf.codec
Class CCITTG4Encoder
java.lang.Object
com.aowagie.text.pdf.codec.CCITTG4Encoder
Encodes data in the CCITT G4 FAX format.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private static final int
private int
private byte[]
private static final int
private static final int
private static final int
private static final int
private static final int
private final int[]
private static final int
private final int[]
private int
private static byte[]
private final ByteBuffer
private final int[]
private final byte[]
private final int
private final int
private static final int
private int
private final int[][]
private final int[][]
private final int[][]
private static byte[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) byte[]
close()
Closes the encoder and returns the encoded data.static byte[]
compress
(byte[] data, int width, int height) Encodes a full image.private void
(package private) void
fax4Encode
(byte[] data, int height) Encodes a number of lines.private void
fax4Encode
(byte[] data, int offset, int size) Encodes a number of lines.private void
private static int
find0span
(byte[] bp, int offset, int bs, int be) private static int
find1span
(byte[] bp, int offset, int bs, int be) private static int
finddiff
(byte[] bp, int offset, int bs, int be, int color) private static int
finddiff2
(byte[] bp, int offset, int bs, int be, int color) private int
pixel
(byte[] data, int offset, int bit) private void
putBits
(int bits, int length) private void
putcode
(int[] table) private void
putspan
(int span, int[][] tab)
-
Field Details
-
rowbytes
private final int rowbytes -
rowpixels
private final int rowpixels -
bit
private int bit -
data
private int data -
refline
private final byte[] refline -
outBuf
-
dataBp
private byte[] dataBp -
offsetData
private int offsetData -
sizeData
private int sizeData -
zeroruns
private static byte[] zeroruns -
oneruns
private static byte[] oneruns -
LENGTH
private static final int LENGTH- See Also:
-
CODE
private static final int CODE- See Also:
-
RUNLEN
private static final int RUNLEN- See Also:
-
EOL
private static final int EOL- See Also:
-
G3CODE_EOL
private static final int G3CODE_EOL- See Also:
-
G3CODE_INVALID
private static final int G3CODE_INVALID- See Also:
-
G3CODE_EOF
private static final int G3CODE_EOF- See Also:
-
G3CODE_INCOMP
private static final int G3CODE_INCOMP- See Also:
-
TIFFFaxWhiteCodes
private final int[][] TIFFFaxWhiteCodes -
TIFFFaxBlackCodes
private final int[][] TIFFFaxBlackCodes -
horizcode
private final int[] horizcode -
passcode
private final int[] passcode -
vcodes
private final int[][] vcodes -
msbmask
private final int[] msbmask
-
-
Constructor Details
-
CCITTG4Encoder
CCITTG4Encoder(int width) Creates a new encoder.- Parameters:
width
- the line width
-
-
Method Details
-
fax4Encode
private void fax4Encode(byte[] data, int offset, int size) Encodes a number of lines.- Parameters:
data
- the data to be encodedoffset
- the offset into the datasize
- the size of the data to be encoded
-
compress
public static byte[] compress(byte[] data, int width, int height) Encodes a full image.- Parameters:
data
- the data to encodewidth
- the image widthheight
- the image height- Returns:
- the encoded image
-
fax4Encode
void fax4Encode(byte[] data, int height) Encodes a number of lines.- Parameters:
data
- the data to be encodedheight
- the number of lines to encode
-
putcode
private void putcode(int[] table) -
putspan
private void putspan(int span, int[][] tab) -
putBits
private void putBits(int bits, int length) -
Fax3Encode2DRow
private void Fax3Encode2DRow() -
Fax4PostEncode
private void Fax4PostEncode() -
close
byte[] close()Closes the encoder and returns the encoded data.- Returns:
- the encoded data
-
pixel
private int pixel(byte[] data, int offset, int bit) -
find1span
private static int find1span(byte[] bp, int offset, int bs, int be) -
find0span
private static int find0span(byte[] bp, int offset, int bs, int be) -
finddiff
private static int finddiff(byte[] bp, int offset, int bs, int be, int color) -
finddiff2
private static int finddiff2(byte[] bp, int offset, int bs, int be, int color)
-