Package org.apache.pdfbox.jbig2.image
Class Bitmaps
- java.lang.Object
-
- org.apache.pdfbox.jbig2.image.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.BufferedImageasBufferedImage(Bitmap bitmap)Returns the given bitmap as buffered image.static java.awt.image.BufferedImageasBufferedImage(Bitmap bitmap, javax.imageio.ImageReadParam param, FilterType filterType)Returns the given bitmap as buffered image.static java.awt.image.BufferedImageasBufferedImage(Bitmap bitmap, FilterType filterType)Returns the given bitmap as buffered image.static java.awt.image.WritableRasterasRaster(Bitmap bitmap)Returns the given bitmap as writable raster.static java.awt.image.WritableRasterasRaster(Bitmap bitmap, javax.imageio.ImageReadParam param, FilterType filterType)Returns the given bitmap as writable raster.static java.awt.image.WritableRasterasRaster(Bitmap bitmap, FilterType filterType)Returns the given bitmap as writable raster.static voidblit(Bitmap src, Bitmap dst, int x, int y, CombinationOperator combinationOperator)This method combines a given bitmap with the current instance.private static voidblitShifted(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 voidblitSpecialShifted(Bitmap src, Bitmap dst, int startLine, int lastLine, int dstStartIdx, int srcStartIdx, int srcEndIdx, int toShift, int shiftVal1, int shiftVal2, CombinationOperator op)private static voidblitUnshifted(Bitmap src, Bitmap dst, int startLine, int lastLine, int dstStartIdx, int srcStartIdx, int srcEndIdx, CombinationOperator op)private static java.awt.image.WritableRasterbuildRaster(Bitmap bitmap, FilterType filterType, double scaleX, double scaleY)static bytecombineBytes(byte value1, byte value2, CombinationOperator op)The method combines two given bytes with an logical operator.private static voidcopyLine(Bitmap src, Bitmap dst, int sourceUpShift, int sourceDownShift, int padding, int firstSourceByteOfLine, int lastSourceByteOfLine, boolean usePadding, int sourceOffset, int targetOffset)static Bitmapextract(java.awt.Rectangle roi, Bitmap src)Returns the specified rectangle area of the bitmap.static Bitmapsubsample(Bitmap src, javax.imageio.ImageReadParam param)static BitmapsubsampleX(Bitmap src, int xSubsampling, int xSubsamplingOffset)static BitmapsubsampleY(Bitmap src, int ySubsampling, int ySubsamplingOffset)private static byteunpad(int padding, byte value)Removes unnecessary bits from a byte.
-
-
-
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 bitmapfilterType- 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 bitmapparam- ImageReadParam to be used when creating the writable rasterfilterType- 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 bitmapfilterType- 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 bitmapparam- ImageReadParam to be used when creating the buffered imagefilterType- 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- - ARectanglethat specifies the requested image section.src- the given bitmap- Returns:
- A
Bitmapthat 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.
-
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)
-
-