public class GenericRefinementRegion extends Object implements Region
This class is responsible for segment-level concerns only: parsing the
region segment information and flags from the bitstream, resolving the
reference bitmap, and delegating pixel decoding to
GenericRefinementRegionDecodingProcedure, which implements the
pure algorithm defined in §6.3.5.6.
The three generic refinement region segment types — intermediate, immediate, and immediate lossless — share an identical data encoding. They differ only in how the decoded bitmap is acted upon during page image composition (§8.2):
init(SegmentHeader, SubInputStream).
The reference bitmap is resolved from referred-to segments or,
if none are present, from the current page buffer (§7.4.7.4).
Per Table 35, GRREFERENCEDX and GRREFERENCEDY
are implicitly zero in this mode.setParameters(CX, ArithmeticDecoder, short, int, int,
Bitmap, int, int, boolean, short[], short[]) to supply the shared
ArithmeticDecoder, CX, reference bitmap, and offsets
before calling getRegionBitmap().
GenericRefinementRegionDecodingProcedure.decode(
ArithmeticDecoder, CX, int, int, short, boolean, Bitmap, int, int,
short[], short[]) directly.| Modifier and Type | Class and Description |
|---|---|
static class |
GenericRefinementRegion.Template
Deprecated.
Moved to
GenericRefinementRegionDecodingProcedure.Template.
This declaration will be removed in the next major release. |
| Constructor and Description |
|---|
GenericRefinementRegion() |
GenericRefinementRegion(SubInputStream subInputStream) |
GenericRefinementRegion(SubInputStream subInputStream,
SegmentHeader segmentHeader) |
| Modifier and Type | Method and Description |
|---|---|
Bitmap |
getRegionBitmap()
Decode using a template and arithmetic coding, as described in 6.3.5.6
|
RegionSegmentInformation |
getRegionInfo()
Simply returns the
RegionSegmentInformation. |
void |
init(SegmentHeader header,
SubInputStream sis)
Parse the stream and read information of header.
|
void |
setPageBitmap(Bitmap pageBitmap)
Call this to pass the page bitmap in case there is no reference bitmap.
|
protected void |
setParameters(CX cx,
ArithmeticDecoder arithmeticDecoder,
short grTemplate,
int regionWidth,
int regionHeight,
Bitmap grReference,
int grReferenceDX,
int grReferenceDY,
boolean isTPGRon,
short[] grAtX,
short[] grAtY)
Deprecated.
Use
GenericRefinementRegionDecodingProcedure.decode(
ArithmeticDecoder, CX, int, int, short, boolean, Bitmap, int, int, short[], short[])
directly, supplying the shared ArithmeticDecoder and CX as arguments.
This method will be removed in the next major release. |
public GenericRefinementRegion()
public GenericRefinementRegion(SubInputStream subInputStream)
public GenericRefinementRegion(SubInputStream subInputStream, SegmentHeader segmentHeader)
public Bitmap getRegionBitmap() throws IOException, IntegerMaxValueException, InvalidHeaderValueException
getRegionBitmap in interface RegionBitmap.IOException - if an underlying IO operation failsInvalidHeaderValueException - if a segment header value is invalidIntegerMaxValueException - if the maximum value limit of an integer is exceededpublic void setPageBitmap(Bitmap pageBitmap)
pageBitmap - public void init(SegmentHeader header, SubInputStream sis) throws IOException
SegmentDatainit in interface SegmentDataheader - - The segments' header (to make referred-to segments available in data part).sis - - Wrapped ImageInputStream into SubInputStream.IOException - if an underlying IO operation fails@Deprecated protected void setParameters(CX cx, ArithmeticDecoder arithmeticDecoder, short grTemplate, int regionWidth, int regionHeight, Bitmap grReference, int grReferenceDX, int grReferenceDY, boolean isTPGRon, short[] grAtX, short[] grAtY)
GenericRefinementRegionDecodingProcedure.decode(
ArithmeticDecoder, CX, int, int, short, boolean, Bitmap, int, int, short[], short[])
directly, supplying the shared ArithmeticDecoder and CX as arguments.
This method will be removed in the next major release.public RegionSegmentInformation getRegionInfo()
RegionRegionSegmentInformation.getRegionInfo in interface RegionRegionSegmentInformation.Copyright © 2026 The Apache Software Foundation. All rights reserved.