Package org.apache.pdfbox.jbig2.segments
Class TextRegion
- java.lang.Object
-
- org.apache.pdfbox.jbig2.segments.TextRegion
-
- All Implemented Interfaces:
Region,SegmentData
public class TextRegion extends java.lang.Object implements Region
This class represented the segment type "Text region", 7.4.3, page 56.
-
-
Field Summary
Fields Modifier and Type Field Description private longamountOfSymbolInstancesNumber of symbol instances, 7.4.3.1.4private intamountOfSymbolsprivate ArithmeticDecoderarithmeticDecoderprivate CombinationOperatorcombinationOperatorprivate longcurrentSFurther parametersprivate CXcxprivate CXcxIADSprivate CXcxIADTprivate CXcxIAFSprivate CXcxIAIDprivate CXcxIAITprivate CXcxIARDHprivate CXcxIARDWprivate CXcxIARDXprivate CXcxIARDYprivate CXcxIARIprivate shortdefaultPixelprivate HuffmanTabledsTableprivate HuffmanTablefsTableUser-supplied tables *private GenericRefinementRegiongenericRefinementRegionprivate ArithmeticIntegerDecoderintegerDecoderprivate booleanisHuffmanEncodedprivate shortisTransposedprivate shortlogSBStripsprivate HuffmanTablerdhTableprivate HuffmanTablerdwTableprivate HuffmanTablerdxTableprivate HuffmanTablerdyTableprivate shortreferenceCornerprivate BitmapregionBitmapprivate RegionSegmentInformationregionInfoRegion segment information field, 7.4.1private HuffmanTablerSizeTableprivate shortsbdsOffsetprivate shortsbHuffDSprivate shortsbHuffDTprivate shortsbHuffFSprivate shortsbHuffRDHeightprivate shortsbHuffRDWidthprivate shortsbHuffRDXprivate shortsbHuffRDYprivate shortsbHuffRSizeText region segment Huffman flags, 7.4.3.1.2private short[]sbrATXText region refinement AT flags, 7.4.3.1.3private short[]sbrATYprivate shortsbrTemplateText region segment flags, 7.4.3.1.1private intsbStripsprivate SegmentHeadersegmentHeaderprivate SubInputStreamsubInputStreamprivate intsymbolCodeLengthcodeTable including a code to each symbol used in that regionprivate FixedSizeTablesymbolCodeTableprivate java.util.ArrayList<Bitmap>symbolsprivate HuffmanTabletableprivate booleanuseRefinement
-
Constructor Summary
Constructors Constructor Description TextRegion()TextRegion(SubInputStream subInputStream, SegmentHeader segmentHeader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidblit(Bitmap ib, long t)private voidcheckInput()private voidcomputeSymbolCodeLength()private voidcreateRegionBitmap()private longdecodeCurrentT()private longdecodeDfS()private longdecodeDT()private BitmapdecodeIb(long r, long id)private longdecodeID()private longdecodeIdS()private longdecodeRdh()private longdecodeRdw()private longdecodeRdx()private longdecodeRdy()private longdecodeRI()private longdecodeStripT()private voiddecodeSymbolInstances()private longdecodeSymInRefSize()BitmapgetRegionBitmap()Decodes and returns a regions content.RegionSegmentInformationgetRegionInfo()Simply returns theRegionSegmentInformation.private voidgetSymbols()private HuffmanTablegetUserTable(int tablePosition)voidinit(SegmentHeader header, SubInputStream sis)Parse the stream and read information of header.private voidinitSymbols()private voidparseHeader()private voidreadAmountOfSymbolInstances()private voidreadHuffmanFlags()private voidreadRegionFlags()private voidreadUseRefinement()private voidsetCodingStatistics()protected voidsetContexts(CX cx, CX cxIADT, CX cxIAFS, CX cxIADS, CX cxIAIT, CX cxIAID, CX cxIARDW, CX cxIARDH, CX cxIARDX, CX cxIARDY)protected voidsetParameters(ArithmeticDecoder arithmeticDecoder, ArithmeticIntegerDecoder iDecoder, boolean isHuffmanEncoded, boolean sbRefine, int sbw, int sbh, long sbNumInstances, int sbStrips, int sbNumSyms, short sbDefaultPixel, short sbCombinationOperator, short transposed, short refCorner, short sbdsOffset, short sbHuffFS, short sbHuffDS, short sbHuffDT, short sbHuffRDWidth, short sbHuffRDHeight, short sbHuffRDX, short sbHuffRDY, short sbHuffRSize, short sbrTemplate, short[] sbrATX, short[] sbrATY, java.util.ArrayList<Bitmap> sbSyms, int sbSymCodeLen)private voidsymbolIDCodeLengths()
-
-
-
Field Detail
-
subInputStream
private SubInputStream subInputStream
-
regionInfo
private RegionSegmentInformation regionInfo
Region segment information field, 7.4.1
-
sbrTemplate
private short sbrTemplate
Text region segment flags, 7.4.3.1.1
-
sbdsOffset
private short sbdsOffset
-
defaultPixel
private short defaultPixel
-
combinationOperator
private CombinationOperator combinationOperator
-
isTransposed
private short isTransposed
-
referenceCorner
private short referenceCorner
-
logSBStrips
private short logSBStrips
-
useRefinement
private boolean useRefinement
-
isHuffmanEncoded
private boolean isHuffmanEncoded
-
sbHuffRSize
private short sbHuffRSize
Text region segment Huffman flags, 7.4.3.1.2
-
sbHuffRDY
private short sbHuffRDY
-
sbHuffRDX
private short sbHuffRDX
-
sbHuffRDHeight
private short sbHuffRDHeight
-
sbHuffRDWidth
private short sbHuffRDWidth
-
sbHuffDT
private short sbHuffDT
-
sbHuffDS
private short sbHuffDS
-
sbHuffFS
private short sbHuffFS
-
sbrATX
private short[] sbrATX
Text region refinement AT flags, 7.4.3.1.3
-
sbrATY
private short[] sbrATY
-
amountOfSymbolInstances
private long amountOfSymbolInstances
Number of symbol instances, 7.4.3.1.4
-
currentS
private long currentS
Further parameters
-
sbStrips
private int sbStrips
-
amountOfSymbols
private int amountOfSymbols
-
regionBitmap
private Bitmap regionBitmap
-
symbols
private java.util.ArrayList<Bitmap> symbols
-
arithmeticDecoder
private ArithmeticDecoder arithmeticDecoder
-
integerDecoder
private ArithmeticIntegerDecoder integerDecoder
-
genericRefinementRegion
private GenericRefinementRegion genericRefinementRegion
-
cxIADT
private CX cxIADT
-
cxIAFS
private CX cxIAFS
-
cxIADS
private CX cxIADS
-
cxIAIT
private CX cxIAIT
-
cxIARI
private CX cxIARI
-
cxIARDW
private CX cxIARDW
-
cxIARDH
private CX cxIARDH
-
cxIAID
private CX cxIAID
-
cxIARDX
private CX cxIARDX
-
cxIARDY
private CX cxIARDY
-
cx
private CX cx
-
symbolCodeLength
private int symbolCodeLength
codeTable including a code to each symbol used in that region
-
symbolCodeTable
private FixedSizeTable symbolCodeTable
-
segmentHeader
private SegmentHeader segmentHeader
-
fsTable
private HuffmanTable fsTable
User-supplied tables *
-
dsTable
private HuffmanTable dsTable
-
table
private HuffmanTable table
-
rdwTable
private HuffmanTable rdwTable
-
rdhTable
private HuffmanTable rdhTable
-
rdxTable
private HuffmanTable rdxTable
-
rdyTable
private HuffmanTable rdyTable
-
rSizeTable
private HuffmanTable rSizeTable
-
-
Constructor Detail
-
TextRegion
public TextRegion()
-
TextRegion
public TextRegion(SubInputStream subInputStream, SegmentHeader segmentHeader)
-
-
Method Detail
-
parseHeader
private void parseHeader() throws java.io.IOException, InvalidHeaderValueException, IntegerMaxValueException- Throws:
java.io.IOExceptionInvalidHeaderValueExceptionIntegerMaxValueException
-
readRegionFlags
private void readRegionFlags() throws java.io.IOException- Throws:
java.io.IOException
-
readHuffmanFlags
private void readHuffmanFlags() throws java.io.IOException- Throws:
java.io.IOException
-
readUseRefinement
private void readUseRefinement() throws java.io.IOException- Throws:
java.io.IOException
-
readAmountOfSymbolInstances
private void readAmountOfSymbolInstances() throws java.io.IOException- Throws:
java.io.IOException
-
getSymbols
private void getSymbols() throws java.io.IOException, IntegerMaxValueException, InvalidHeaderValueException- Throws:
java.io.IOExceptionIntegerMaxValueExceptionInvalidHeaderValueException
-
computeSymbolCodeLength
private void computeSymbolCodeLength() throws java.io.IOException- Throws:
java.io.IOException
-
checkInput
private void checkInput() throws InvalidHeaderValueException- Throws:
InvalidHeaderValueException
-
getRegionBitmap
public Bitmap getRegionBitmap() throws java.io.IOException, IntegerMaxValueException, InvalidHeaderValueException
Description copied from interface:RegionDecodes and returns a regions content.- Specified by:
getRegionBitmapin interfaceRegion- Returns:
- The decoded region as
Bitmap. - Throws:
java.io.IOException- if an underlying IO operation failsIntegerMaxValueException- if the maximum value limit of an integer is exceededInvalidHeaderValueException- if the segment header value is invalid
-
setCodingStatistics
private void setCodingStatistics() throws java.io.IOException- Throws:
java.io.IOException
-
createRegionBitmap
private void createRegionBitmap()
-
decodeStripT
private final long decodeStripT() throws java.io.IOException, InvalidHeaderValueException- Throws:
java.io.IOExceptionInvalidHeaderValueException
-
decodeSymbolInstances
private void decodeSymbolInstances() throws java.io.IOException, InvalidHeaderValueException, IntegerMaxValueException- Throws:
java.io.IOExceptionInvalidHeaderValueExceptionIntegerMaxValueException
-
decodeDT
private final long decodeDT() throws java.io.IOException- Throws:
java.io.IOException
-
decodeDfS
private final long decodeDfS() throws java.io.IOException, InvalidHeaderValueException- Throws:
java.io.IOExceptionInvalidHeaderValueException
-
decodeIdS
private final long decodeIdS() throws java.io.IOException, InvalidHeaderValueException- Throws:
java.io.IOExceptionInvalidHeaderValueException
-
decodeCurrentT
private final long decodeCurrentT() throws java.io.IOException- Throws:
java.io.IOException
-
decodeID
private final long decodeID() throws java.io.IOException- Throws:
java.io.IOException
-
decodeRI
private final long decodeRI() throws java.io.IOException- Throws:
java.io.IOException
-
decodeIb
private final Bitmap decodeIb(long r, long id) throws java.io.IOException, InvalidHeaderValueException, IntegerMaxValueException
- Throws:
java.io.IOExceptionInvalidHeaderValueExceptionIntegerMaxValueException
-
decodeRdw
private final long decodeRdw() throws java.io.IOException, InvalidHeaderValueException- Throws:
java.io.IOExceptionInvalidHeaderValueException
-
decodeRdh
private final long decodeRdh() throws java.io.IOException, InvalidHeaderValueException- Throws:
java.io.IOExceptionInvalidHeaderValueException
-
decodeRdx
private final long decodeRdx() throws java.io.IOException, InvalidHeaderValueException- Throws:
java.io.IOExceptionInvalidHeaderValueException
-
decodeRdy
private final long decodeRdy() throws java.io.IOException, InvalidHeaderValueException- Throws:
java.io.IOExceptionInvalidHeaderValueException
-
decodeSymInRefSize
private final long decodeSymInRefSize() throws java.io.IOException, InvalidHeaderValueException- Throws:
java.io.IOExceptionInvalidHeaderValueException
-
blit
private final void blit(Bitmap ib, long t)
-
initSymbols
private void initSymbols() throws java.io.IOException, IntegerMaxValueException, InvalidHeaderValueException- Throws:
java.io.IOExceptionIntegerMaxValueExceptionInvalidHeaderValueException
-
getUserTable
private HuffmanTable getUserTable(int tablePosition) throws InvalidHeaderValueException, java.io.IOException
- Throws:
InvalidHeaderValueExceptionjava.io.IOException
-
symbolIDCodeLengths
private void symbolIDCodeLengths() throws java.io.IOException- Throws:
java.io.IOException
-
init
public void init(SegmentHeader header, SubInputStream sis) throws InvalidHeaderValueException, IntegerMaxValueException, java.io.IOException
Description copied from interface:SegmentDataParse the stream and read information of header.- Specified by:
initin interfaceSegmentData- Parameters:
header- - The segments' header (to make referred-to segments available in data part).sis- - WrappedImageInputStreamintoSubInputStream.- Throws:
InvalidHeaderValueException- if the segment header value is invalidIntegerMaxValueException- if the maximum value limit of an integer is exceededjava.io.IOException- if an underlying IO operation fails
-
setContexts
protected void setContexts(CX cx, CX cxIADT, CX cxIAFS, CX cxIADS, CX cxIAIT, CX cxIAID, CX cxIARDW, CX cxIARDH, CX cxIARDX, CX cxIARDY)
-
setParameters
protected void setParameters(ArithmeticDecoder arithmeticDecoder, ArithmeticIntegerDecoder iDecoder, boolean isHuffmanEncoded, boolean sbRefine, int sbw, int sbh, long sbNumInstances, int sbStrips, int sbNumSyms, short sbDefaultPixel, short sbCombinationOperator, short transposed, short refCorner, short sbdsOffset, short sbHuffFS, short sbHuffDS, short sbHuffDT, short sbHuffRDWidth, short sbHuffRDHeight, short sbHuffRDX, short sbHuffRDY, short sbHuffRSize, short sbrTemplate, short[] sbrATX, short[] sbrATY, java.util.ArrayList<Bitmap> sbSyms, int sbSymCodeLen)
-
getRegionInfo
public RegionSegmentInformation getRegionInfo()
Description copied from interface:RegionSimply returns theRegionSegmentInformation.- Specified by:
getRegionInfoin interfaceRegion- Returns:
- The
RegionSegmentInformation.
-
-