Package org.apache.pdfbox.jbig2.image
Class Bitmaps
java.lang.Object
org.apache.pdfbox.jbig2.image.Bitmaps
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImage
asBufferedImage
(Bitmap bitmap) Returns the given bitmap as buffered image.static BufferedImage
asBufferedImage
(Bitmap bitmap, ImageReadParam param, FilterType filterType) Returns the given bitmap as buffered image.static BufferedImage
asBufferedImage
(Bitmap bitmap, FilterType filterType) Returns the given bitmap as buffered image.static WritableRaster
Returns the given bitmap as writable raster.static WritableRaster
asRaster
(Bitmap bitmap, ImageReadParam param, FilterType filterType) Returns the given bitmap as writable raster.static 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 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
Returns the specified rectangle area of the bitmap.static Bitmap
subsample
(Bitmap src, 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.
-
Constructor Details
-
Bitmaps
public Bitmaps()
-
-
Method Details
-
asRaster
Returns the given bitmap as writable raster.- Parameters:
bitmap
- the given bitmap- Returns:
- the raster representation of the bitmap
-
asRaster
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
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 WritableRaster buildRaster(Bitmap bitmap, FilterType filterType, double scaleX, double scaleY) -
asBufferedImage
Returns the given bitmap as buffered image.- Parameters:
bitmap
- the given bitmap- Returns:
- the image representation of the bitmap
-
asBufferedImage
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 BufferedImage asBufferedImage(Bitmap bitmap, 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
Returns the specified rectangle area of the bitmap.- Parameters:
roi
- - ARectangle
that specifies the requested image section.src
- the given bitmap- Returns:
- A
Bitmap
that represents the requested image section.
-
copyLine
-
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
-
subsampleX
-
subsampleY
-
combineBytes
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)
-