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

public Class HalftoneRegion

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

This class represents the data of segment type "Halftone region". Parsing is described in 7.4.5, page 67. Decoding procedure in 6.6.5 and 7.4.5.2.

Field Summary

Modifier and TypeField and Description
private long
private long
private long
private long
private Bitmap
private CombinationOperator
private byte
hDefaultPixel

Halftone segment information field, 7.4.5.1.1

private int
hGridHeight

Height of the gray-scale image, 7.4.5.1.2.2

private int
hGridWidth

Width of the gray-scale image, 7.4.5.1.2.1

private int
hGridX

Horizontal offset of the grid, 7.4.5.1.2.3

private int
hGridY

Vertical offset of the grid, 7.4.5.1.2.4

private int
hRegionX

Horizontal coordinate of the halftone grid vector, 7.4.5.1.3.1

private int
hRegionY

Vertical coordinate of the halftone grod vector, 7.4.5.1.3.2

private boolean
private byte
private boolean
private ArrayList<Bitmap>
patterns

Previously decoded data from other regions or dictionaries, stored to use as patterns in this region.

private RegionSegmentInformation
regionInfo

Region segment information field, 7.4.1

private SegmentHeader
private SubInputStream

Constructor Summary

AccessConstructor and Description
public
public
HalftoneRegion(final SubInputStream subInputStream)

public
HalftoneRegion(final SubInputStream subInputStream, final SegmentHeader segmentHeader)

Method Summary

Modifier and TypeMethod and Description
private Bitmap[]
combineGrayScalePlanes(Bitmap[] grayScalePlanes, int j)

private int[][]
computeGrayScaleValues(final Bitmap[] grayScalePlanes, final int bitsPerValue)

private void
private int
computeX(final int m, final int n)

private int
computeY(final int m, final int n)

public CombinationOperator
protected byte
protected int
protected int
protected int
protected int
protected int
protected int
protected byte
private ArrayList<Bitmap>
public Bitmap

Returns:

The decoded Bitmap of this region.
getRegionBitmap
()

Implements org.apache.pdfbox.jbig2.Region.getRegionBitmap.

The procedure is described in JBIG2 ISO standard, 6.6.5.

public RegionSegmentInformation
private int[][]
grayScaleDecoding(final int bitsPerValue)

Gray-scale image decoding procedure is special for halftone region decoding and is described in Annex C.5 on page 98.

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

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

Parse the stream and read information of header.

protected boolean
protected boolean
private void
private void
renderPattern(final int[][] grayScaleValues)

This method draws the pattern into the region bitmap (htReg), as described in 6.6.5.2, page 42

private int
shiftAndFill(int value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dataHeaderLengthback to summary
private long dataHeaderLength
dataHeaderOffsetback to summary
private long dataHeaderOffset
dataLengthback to summary
private long dataLength
dataOffsetback to summary
private long dataOffset
halftoneRegionBitmapback to summary
private Bitmap halftoneRegionBitmap

Decoded data

hCombinationOperatorback to summary
private CombinationOperator hCombinationOperator
hDefaultPixelback to summary
private byte hDefaultPixel

Halftone segment information field, 7.4.5.1.1

hGridHeightback to summary
private int hGridHeight

Height of the gray-scale image, 7.4.5.1.2.2

hGridWidthback to summary
private int hGridWidth

Width of the gray-scale image, 7.4.5.1.2.1

hGridXback to summary
private int hGridX

Horizontal offset of the grid, 7.4.5.1.2.3

hGridYback to summary
private int hGridY

Vertical offset of the grid, 7.4.5.1.2.4

hRegionXback to summary
private int hRegionX

Horizontal coordinate of the halftone grid vector, 7.4.5.1.3.1

hRegionYback to summary
private int hRegionY

Vertical coordinate of the halftone grod vector, 7.4.5.1.3.2

hSkipEnabledback to summary
private boolean hSkipEnabled
hTemplateback to summary
private byte hTemplate
isMMREncodedback to summary
private boolean isMMREncoded
patternsback to summary
private ArrayList<Bitmap> patterns

Previously decoded data from other regions or dictionaries, stored to use as patterns in this region.

regionInfoback to summary
private RegionSegmentInformation regionInfo

Region segment information field, 7.4.1

segmentHeaderback to summary
private SegmentHeader segmentHeader
subInputStreamback to summary
private SubInputStream subInputStream

Constructor Detail

HalftoneRegionback to summary
public HalftoneRegion()
HalftoneRegionback to summary
public HalftoneRegion(final SubInputStream subInputStream)
HalftoneRegionback to summary
public HalftoneRegion(final SubInputStream subInputStream, final SegmentHeader segmentHeader)

Method Detail

combineGrayScalePlanesback to summary
private Bitmap[] combineGrayScalePlanes(Bitmap[] grayScalePlanes, int j)
computeGrayScaleValuesback to summary
private int[][] computeGrayScaleValues(final Bitmap[] grayScalePlanes, final int bitsPerValue)
computeSegmentDataStructureback to summary
private void computeSegmentDataStructure() throws IOException
computeXback to summary
private int computeX(final int m, final int n)
computeYback to summary
private int computeY(final int m, final int n)
getCombinationOperatorback to summary
public CombinationOperator getCombinationOperator()
getHDefaultPixelback to summary
protected byte getHDefaultPixel()
getHGridHeightback to summary
protected int getHGridHeight()
getHGridWidthback to summary
protected int getHGridWidth()
getHGridXback to summary
protected int getHGridX()
getHGridYback to summary
protected int getHGridY()
getHRegionXback to summary
protected int getHRegionX()
getHRegionYback to summary
protected int getHRegionY()
getHTemplateback to summary
protected byte getHTemplate()
getPatternsback to summary
private ArrayList<Bitmap> getPatterns() throws InvalidHeaderValueException, IOException
getRegionBitmapback to summary
public Bitmap getRegionBitmap() throws IOException, InvalidHeaderValueException

Implements org.apache.pdfbox.jbig2.Region.getRegionBitmap.

The procedure is described in JBIG2 ISO standard, 6.6.5.

Returns:Bitmap

The decoded Bitmap of this region.

Exceptions
IOException:
if an underlying IO operation fails
InvalidHeaderValueException:
if a segment header value is invalid
getRegionInfoback to summary
public RegionSegmentInformation getRegionInfo()

Implements org.apache.pdfbox.jbig2.Region.getRegionInfo.

Doc from org.apache.pdfbox.jbig2.Region.getRegionInfo.

Simply returns the RegionSegmentInformation.

Returns:RegionSegmentInformation

The RegionSegmentInformation.

grayScaleDecodingback to summary
private int[][] grayScaleDecoding(final int bitsPerValue) throws IOException

Gray-scale image decoding procedure is special for halftone region decoding and is described in Annex C.5 on page 98.

initback to summary
public void init(final SegmentHeader header, final 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
isHSkipEnabledback to summary
protected boolean isHSkipEnabled()
isMMREncodedback to summary
protected boolean isMMREncoded()
parseHeaderback to summary
private void parseHeader() throws IOException, InvalidHeaderValueException
renderPatternback to summary
private void renderPattern(final int[][] grayScaleValues)

This method draws the pattern into the region bitmap (htReg), as described in 6.6.5.2, page 42

shiftAndFillback to summary
private int shiftAndFill(int value)