Package com.itextpdf.text.pdf.codec
Class BmpImage
java.lang.Object
com.itextpdf.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 intprivate static final intprivate static final intprivate static final intprivate static final intprivate longprivate longprivate intprivate intprivate longprivate int(package private) intprivate longprivate intprivate InputStreamprivate booleanprivate static final intprivate static final intprivate static final intprivate intprivate byte[]private intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final int(package private) intprivate longprivate long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate byte[]decodeRLE(boolean is8, byte[] values) private intfindMask(int mask) private intfindShift(int mask) private ImagegetImage()static ImagegetImage(byte[] data) Reads a BMP from a byte array.static ImagegetImage(InputStream is) Reads a BMP from a stream.static ImagegetImage(InputStream is, boolean noHeader, int size) Reads a BMP from a stream.static ImageReads a BMP from a file.static ImageReads a BMP from an url.private byte[]getPalette(int group) private ImageindexedModel(byte[] bdata, int bpc, int paletteEntries) protected voidprocess(InputStream stream, boolean noHeader) private Imageread1632Bit(boolean is32) private Imageread1Bit(int paletteEntries) private voidread24Bit(byte[] bdata) private Imageread4Bit(int paletteEntries) private Imageread8Bit(int paletteEntries) private longreadDWord(InputStream stream) private intreadInt(InputStream stream) private intreadLong(InputStream stream) private voidreadPalette(int sizeOfPalette) private ImagereadRLE4()private ImagereadRLE8()private intreadShort(InputStream stream) private intreadUnsignedByte(InputStream stream) private longreadUnsignedInt(InputStream stream) private intreadUnsignedShort(InputStream stream) private intreadWord(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
int width -
height
int height
-
-
Constructor Details
-
BmpImage
BmpImage(InputStream is, boolean noHeader, int size) throws IOException - 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 file.- Parameters:
file- the file- 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:
IOExceptionBadElementException
-
indexedModel
- Throws:
BadElementException
-
readPalette
- Throws:
IOException
-
read1Bit
- Throws:
IOExceptionBadElementException
-
read4Bit
- Throws:
IOExceptionBadElementException
-
read8Bit
- Throws:
IOExceptionBadElementException
-
read24Bit
private void read24Bit(byte[] bdata) -
findMask
private int findMask(int mask) -
findShift
private int findShift(int mask) -
read1632Bit
- Throws:
IOExceptionBadElementException
-
readRLE8
- Throws:
IOExceptionBadElementException
-
readRLE4
- Throws:
IOExceptionBadElementException
-
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
-