Package com.aowagie.text.pdf.codec
Class BmpImage
java.lang.Object
com.aowagie.text.pdf.codec.BmpImage
Reads a BMP image. All types of BMP can be read.
It is based in the JAI codec.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private static final int
private static final int
private static final int
private static final int
private long
private long
private int
private int
private long
private int
private int
private long
private int
private InputStream
private boolean
private static final int
private static final int
private static final int
private int
private byte[]
private final HashMap
private int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private int
private long
private long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate byte[]
decodeRLE
(boolean is8, byte[] values) private int
findMask
(int mask) private int
findShift
(int mask) private Image
getImage()
static Image
getImage
(byte[] data) Reads a BMP from a byte array.private static Image
getImage
(InputStream is) Reads a BMP from a stream.static Image
getImage
(InputStream is, boolean noHeader, int size) Reads a BMP from a stream.static Image
Reads a BMP from an url.private byte[]
getPalette
(int group) private Image
indexedModel
(byte[] bdata, int bpc, int paletteEntries) private void
process
(InputStream stream, boolean noHeader) private Image
read1632Bit
(boolean is32) private Image
read1Bit
(int paletteEntries) private void
read24Bit
(byte[] bdata) private Image
read4Bit
(int paletteEntries) private Image
read8Bit
(int paletteEntries) private long
readDWord
(InputStream stream) private int
readInt
(InputStream stream) private int
readLong
(InputStream stream) private void
readPalette
(int sizeOfPalette) private Image
readRLE4()
private Image
readRLE8()
private int
readShort
(InputStream stream) private int
readUnsignedByte
(InputStream stream) private long
readUnsignedInt
(InputStream stream) private int
readUnsignedShort
(InputStream stream) private int
readWord
(InputStream stream)
-
Field Details
-
inputStream
-
bitmapFileSize
private long bitmapFileSize -
bitmapOffset
private long bitmapOffset -
compression
private long compression -
imageSize
private long imageSize -
palette
private byte[] palette -
imageType
private int imageType -
numBands
private int numBands -
isBottomUp
private boolean isBottomUp -
bitsPerPixel
private int bitsPerPixel -
redMask
private int redMask -
greenMask
private int greenMask -
blueMask
private int blueMask -
alphaMask
private int alphaMask -
properties
-
xPelsPerMeter
private long xPelsPerMeter -
yPelsPerMeter
private long yPelsPerMeter -
VERSION_2_1_BIT
private static final int VERSION_2_1_BIT- See Also:
-
VERSION_2_4_BIT
private static final int VERSION_2_4_BIT- See Also:
-
VERSION_2_8_BIT
private static final int VERSION_2_8_BIT- See Also:
-
VERSION_2_24_BIT
private static final int VERSION_2_24_BIT- See Also:
-
VERSION_3_1_BIT
private static final int VERSION_3_1_BIT- See Also:
-
VERSION_3_4_BIT
private static final int VERSION_3_4_BIT- See Also:
-
VERSION_3_8_BIT
private static final int VERSION_3_8_BIT- See Also:
-
VERSION_3_24_BIT
private static final int VERSION_3_24_BIT- See Also:
-
VERSION_3_NT_16_BIT
private static final int VERSION_3_NT_16_BIT- See Also:
-
VERSION_3_NT_32_BIT
private static final int VERSION_3_NT_32_BIT- See Also:
-
VERSION_4_1_BIT
private static final int VERSION_4_1_BIT- See Also:
-
VERSION_4_4_BIT
private static final int VERSION_4_4_BIT- See Also:
-
VERSION_4_8_BIT
private static final int VERSION_4_8_BIT- See Also:
-
VERSION_4_16_BIT
private static final int VERSION_4_16_BIT- See Also:
-
VERSION_4_24_BIT
private static final int VERSION_4_24_BIT- See Also:
-
VERSION_4_32_BIT
private static final int VERSION_4_32_BIT- See Also:
-
LCS_CALIBRATED_RGB
private static final int LCS_CALIBRATED_RGB- See Also:
-
LCS_sRGB
private static final int LCS_sRGB- See Also:
-
LCS_CMYK
private static final int LCS_CMYK- See Also:
-
BI_RGB
private static final int BI_RGB- See Also:
-
BI_RLE8
private static final int BI_RLE8- See Also:
-
BI_RLE4
private static final int BI_RLE4- See Also:
-
BI_BITFIELDS
private static final int BI_BITFIELDS- See Also:
-
width
private int width -
height
private int height
-
-
Constructor Details
-
BmpImage
- Throws:
IOException
-
-
Method Details
-
getImage
Reads a BMP from an url.- Parameters:
url
- the url- Returns:
- the image
- Throws:
IOException
- on error
-
getImage
Reads a BMP from a stream. The stream is not closed.- Parameters:
is
- the stream- Returns:
- the image
- Throws:
IOException
- on error
-
getImage
Reads a BMP from a stream. The stream is not closed. The BMP may not have a header and be considered as a plain DIB.- Parameters:
is
- the streamnoHeader
- true to process a plain DIBsize
- the size of the DIB. Not used for a BMP- Returns:
- the image
- Throws:
IOException
- on error
-
getImage
Reads a BMP from a byte array.- Parameters:
data
- the byte array- Returns:
- the image
- Throws:
IOException
- on error
-
process
- Throws:
IOException
-
getPalette
private byte[] getPalette(int group) -
getImage
- Throws:
IOException
BadElementException
-
indexedModel
- Throws:
BadElementException
-
readPalette
- Throws:
IOException
-
read1Bit
- Throws:
IOException
BadElementException
-
read4Bit
- Throws:
IOException
BadElementException
-
read8Bit
- Throws:
IOException
BadElementException
-
read24Bit
private void read24Bit(byte[] bdata) -
findMask
private int findMask(int mask) -
findShift
private int findShift(int mask) -
read1632Bit
- Throws:
IOException
BadElementException
-
readRLE8
- Throws:
IOException
BadElementException
-
readRLE4
- Throws:
IOException
BadElementException
-
decodeRLE
private byte[] decodeRLE(boolean is8, byte[] values) -
readUnsignedByte
- Throws:
IOException
-
readUnsignedShort
- Throws:
IOException
-
readShort
- Throws:
IOException
-
readWord
- Throws:
IOException
-
readUnsignedInt
- Throws:
IOException
-
readInt
- Throws:
IOException
-
readDWord
- Throws:
IOException
-
readLong
- Throws:
IOException
-