Class Bitmaps

java.lang.Object
org.apache.pdfbox.jbig2.image.Bitmaps

public class Bitmaps extends Object
  • Constructor Details

    • Bitmaps

      public Bitmaps()
  • Method Details

    • asRaster

      public static 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 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 WritableRaster asRaster(Bitmap bitmap, 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 WritableRaster buildRaster(Bitmap bitmap, FilterType filterType, double scaleX, double scaleY)
    • asBufferedImage

      public static 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 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 BufferedImage asBufferedImage(Bitmap bitmap, 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(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, 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)