Class HalftoneRegion
java.lang.Object
org.apache.pdfbox.jbig2.segments.HalftoneRegion
- All Implemented Interfaces:
Region, SegmentData
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longprivate longprivate longprivate longprivate BitmapDecoded dataprivate CombinationOperatorprivate byteHalftone segment information field, 7.4.5.1.1private intHeight of the gray-scale image, 7.4.5.1.2.2private intWidth of the gray-scale image, 7.4.5.1.2.1private intHorizontal offset of the grid, 7.4.5.1.2.3private intVertical offset of the grid, 7.4.5.1.2.4private intHorizontal coordinate of the halftone grid vector, 7.4.5.1.3.1private intVertical coordinate of the halftone grod vector, 7.4.5.1.3.2private booleanprivate byteprivate booleanPreviously decoded data from other regions or dictionaries, stored to use as patterns in this region.private RegionSegmentInformationRegion segment information field, 7.4.1private SegmentHeaderprivate SubInputStream -
Constructor Summary
ConstructorsConstructorDescriptionHalftoneRegion(SubInputStream subInputStream) HalftoneRegion(SubInputStream subInputStream, SegmentHeader segmentHeader) -
Method Summary
Modifier and TypeMethodDescriptionprivate Bitmap[]combineGrayScalePlanes(Bitmap[] grayScalePlanes, int j) private int[][]computeGrayScaleValues(Bitmap[] grayScalePlanes, int bitsPerValue) private voidprivate intcomputeX(int m, int n) private intcomputeY(int m, int n) protected byteprotected intprotected intprotected intprotected intprotected intprotected intprotected byteThe procedure is described in JBIG2 ISO standard, 6.6.5.Simply returns theRegionSegmentInformation.private int[][]grayScaleDecoding(int bitsPerValue) Gray-scale image decoding procedure is special for halftone region decoding and is described in Annex C.5 on page 98.voidinit(SegmentHeader header, SubInputStream sis) Parse the stream and read information of header.protected booleanprotected booleanprivate voidprivate voidrenderPattern(int[][] grayScaleValues) This method draws the pattern into the region bitmap (htReg), as described in 6.6.5.2, page 42private intshiftAndFill(int value)
-
Field Details
-
subInputStream
-
segmentHeader
-
dataHeaderOffset
private long dataHeaderOffset -
dataHeaderLength
private long dataHeaderLength -
dataOffset
private long dataOffset -
dataLength
private long dataLength -
regionInfo
Region segment information field, 7.4.1 -
hDefaultPixel
private byte hDefaultPixelHalftone segment information field, 7.4.5.1.1 -
hCombinationOperator
-
hSkipEnabled
private boolean hSkipEnabled -
hTemplate
private byte hTemplate -
isMMREncoded
private boolean isMMREncoded -
hGridWidth
private int hGridWidthWidth of the gray-scale image, 7.4.5.1.2.1 -
hGridHeight
private int hGridHeightHeight of the gray-scale image, 7.4.5.1.2.2 -
hGridX
private int hGridXHorizontal offset of the grid, 7.4.5.1.2.3 -
hGridY
private int hGridYVertical offset of the grid, 7.4.5.1.2.4 -
hRegionX
private int hRegionXHorizontal coordinate of the halftone grid vector, 7.4.5.1.3.1 -
hRegionY
private int hRegionYVertical coordinate of the halftone grod vector, 7.4.5.1.3.2 -
halftoneRegionBitmap
Decoded data -
patterns
-
-
Constructor Details
-
HalftoneRegion
public HalftoneRegion() -
HalftoneRegion
-
HalftoneRegion
-
-
Method Details
-
parseHeader
-
computeSegmentDataStructure
- Throws:
IOException
-
getRegionBitmap
The procedure is described in JBIG2 ISO standard, 6.6.5.- Specified by:
getRegionBitmapin interfaceRegion- Returns:
- The decoded
Bitmapof this region. - Throws:
IOException- if an underlying IO operation failsInvalidHeaderValueException- if a segment header value is invalid
-
renderPattern
private void renderPattern(int[][] grayScaleValues) This method draws the pattern into the region bitmap (htReg), as described in 6.6.5.2, page 42 -
getPatterns
-
grayScaleDecoding
Gray-scale image decoding procedure is special for halftone region decoding and is described in Annex C.5 on page 98.- Throws:
IOException
-
combineGrayScalePlanes
-
computeGrayScaleValues
-
computeX
private int computeX(int m, int n) -
computeY
private int computeY(int m, int n) -
shiftAndFill
private int shiftAndFill(int value) -
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
-
getCombinationOperator
-
getRegionInfo
Description copied from interface:RegionSimply returns theRegionSegmentInformation.- Specified by:
getRegionInfoin interfaceRegion- Returns:
- The
RegionSegmentInformation.
-
getHTemplate
protected byte getHTemplate() -
isHSkipEnabled
protected boolean isHSkipEnabled() -
isMMREncoded
protected boolean isMMREncoded() -
getHGridWidth
protected int getHGridWidth() -
getHGridHeight
protected int getHGridHeight() -
getHGridX
protected int getHGridX() -
getHGridY
protected int getHGridY() -
getHRegionX
protected int getHRegionX() -
getHRegionY
protected int getHRegionY() -
getHDefaultPixel
protected byte getHDefaultPixel()
-