Class JBIG2Page
java.lang.Object
org.apache.pdfbox.jbig2.JBIG2Page
This class represents a JBIG2 page.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JBIG2Documentprivate intprivate intprivate BitmapThe page bitmap that represents the page bufferprivate final intNOTE: page number != segmentList indexprivate intprivate intprivate final Map<Integer, SegmentHeader> This list contains all segments of this page, sorted by segment number in ascending order. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadd(SegmentHeader segment) Adds aSegmentHeaderinto the page's segments map.protected voidReset memory-critical parts of page.private voidResets the memory-critical segments to force on-demand-decoding and to avoid holding the segments' bitmap too long.private ArrayList<SegmentData> private voidThis method composes the segments' bitmaps to a page and stores the page as aBitmapprivate intThis method counts the regions segments.private voidcreateNormalPage(PageInformation pageInformation) private voidcreatePage(PageInformation pageInformation) private voidcreateStripedPage(PageInformation pageInformation) private booleanfitsPage(PageInformation pageInformation, Bitmap regionBitmap) Check if we have only one region that forms the complete page.protected BitmapThis method returns the decoded bitmap if present.private CombinationOperatorgetCombinationOperator(PageInformation pi, CombinationOperator newOperator) This method checks and sets, which combination operator shall be used.protected intReturns the final height of the page.protected SegmentHeaderReturns the associated page information segment.protected intprotected intgetSegment(int number) This method searches for a segment specified by its number.protected intgetWidth()toString()
-
Field Details
-
segments
This list contains all segments of this page, sorted by segment number in ascending order. -
pageNumber
private final int pageNumberNOTE: page number != segmentList index -
pageBitmap
The page bitmap that represents the page buffer -
finalHeight
private int finalHeight -
finalWidth
private int finalWidth -
resolutionX
private int resolutionX -
resolutionY
private int resolutionY -
document
-
-
Constructor Details
-
JBIG2Page
-
-
Method Details
-
getSegment
This method searches for a segment specified by its number.- Parameters:
number- - Segment number of the segment to search.- Returns:
- The retrieved
SegmentHeaderornullif not available.
-
getPageInformationSegment
Returns the associated page information segment.- Returns:
- The associated
PageInformationsegment ornullif not available.
-
getBitmap
This method returns the decoded bitmap if present. Otherwise the page bitmap will be composed before returning the result.- Returns:
- pageBitmap - The result of decoding a page
- Throws:
JBIG2ExceptionIOException
-
composePageBitmap
This method composes the segments' bitmaps to a page and stores the page as aBitmap- Throws:
IOExceptionJBIG2Exception
-
createPage
private void createPage(PageInformation pageInformation) throws IOException, IntegerMaxValueException, InvalidHeaderValueException -
createNormalPage
private void createNormalPage(PageInformation pageInformation) throws IOException, IntegerMaxValueException, InvalidHeaderValueException -
fitsPage
Check if we have only one region that forms the complete page. If the dimension equals the page's dimension set the region's bitmap as the page's bitmap. Otherwise we have to blit the smaller region's bitmap into the page's bitmap (see Issue 6).- Parameters:
pageInformation-regionBitmap-- Returns:
-
createStripedPage
private void createStripedPage(PageInformation pageInformation) throws IOException, IntegerMaxValueException, InvalidHeaderValueException -
collectPageStripes
-
countRegions
private int countRegions()This method counts the regions segments. If there is only one region, the bitmap of this segment is equal to the page bitmap and blitting is not necessary.- Returns:
- Amount of regions.
-
getCombinationOperator
private CombinationOperator getCombinationOperator(PageInformation pi, CombinationOperator newOperator) This method checks and sets, which combination operator shall be used.- Parameters:
pi- -PageInformationobjectnewOperator- - The combination operator, specified by actual segment- Returns:
- the new combination operator
-
add
Adds aSegmentHeaderinto the page's segments map.- Parameters:
segment- - The segment to be added.
-
clearSegmentData
private void clearSegmentData()Resets the memory-critical segments to force on-demand-decoding and to avoid holding the segments' bitmap too long. -
clearPageData
protected void clearPageData()Reset memory-critical parts of page. -
getHeight
Returns the final height of the page.- Returns:
- The final height of the page.
- Throws:
IOExceptionJBIG2Exception
-
getWidth
protected int getWidth() -
getResolutionX
protected int getResolutionX() -
getResolutionY
protected int getResolutionY() -
toString
-