Top Description Fields Constructors Methods
org.apache.pdfbox.jbig2.segments

public Class PatternDictionary

extends Object
implements Dictionary
Class Inheritance
All Implemented Interfaces
org.apache.pdfbox.jbig2.Dictionary, org.apache.pdfbox.jbig2.SegmentData
Imports
java.awt.Rectangle, java.io.IOException, java.util.ArrayList, org.apache.pdfbox.jbig2.Bitmap, .Dictionary, .SegmentHeader, org.apache.pdfbox.jbig2.err.InvalidHeaderValueException, org.apache.pdfbox.jbig2.image.Bitmaps, org.apache.pdfbox.jbig2.io.SubInputStream

This class represents the segment type "Pattern dictionary", 7.4.4.

Field Summary

Modifier and TypeField and Description
private long
private long
dataHeaderOffset

Segment data structure (only necessary if MMR is used)

private long
private long
private short[]
private short[]
private int
grayMax

Largest gray-scale value, 7.4.4.1.4 Value: one less than the number of patterns defined in this pattern dictionary

private short
hdpHeight

Height of the patterns in the pattern dictionary, 7.4.4.1.3

private short
hdpWidth

Width of the patterns in the pattern dictionary, 7.4.4.1.2

private byte
private boolean
isMMREncoded

Pattern dictionary flags, 7.4.4.1.1

private ArrayList<Bitmap>
patterns

Decoded bitmaps, stored to be used by segments, that refer to it

private SubInputStream

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
private void
private void
extractPatterns(Bitmap collectiveBitmap)

public ArrayList<Bitmap>

Returns:

An array of Bitmaps as result of the decoding procedure.
getDictionary
()

Implements org.apache.pdfbox.jbig2.Dictionary.getDictionary.

This method decodes a pattern dictionary segment and returns an array of Bitmap s.

protected int
protected short
protected short
protected byte
public void
init(SegmentHeader
- The segments' header (to make referred-to segments available in data part).
header
,
SubInputStream
- Wrapped ImageInputStream into SubInputStream.
sis
)

Implements org.apache.pdfbox.jbig2.SegmentData.init.

Parse the stream and read information of header.

protected boolean
private void
private void
private void
private void
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dataHeaderLengthback to summary
private long dataHeaderLength
dataHeaderOffsetback to summary
private long dataHeaderOffset

Segment data structure (only necessary if MMR is used)

dataLengthback to summary
private long dataLength
dataOffsetback to summary
private long dataOffset
gbAtXback to summary
private short[] gbAtX
gbAtYback to summary
private short[] gbAtY
grayMaxback to summary
private int grayMax

Largest gray-scale value, 7.4.4.1.4 Value: one less than the number of patterns defined in this pattern dictionary

hdpHeightback to summary
private short hdpHeight

Height of the patterns in the pattern dictionary, 7.4.4.1.3

hdpWidthback to summary
private short hdpWidth

Width of the patterns in the pattern dictionary, 7.4.4.1.2

hdTemplateback to summary
private byte hdTemplate
isMMREncodedback to summary
private boolean isMMREncoded

Pattern dictionary flags, 7.4.4.1.1

patternsback to summary
private ArrayList<Bitmap> patterns

Decoded bitmaps, stored to be used by segments, that refer to it

subInputStreamback to summary
private SubInputStream subInputStream

Constructor Detail

PatternDictionaryback to summary
public PatternDictionary()

Method Detail

checkInputback to summary
private void checkInput() throws InvalidHeaderValueException
computeSegmentDataStructureback to summary
private void computeSegmentDataStructure() throws IOException
extractPatternsback to summary
private void extractPatterns(Bitmap collectiveBitmap)
getDictionaryback to summary
public ArrayList<Bitmap> getDictionary() throws IOException, InvalidHeaderValueException

Implements org.apache.pdfbox.jbig2.Dictionary.getDictionary.

This method decodes a pattern dictionary segment and returns an array of Bitmap s. Each of this Bitmaps is a pattern.
The procedure is described in 6.7.5 (page 43).

Returns:ArrayList<Bitmap>

An array of Bitmaps as result of the decoding procedure.

Exceptions
IOException:

Doc from org.apache.pdfbox.jbig2.Dictionary.getDictionary.

if an underlying IO operation fails

InvalidHeaderValueException:

Doc from org.apache.pdfbox.jbig2.Dictionary.getDictionary.

if the segment header value is invalid

getGrayMaxback to summary
protected int getGrayMax()
getHdpHeightback to summary
protected short getHdpHeight()
getHdpWidthback to summary
protected short getHdpWidth()
getHdTemplateback to summary
protected byte getHdTemplate()
initback to summary
public void init(SegmentHeader header, SubInputStream sis) throws InvalidHeaderValueException, IOException

Implements org.apache.pdfbox.jbig2.SegmentData.init.

Doc from org.apache.pdfbox.jbig2.SegmentData.init.

Parse the stream and read information of header.

Parameters
header:SegmentHeader

- The segments' header (to make referred-to segments available in data part).

sis:SubInputStream

- Wrapped ImageInputStream into SubInputStream.

Exceptions
InvalidHeaderValueException:
if the segment header value is invalid
IOException:
if an underlying IO operation fails
isMMREncodedback to summary
protected boolean isMMREncoded()
parseHeaderback to summary
private void parseHeader() throws IOException, InvalidHeaderValueException
readGrayMaxback to summary
private void readGrayMax() throws IOException
readIsMMREncodedback to summary
private void readIsMMREncoded() throws IOException
readPatternWidthAndHeightback to summary
private void readPatternWidthAndHeight() throws IOException
readTemplateback to summary
private void readTemplate() throws IOException
setGbAtPixelsback to summary
private void setGbAtPixels()