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 longprivate longSegment data structure (only necessary if MMR is used)private longprivate longprivate short[]private short[]private intLargest gray-scale value, 7.4.4.1.4 Value: one less than the number of patterns defined in this pattern dictionaryprivate shortHeight of the patterns in the pattern dictionary, 7.4.4.1.3private shortWidth of the patterns in the pattern dictionary, 7.4.4.1.2private byteprivate booleanPattern 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 voidprivate voidprivate voidextractPatterns(Bitmap collectiveBitmap) This method decodes a pattern dictionary segment and returns an array ofBitmaps.protected intprotected shortprotected shortprotected bytevoidinit(SegmentHeader header, SubInputStream sis) Parse the stream and read information of header.protected booleanprivate voidprivate voidprivate voidprivate voidprivate voidprivate 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
-
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 ofBitmaps. Each of thisBitmaps is a pattern.
The procedure is described in 6.7.5 (page 43).- Specified by:
getDictionaryin interfaceDictionary- Returns:
- An array of
Bitmaps 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: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 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()
-