Class HalftoneRegion

  • All Implemented Interfaces:
    Region, SegmentData

    public class HalftoneRegion
    extends java.lang.Object
    implements Region
    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 Detail

      • dataHeaderOffset

        private long dataHeaderOffset
      • dataHeaderLength

        private long dataHeaderLength
      • dataOffset

        private long dataOffset
      • dataLength

        private long dataLength
      • hDefaultPixel

        private byte hDefaultPixel
        Halftone segment information field, 7.4.5.1.1
      • hSkipEnabled

        private boolean hSkipEnabled
      • hTemplate

        private byte hTemplate
      • isMMREncoded

        private boolean isMMREncoded
      • hGridWidth

        private int hGridWidth
        Width of the gray-scale image, 7.4.5.1.2.1
      • hGridHeight

        private int hGridHeight
        Height of the gray-scale image, 7.4.5.1.2.2
      • hGridX

        private int hGridX
        Horizontal offset of the grid, 7.4.5.1.2.3
      • hGridY

        private int hGridY
        Vertical offset of the grid, 7.4.5.1.2.4
      • hRegionX

        private int hRegionX
        Horizontal coordinate of the halftone grid vector, 7.4.5.1.3.1
      • hRegionY

        private int hRegionY
        Vertical coordinate of the halftone grod vector, 7.4.5.1.3.2
      • halftoneRegionBitmap

        private Bitmap halftoneRegionBitmap
        Decoded data
      • patterns

        private java.util.ArrayList<Bitmap> patterns
        Previously decoded data from other regions or dictionaries, stored to use as patterns in this region.
    • Constructor Detail

      • HalftoneRegion

        public HalftoneRegion()
      • HalftoneRegion

        public HalftoneRegion​(SubInputStream subInputStream)
    • Method Detail

      • computeSegmentDataStructure

        private void computeSegmentDataStructure()
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • 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
      • grayScaleDecoding

        private int[][] grayScaleDecoding​(int bitsPerValue)
                                   throws java.io.IOException
        Gray-scale image decoding procedure is special for halftone region decoding and is described in Annex C.5 on page 98.
        Throws:
        java.io.IOException
      • combineGrayScalePlanes

        private Bitmap[] combineGrayScalePlanes​(Bitmap[] grayScalePlanes,
                                                int j)
      • computeGrayScaleValues

        private int[][] computeGrayScaleValues​(Bitmap[] grayScalePlanes,
                                               int bitsPerValue)
      • 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,
                         java.io.IOException
        Description copied from interface: SegmentData
        Parse the stream and read information of header.
        Specified by:
        init in interface SegmentData
        Parameters:
        header - - The segments' header (to make referred-to segments available in data part).
        sis - - Wrapped ImageInputStream into SubInputStream.
        Throws:
        InvalidHeaderValueException - if the segment header value is invalid
        java.io.IOException - if an underlying IO operation fails
      • 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()