Class Bitmaps


  • public class Bitmaps
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Bitmaps()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.awt.image.BufferedImage asBufferedImage​(Bitmap bitmap)
      Returns the given bitmap as buffered image.
      static java.awt.image.BufferedImage asBufferedImage​(Bitmap bitmap, javax.imageio.ImageReadParam param, FilterType filterType)
      Returns the given bitmap as buffered image.
      static java.awt.image.BufferedImage asBufferedImage​(Bitmap bitmap, FilterType filterType)
      Returns the given bitmap as buffered image.
      static java.awt.image.WritableRaster asRaster​(Bitmap bitmap)
      Returns the given bitmap as writable raster.
      static java.awt.image.WritableRaster asRaster​(Bitmap bitmap, javax.imageio.ImageReadParam param, FilterType filterType)
      Returns the given bitmap as writable raster.
      static java.awt.image.WritableRaster asRaster​(Bitmap bitmap, FilterType filterType)
      Returns the given bitmap as writable raster.
      static void blit​(Bitmap src, Bitmap dst, int x, int y, CombinationOperator combinationOperator)
      This method combines a given bitmap with the current instance.
      private static void blitShifted​(Bitmap src, Bitmap dst, int startLine, int lastLine, int dstStartIdx, int srcStartIdx, int srcEndIdx, int toShift, int shiftVal1, int shiftVal2, CombinationOperator op, int padding)  
      private static void blitSpecialShifted​(Bitmap src, Bitmap dst, int startLine, int lastLine, int dstStartIdx, int srcStartIdx, int srcEndIdx, int toShift, int shiftVal1, int shiftVal2, CombinationOperator op)  
      private static void blitUnshifted​(Bitmap src, Bitmap dst, int startLine, int lastLine, int dstStartIdx, int srcStartIdx, int srcEndIdx, CombinationOperator op)  
      private static java.awt.image.WritableRaster buildRaster​(Bitmap bitmap, FilterType filterType, double scaleX, double scaleY)  
      static byte combineBytes​(byte value1, byte value2, CombinationOperator op)
      The method combines two given bytes with an logical operator.
      private static void copyLine​(Bitmap src, Bitmap dst, int sourceUpShift, int sourceDownShift, int padding, int firstSourceByteOfLine, int lastSourceByteOfLine, boolean usePadding, int sourceOffset, int targetOffset)  
      static Bitmap extract​(java.awt.Rectangle roi, Bitmap src)
      Returns the specified rectangle area of the bitmap.
      static Bitmap subsample​(Bitmap src, javax.imageio.ImageReadParam param)  
      static Bitmap subsampleX​(Bitmap src, int xSubsampling, int xSubsamplingOffset)  
      static Bitmap subsampleY​(Bitmap src, int ySubsampling, int ySubsamplingOffset)  
      private static byte unpad​(int padding, byte value)
      Removes unnecessary bits from a byte.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Bitmaps

        public Bitmaps()
    • Method Detail

      • asRaster

        public static java.awt.image.WritableRaster asRaster​(Bitmap bitmap)
        Returns the given bitmap as writable raster.
        Parameters:
        bitmap - the given bitmap
        Returns:
        the raster representation of the bitmap
      • asRaster

        public static java.awt.image.WritableRaster asRaster​(Bitmap bitmap,
                                                             FilterType filterType)
        Returns the given bitmap as writable raster.
        Parameters:
        bitmap - the given bitmap
        filterType - type of filter which is used when creating the writable raster
        Returns:
        the raster representation of the bitmap
      • asRaster

        public static java.awt.image.WritableRaster asRaster​(Bitmap bitmap,
                                                             javax.imageio.ImageReadParam param,
                                                             FilterType filterType)
        Returns the given bitmap as writable raster.
        Parameters:
        bitmap - the given bitmap
        param - ImageReadParam to be used when creating the writable raster
        filterType - type of filter which is used when creating the writable raster
        Returns:
        the raster representation of the bitmap
      • buildRaster

        private static java.awt.image.WritableRaster buildRaster​(Bitmap bitmap,
                                                                 FilterType filterType,
                                                                 double scaleX,
                                                                 double scaleY)
      • asBufferedImage

        public static java.awt.image.BufferedImage asBufferedImage​(Bitmap bitmap)
        Returns the given bitmap as buffered image.
        Parameters:
        bitmap - the given bitmap
        Returns:
        the image representation of the bitmap
      • asBufferedImage

        public static java.awt.image.BufferedImage asBufferedImage​(Bitmap bitmap,
                                                                   FilterType filterType)
        Returns the given bitmap as buffered image.
        Parameters:
        bitmap - the given bitmap
        filterType - type of filter which is used when creating the buffered image
        Returns:
        the image representation of the bitmap
      • asBufferedImage

        public static java.awt.image.BufferedImage asBufferedImage​(Bitmap bitmap,
                                                                   javax.imageio.ImageReadParam param,
                                                                   FilterType filterType)
        Returns the given bitmap as buffered image.
        Parameters:
        bitmap - the given bitmap
        param - ImageReadParam to be used when creating the buffered image
        filterType - type of filter which is used when creating the buffered image
        Returns:
        the image representation of the bitmap
      • extract

        public static Bitmap extract​(java.awt.Rectangle roi,
                                     Bitmap src)
        Returns the specified rectangle area of the bitmap.
        Parameters:
        roi - - A Rectangle that specifies the requested image section.
        src - the given bitmap
        Returns:
        A Bitmap that represents the requested image section.
      • copyLine

        private static void copyLine​(Bitmap src,
                                     Bitmap dst,
                                     int sourceUpShift,
                                     int sourceDownShift,
                                     int padding,
                                     int firstSourceByteOfLine,
                                     int lastSourceByteOfLine,
                                     boolean usePadding,
                                     int sourceOffset,
                                     int targetOffset)
      • unpad

        private static byte unpad​(int padding,
                                  byte value)
        Removes unnecessary bits from a byte.
        Parameters:
        padding - - The amount of unnecessary bits.
        value - - The byte that should be cleaned up.
        Returns:
        A cleaned byte.
      • subsample

        public static Bitmap subsample​(Bitmap src,
                                       javax.imageio.ImageReadParam param)
      • subsampleX

        public static Bitmap subsampleX​(Bitmap src,
                                        int xSubsampling,
                                        int xSubsamplingOffset)
      • subsampleY

        public static Bitmap subsampleY​(Bitmap src,
                                        int ySubsampling,
                                        int ySubsamplingOffset)
      • combineBytes

        public static byte combineBytes​(byte value1,
                                        byte value2,
                                        CombinationOperator op)
        The method combines two given bytes with an logical operator.

        The JBIG2 Standard specifies 5 possible combinations of bytes.

        Hint: Please take a look at ISO/IEC 14492:2001 (E) for detailed definition and description of the operators.

        Parameters:
        value1 - - The value that should be combined with value2.
        value2 - - The value that should be combined with value1.
        op - - The specified combination operator.
        Returns:
        The combination result.
      • blit

        public static void blit​(Bitmap src,
                                Bitmap dst,
                                int x,
                                int y,
                                CombinationOperator combinationOperator)
        This method combines a given bitmap with the current instance.

        Parts of the bitmap to blit that are outside of the target bitmap will be ignored.

        Parameters:
        src - - The bitmap that should be combined with the one of the current instance.
        dst - - The destination bitmap.
        x - - The x coordinate where the upper left corner of the bitmap to blit should be positioned.
        y - - The y coordinate where the upper left corner of the bitmap to blit should be positioned.
        combinationOperator - - The combination operator for combining two pixels.
      • blitUnshifted

        private static void blitUnshifted​(Bitmap src,
                                          Bitmap dst,
                                          int startLine,
                                          int lastLine,
                                          int dstStartIdx,
                                          int srcStartIdx,
                                          int srcEndIdx,
                                          CombinationOperator op)
      • blitSpecialShifted

        private static void blitSpecialShifted​(Bitmap src,
                                               Bitmap dst,
                                               int startLine,
                                               int lastLine,
                                               int dstStartIdx,
                                               int srcStartIdx,
                                               int srcEndIdx,
                                               int toShift,
                                               int shiftVal1,
                                               int shiftVal2,
                                               CombinationOperator op)
      • blitShifted

        private static void blitShifted​(Bitmap src,
                                        Bitmap dst,
                                        int startLine,
                                        int lastLine,
                                        int dstStartIdx,
                                        int srcStartIdx,
                                        int srcEndIdx,
                                        int toShift,
                                        int shiftVal1,
                                        int shiftVal2,
                                        CombinationOperator op,
                                        int padding)