Package org.apache.pdfbox.jbig2
Class JBIG2Page
java.lang.Object
org.apache.pdfbox.jbig2.JBIG2Page
This class represents a JBIG2 page.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JBIG2Document
private int
private int
private Bitmap
The page bitmap that represents the page bufferprivate final int
NOTE: page number != segmentList indexprivate int
private int
private 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 void
add
(SegmentHeader segment) Adds aSegmentHeader
into the page's segments map.protected void
Reset memory-critical parts of page.private void
Resets the memory-critical segments to force on-demand-decoding and to avoid holding the segments' bitmap too long.private ArrayList
<SegmentData> private void
This method composes the segments' bitmaps to a page and stores the page as aBitmap
private int
This method counts the regions segments.private void
createNormalPage
(PageInformation pageInformation) private void
createPage
(PageInformation pageInformation) private void
createStripedPage
(PageInformation pageInformation) private boolean
fitsPage
(PageInformation pageInformation, Bitmap regionBitmap) Check if we have only one region that forms the complete page.protected Bitmap
This method returns the decoded bitmap if present.private CombinationOperator
getCombinationOperator
(PageInformation pi, CombinationOperator newOperator) This method checks and sets, which combination operator shall be used.protected int
Returns the final height of the page.protected SegmentHeader
Returns the associated page information segment.protected int
protected int
getSegment
(int number) This method searches for a segment specified by its number.protected int
getWidth()
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
SegmentHeader
ornull
if not available.
-
getPageInformationSegment
Returns the associated page information segment.- Returns:
- The associated
PageInformation
segment ornull
if 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:
JBIG2Exception
IOException
-
composePageBitmap
This method composes the segments' bitmaps to a page and stores the page as aBitmap
- Throws:
IOException
JBIG2Exception
-
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
- -PageInformation
objectnewOperator
- - The combination operator, specified by actual segment- Returns:
- the new combination operator
-
add
Adds aSegmentHeader
into 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:
IOException
JBIG2Exception
-
getWidth
protected int getWidth() -
getResolutionX
protected int getResolutionX() -
getResolutionY
protected int getResolutionY() -
toString
-