Class DIBImageReader

    • Constructor Detail

      • DIBImageReader

        protected DIBImageReader​(javax.imageio.spi.ImageReaderSpi provider)
    • Method Detail

      • getImageTypes

        public java.util.Iterator<javax.imageio.ImageTypeSpecifier> getImageTypes​(int imageIndex)
                                                                           throws java.io.IOException
        Specified by:
        getImageTypes in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getNumImages

        public int getNumImages​(boolean allowSearch)
                         throws java.io.IOException
        Description copied from class: ImageReaderBase
        Default implementation that always returns 1.
        Overrides:
        getNumImages in class ImageReaderBase
        Parameters:
        allowSearch - ignored, unless overridden
        Returns:
        1, unless overridden
        Throws:
        java.io.IOException - never, unless overridden
      • getWidth

        public int getWidth​(int imageIndex)
                     throws java.io.IOException
        Specified by:
        getWidth in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getHeight

        public int getHeight​(int imageIndex)
                      throws java.io.IOException
        Specified by:
        getHeight in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • read

        public java.awt.image.BufferedImage read​(int imageIndex,
                                                 javax.imageio.ImageReadParam param)
                                          throws java.io.IOException
        Specified by:
        read in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • isPNG

        private boolean isPNG​(DirectoryEntry entry)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • readPNG

        private java.awt.image.BufferedImage readPNG​(DirectoryEntry entry,
                                                     javax.imageio.ImageReadParam param)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • getImageTypesPNG

        private java.util.Iterator<javax.imageio.ImageTypeSpecifier> getImageTypesPNG​(DirectoryEntry entry)
                                                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • initPNGReader

        private javax.imageio.ImageReader initPNGReader​(DirectoryEntry entry)
                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • getPNGReader

        private javax.imageio.ImageReader getPNGReader()
                                                throws javax.imageio.IIOException
        Throws:
        javax.imageio.IIOException
      • getHeader

        private DIBHeader getHeader​(DirectoryEntry entry)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • readBitmap

        private java.awt.image.BufferedImage readBitmap​(DirectoryEntry entry)
                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • readBitmapIndexed

        private void readBitmapIndexed​(BitmapIndexed bitmap)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • readColorMap

        private void readColorMap​(BitmapIndexed bitmap)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • readBitmapIndexed1

        private void readBitmapIndexed1​(BitmapIndexed bitmap,
                                        boolean asMask)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • readBitmapIndexed4

        private void readBitmapIndexed4​(BitmapIndexed bitmap)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • readBitmapIndexed8

        private void readBitmapIndexed8​(BitmapIndexed bitmap)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • adjustToPadding

        private static int adjustToPadding​(int width)
        Parameters:
        width - Bytes per scan line (i.e., 1BPP, width = 9 -> bytes = 2)
        Returns:
        padded width
      • readBitmap16

        private void readBitmap16​(BitmapDescriptor bitmap)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • readBitmap24

        private void readBitmap24​(BitmapDescriptor bitmap)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • readBitmap32

        private void readBitmap32​(BitmapDescriptor bitmap)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • getDirectory

        private Directory getDirectory()
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • readFileHeader

        private void readFileHeader()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • getEntry

        final DirectoryEntry getEntry​(int imageIndex)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • readImagesInFile

        private static void readImagesInFile​(java.lang.String fileName,
                                             javax.imageio.ImageReader reader,
                                             java.awt.Container container)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • createWindow

        private static javax.swing.JFrame createWindow​(java.lang.String title)
      • addImage

        private static void addImage​(java.awt.Container parent,
                                     javax.imageio.ImageReader reader,
                                     int imageNo)
                              throws java.io.IOException
        Throws:
        java.io.IOException