Class RBCodecCCITTFaxDecode
- java.lang.Object
-
- com.inductiveautomation.rm.pdf.reader.RBCodec
-
- com.inductiveautomation.rm.pdf.reader.RBCodecCCITTFaxDecode
-
public class RBCodecCCITTFaxDecode extends RBCodec
-
-
Field Summary
Fields Modifier and Type Field Description static int
EndOfTheLine
static int
Horizontal
static int
PassMode
static int
UncompressedMode
static int
Vertical0
static int
VerticalLeft1
static int
VerticalLeft2
static int
VerticalLeft3
static int
VerticalRight1
static int
VerticalRight2
static int
VerticalRight3
-
Constructor Summary
Constructors Constructor Description RBCodecCCITTFaxDecode(byte[] bits, int offset, int k, int rows, int columns, int numdamagedrows, boolean aligned, boolean eolrequired, boolean eoblockrequired, boolean blackisone)
main constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
backup()
Back the stream up to the marked positionboolean
blackIsOne()
Returns whether a pixel value or 1 should be interpreted as black or whitevoid
byteAlignStream()
Skips over any extra padding bits at the end of a byte.static byte[]
bytesForCCITTFaxDecode(byte[] bytes, int offset, int len, int K, int rows, int columns, boolean byteAligned, boolean eolRequired, boolean eoblockRequired, boolean blackIsOne, int allowedDamagedRows)
convenience method to decode a single imageboolean
decodeScanline1D(byte[] outdata)
boolean
decodeScanline2D(byte[] outdata)
2D decoder.byte[]
decodeStream()
Decode the entire image at oncevoid
decodeStream(java.io.OutputStream outstream)
Decode, writing image bytes to outstreamint
getHeight()
Get the height of the decompressed imageint
getNextCodeword(int[] table)
int
getNextInt(int[] table)
Interprets next n codewords as an integer.int
getWidth()
Get the width of the decompressed imagevoid
locateReferenceMarks(byte[] scanline, int a0, byte a0color, int[] b)
void
mark()
Mark the current point in the bitstream.void
setDimensions(int width, int height)
Set the dimensions manuallyvoid
writeScanline(java.io.OutputStream out, byte[] scanline)
Write the decoded scanline to a stream.-
Methods inherited from class com.inductiveautomation.rm.pdf.reader.RBCodec
bytesForASCII85, bytesForASCIIHex, bytesForASCIIHex
-
-
-
-
Field Detail
-
EndOfTheLine
public static final int EndOfTheLine
- See Also:
- Constant Field Values
-
PassMode
public static final int PassMode
- See Also:
- Constant Field Values
-
Horizontal
public static final int Horizontal
- See Also:
- Constant Field Values
-
Vertical0
public static final int Vertical0
- See Also:
- Constant Field Values
-
VerticalRight1
public static final int VerticalRight1
- See Also:
- Constant Field Values
-
VerticalRight2
public static final int VerticalRight2
- See Also:
- Constant Field Values
-
VerticalRight3
public static final int VerticalRight3
- See Also:
- Constant Field Values
-
VerticalLeft1
public static final int VerticalLeft1
- See Also:
- Constant Field Values
-
VerticalLeft2
public static final int VerticalLeft2
- See Also:
- Constant Field Values
-
VerticalLeft3
public static final int VerticalLeft3
- See Also:
- Constant Field Values
-
UncompressedMode
public static final int UncompressedMode
- See Also:
- Constant Field Values
-
-
Method Detail
-
bytesForCCITTFaxDecode
public static byte[] bytesForCCITTFaxDecode(byte[] bytes, int offset, int len, int K, int rows, int columns, boolean byteAligned, boolean eolRequired, boolean eoblockRequired, boolean blackIsOne, int allowedDamagedRows)
convenience method to decode a single image
-
getNextCodeword
public int getNextCodeword(int[] table)
-
getNextInt
public int getNextInt(int[] table)
Interprets next n codewords as an integer. Rules are: numbers less than 64 are low digits. numbers between 64 and 2559 require one additional low digit. 2560 requires an additional number, containing any number of digits.
-
byteAlignStream
public void byteAlignStream()
Skips over any extra padding bits at the end of a byte.
-
mark
public void mark()
Mark the current point in the bitstream. Use backup() to return to this point.
-
backup
public void backup()
Back the stream up to the marked position
-
decodeStream
@Nullable public byte[] decodeStream()
Decode the entire image at once
-
decodeStream
public void decodeStream(java.io.OutputStream outstream) throws PDFException, java.io.IOException
Decode, writing image bytes to outstream- Throws:
PDFException
java.io.IOException
-
decodeScanline1D
public boolean decodeScanline1D(byte[] outdata)
-
locateReferenceMarks
public void locateReferenceMarks(byte[] scanline, int a0, byte a0color, int[] b)
-
decodeScanline2D
public boolean decodeScanline2D(byte[] outdata)
2D decoder. outdata is a buffer which the new scanline will be written to. On input, however, outdata should have the bits for the previous scanline. The 2D encoder will include codewords which make reference to the previous scanline. For the very first scaneline, outdata should be initialized to all white.
-
writeScanline
public void writeScanline(java.io.OutputStream out, byte[] scanline) throws java.io.IOException
Write the decoded scanline to a stream.- Throws:
java.io.IOException
-
getWidth
public int getWidth()
Get the width of the decompressed image
-
getHeight
public int getHeight()
Get the height of the decompressed image
-
blackIsOne
public boolean blackIsOne()
Returns whether a pixel value or 1 should be interpreted as black or white
-
setDimensions
public void setDimensions(int width, int height)
Set the dimensions manually
-
-