Package org.apache.pdfbox.jbig2.segments
Class PatternDictionary
java.lang.Object
org.apache.pdfbox.jbig2.segments.PatternDictionary
- All Implemented Interfaces:
Dictionary
,SegmentData
This class represents the segment type "Pattern dictionary", 7.4.4.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long
private long
Segment data structure (only necessary if MMR is used)private long
private long
private short[]
private short[]
private int
Largest gray-scale value, 7.4.4.1.4 Value: one less than the number of patterns defined in this pattern dictionaryprivate short
Height of the patterns in the pattern dictionary, 7.4.4.1.3private short
Width of the patterns in the pattern dictionary, 7.4.4.1.2private byte
private boolean
Pattern dictionary flags, 7.4.4.1.1Decoded bitmaps, stored to be used by segments, that refer to itprivate SubInputStream
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private void
private void
extractPatterns
(Bitmap collectiveBitmap) This method decodes a pattern dictionary segment and returns an array ofBitmap
s.protected int
protected short
protected short
protected byte
void
init
(SegmentHeader header, SubInputStream sis) Parse the stream and read information of header.protected boolean
private void
private void
private void
private void
private void
private void
-
Field Details
-
subInputStream
-
dataHeaderOffset
private long dataHeaderOffsetSegment data structure (only necessary if MMR is used) -
dataHeaderLength
private long dataHeaderLength -
dataOffset
private long dataOffset -
dataLength
private long dataLength -
gbAtX
private short[] gbAtX -
gbAtY
private short[] gbAtY -
isMMREncoded
private boolean isMMREncodedPattern dictionary flags, 7.4.4.1.1 -
hdTemplate
private byte hdTemplate -
hdpWidth
private short hdpWidthWidth of the patterns in the pattern dictionary, 7.4.4.1.2 -
hdpHeight
private short hdpHeightHeight of the patterns in the pattern dictionary, 7.4.4.1.3 -
patterns
Decoded bitmaps, stored to be used by segments, that refer to it -
grayMax
private int grayMaxLargest gray-scale value, 7.4.4.1.4 Value: one less than the number of patterns defined in this pattern dictionary
-
-
Constructor Details
-
PatternDictionary
public PatternDictionary()
-
-
Method Details
-
parseHeader
-
readTemplate
- Throws:
IOException
-
readIsMMREncoded
- Throws:
IOException
-
readPatternWidthAndHeight
- Throws:
IOException
-
readGrayMax
- Throws:
IOException
-
computeSegmentDataStructure
- Throws:
IOException
-
checkInput
- Throws:
InvalidHeaderValueException
-
getDictionary
This method decodes a pattern dictionary segment and returns an array ofBitmap
s. Each of thisBitmap
s is a pattern.
The procedure is described in 6.7.5 (page 43).- Specified by:
getDictionary
in interfaceDictionary
- Returns:
- An array of
Bitmap
s as result of the decoding procedure. - Throws:
IOException
- if an underlying IO operation failsInvalidHeaderValueException
- if the segment header value is invalid
-
extractPatterns
-
setGbAtPixels
private void setGbAtPixels() -
init
public void init(SegmentHeader header, SubInputStream sis) throws InvalidHeaderValueException, 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 invalidIOException
- if an underlying IO operation fails
-
isMMREncoded
protected boolean isMMREncoded() -
getHdTemplate
protected byte getHdTemplate() -
getHdpWidth
protected short getHdpWidth() -
getHdpHeight
protected short getHdpHeight() -
getGrayMax
protected int getGrayMax()
-