Package org.apache.pdfbox.jbig2.segments
Class TextRegion
java.lang.Object
org.apache.pdfbox.jbig2.segments.TextRegion
- All Implemented Interfaces:
Region
,SegmentData
This class represented the segment type "Text region", 7.4.3, page 56.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long
Number of symbol instances, 7.4.3.1.4private int
private ArithmeticDecoder
private CombinationOperator
private long
Further parametersprivate CX
private CX
private CX
private CX
private CX
private CX
private CX
private CX
private CX
private CX
private CX
private short
private HuffmanTable
private HuffmanTable
User-supplied tables *private GenericRefinementRegion
private ArithmeticIntegerDecoder
private boolean
private short
private short
private HuffmanTable
private HuffmanTable
private HuffmanTable
private HuffmanTable
private short
private Bitmap
private RegionSegmentInformation
Region segment information field, 7.4.1private HuffmanTable
private short
private short
private short
private short
private short
private short
private short
private short
private short
Text region segment Huffman flags, 7.4.3.1.2private short[]
Text region refinement AT flags, 7.4.3.1.3private short[]
private short
Text region segment flags, 7.4.3.1.1private int
private SegmentHeader
private SubInputStream
private int
codeTable including a code to each symbol used in that regionprivate FixedSizeTable
private HuffmanTable
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate final void
private void
private void
private void
private final long
private final long
private final long
decodeDT()
private final Bitmap
decodeIb
(long r, long id) private final long
decodeID()
private final long
private final long
private final long
private final long
private final long
private final long
decodeRI()
private final long
private void
private final long
Decodes and returns a regions content.Simply returns theRegionSegmentInformation
.private void
private HuffmanTable
getUserTable
(int tablePosition) void
init
(SegmentHeader header, SubInputStream sis) Parse the stream and read information of header.private void
private void
private void
private void
private void
private void
private void
protected void
setContexts
(CX cx, CX cxIADT, CX cxIAFS, CX cxIADS, CX cxIAIT, CX cxIAID, CX cxIARDW, CX cxIARDH, CX cxIARDX, CX cxIARDY) 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, ArrayList<Bitmap> sbSyms, int sbSymCodeLen) private void
-
Field Details
-
subInputStream
-
regionInfo
Region segment information field, 7.4.1 -
sbrTemplate
private short sbrTemplateText region segment flags, 7.4.3.1.1 -
sbdsOffset
private short sbdsOffset -
defaultPixel
private short defaultPixel -
combinationOperator
-
isTransposed
private short isTransposed -
referenceCorner
private short referenceCorner -
logSBStrips
private short logSBStrips -
useRefinement
private boolean useRefinement -
isHuffmanEncoded
private boolean isHuffmanEncoded -
sbHuffRSize
private short sbHuffRSizeText 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[] sbrATXText region refinement AT flags, 7.4.3.1.3 -
sbrATY
private short[] sbrATY -
amountOfSymbolInstances
private long amountOfSymbolInstancesNumber of symbol instances, 7.4.3.1.4 -
currentS
private long currentSFurther parameters -
sbStrips
private int sbStrips -
amountOfSymbols
private int amountOfSymbols -
regionBitmap
-
symbols
-
arithmeticDecoder
-
integerDecoder
-
genericRefinementRegion
-
cxIADT
-
cxIAFS
-
cxIADS
-
cxIAIT
-
cxIARI
-
cxIARDW
-
cxIARDH
-
cxIAID
-
cxIARDX
-
cxIARDY
-
cx
-
symbolCodeLength
private int symbolCodeLengthcodeTable including a code to each symbol used in that region -
symbolCodeTable
-
segmentHeader
-
fsTable
User-supplied tables * -
dsTable
-
table
-
rdwTable
-
rdhTable
-
rdxTable
-
rdyTable
-
rSizeTable
-
-
Constructor Details
-
TextRegion
public TextRegion() -
TextRegion
-
-
Method Details
-
parseHeader
private void parseHeader() throws IOException, InvalidHeaderValueException, IntegerMaxValueException -
readRegionFlags
- Throws:
IOException
-
readHuffmanFlags
- Throws:
IOException
-
readUseRefinement
- Throws:
IOException
-
readAmountOfSymbolInstances
- Throws:
IOException
-
getSymbols
-
computeSymbolCodeLength
- Throws:
IOException
-
checkInput
- Throws:
InvalidHeaderValueException
-
getRegionBitmap
public Bitmap getRegionBitmap() throws IOException, IntegerMaxValueException, InvalidHeaderValueExceptionDescription copied from interface:Region
Decodes and returns a regions content.- Specified by:
getRegionBitmap
in interfaceRegion
- Returns:
- The decoded region as
Bitmap
. - Throws:
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
- Throws:
IOException
-
createRegionBitmap
private void createRegionBitmap() -
decodeStripT
-
decodeSymbolInstances
private void decodeSymbolInstances() throws IOException, InvalidHeaderValueException, IntegerMaxValueException -
decodeDT
- Throws:
IOException
-
decodeDfS
-
decodeIdS
-
decodeCurrentT
- Throws:
IOException
-
decodeID
- Throws:
IOException
-
decodeRI
- Throws:
IOException
-
decodeIb
private final Bitmap decodeIb(long r, long id) throws IOException, InvalidHeaderValueException, IntegerMaxValueException -
decodeRdw
-
decodeRdh
-
decodeRdx
-
decodeRdy
-
decodeSymInRefSize
-
blit
-
initSymbols
private void initSymbols() throws IOException, IntegerMaxValueException, InvalidHeaderValueException -
getUserTable
private HuffmanTable getUserTable(int tablePosition) throws InvalidHeaderValueException, IOException -
symbolIDCodeLengths
- Throws:
IOException
-
init
public void init(SegmentHeader header, SubInputStream sis) throws InvalidHeaderValueException, IntegerMaxValueException, IOException Description copied from interface:SegmentData
Parse the stream and read information of header.- Specified by:
init
in interfaceSegmentData
- Parameters:
header
- - The segments' header (to make referred-to segments available in data part).sis
- - WrappedImageInputStream
intoSubInputStream
.- Throws:
InvalidHeaderValueException
- if the segment header value is invalidIntegerMaxValueException
- if the maximum value limit of an integer is exceededIOException
- if an underlying IO operation fails
-
setContexts
-
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, ArrayList<Bitmap> sbSyms, int sbSymCodeLen) -
getRegionInfo
Description copied from interface:Region
Simply returns theRegionSegmentInformation
.- Specified by:
getRegionInfo
in interfaceRegion
- Returns:
- The
RegionSegmentInformation
.
-