public class BMPImageReader extends ImageReader implements BMPConstants
ImageReadParam
.
This class supports Microsoft Windows Bitmap Version 3-5,
as well as OS/2 Bitmap Version 2.x (for single-image BMP file).Modifier and Type | Class and Description |
---|---|
private class |
BMPImageReader.EmbeddedProgressAdapter |
Modifier and Type | Field and Description |
---|---|
private int |
alphaMask |
private BufferedImage |
bi
The destination image.
|
private long |
bitmapFileSize |
private long |
bitmapOffset |
private int |
bitsPerPixel |
private int |
blueMask |
private ColorModel |
colorModel |
private long |
compression |
private int[] |
destBands
source and destination bands.
|
private Rectangle |
destinationRegion
The destination region.
|
private boolean |
gotHeader
Indicates whether the header is read.
|
private int |
greenMask |
private int |
height
The original image height.
|
private ImageInputStream |
iis
The input stream where reads from
|
private long |
imageDataOffset
The stream position where the image data starts.
|
private long |
imageSize |
private int |
imageType |
private boolean |
isBottomUp |
private BMPMetadata |
metadata
The metadata from the stream.
|
private boolean |
noTransform
Indicates whether subsampled, subregion is required, and offset is
defined
|
private int |
numBands |
private ColorModel |
originalColorModel |
private SampleModel |
originalSampleModel |
private byte[] |
palette |
private int |
redMask |
private SampleModel |
sampleModel |
private int |
scaleX
The scaling factors.
|
private int |
scaleY
The scaling factors.
|
private boolean |
seleBand
Indicates whether subband is selected.
|
private int[] |
sourceBands
source and destination bands.
|
private Rectangle |
sourceRegion
The source region.
|
private static int |
VERSION_2_1_BIT |
private static int |
VERSION_2_24_BIT |
private static int |
VERSION_2_4_BIT |
private static int |
VERSION_2_8_BIT |
private static int |
VERSION_3_1_BIT |
private static int |
VERSION_3_24_BIT |
private static int |
VERSION_3_4_BIT |
private static int |
VERSION_3_8_BIT |
private static int |
VERSION_3_NT_16_BIT |
private static int |
VERSION_3_NT_32_BIT |
private static int |
VERSION_3_XP_EMBEDDED |
private static int |
VERSION_4_1_BIT |
private static int |
VERSION_4_16_BIT |
private static int |
VERSION_4_24_BIT |
private static int |
VERSION_4_32_BIT |
private static int |
VERSION_4_4_BIT |
private static int |
VERSION_4_8_BIT |
private static int |
VERSION_4_XP_EMBEDDED |
private static int |
VERSION_5_XP_EMBEDDED |
private int |
width
The original image width.
|
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales
BI_BITFIELDS, BI_JPEG, BI_PNG, BI_RGB, BI_RLE4, BI_RLE8, compressionTypeNames, LCS_CALIBRATED_RGB, LCS_sRGB, LCS_WINDOWS_COLOR_SPACE, PROFILE_EMBEDDED, PROFILE_LINKED, VERSION_2, VERSION_3, VERSION_3_NT, VERSION_4, VERSION_5
Constructor and Description |
---|
BMPImageReader(ImageReaderSpi originator)
Constructs
BMPImageReader from the provided
ImageReaderSpi . |
Modifier and Type | Method and Description |
---|---|
boolean |
canReadRaster() |
private void |
checkIndex(int imageIndex) |
private void |
decodeRLE4(int imSize,
int padding,
byte[] values,
byte[] bdata) |
private void |
decodeRLE8(int imSize,
int padding,
byte[] values,
byte[] bdata) |
ImageReadParam |
getDefaultReadParam() |
int |
getHeight(int imageIndex) |
IIOMetadata |
getImageMetadata(int imageIndex) |
Iterator |
getImageTypes(int imageIndex) |
int |
getNumImages(boolean allowSearch)
Overrides the method defined in the superclass.
|
IIOMetadata |
getStreamMetadata() |
int |
getWidth(int imageIndex) |
boolean |
isRandomAccessEasy(int imageIndex) |
BufferedImage |
read(int imageIndex,
ImageReadParam param) |
private void |
read16Bit(short[] sdata) |
private void |
read1Bit(byte[] bdata) |
private void |
read24Bit(byte[] bdata) |
private void |
read32Bit(int[] idata) |
private void |
read4Bit(byte[] bdata) |
private void |
read8Bit(byte[] bdata) |
private BufferedImage |
readEmbedded(int type,
BufferedImage bi,
ImageReadParam bmpParam)
Decodes the jpeg/png image embedded in the bitmap using any jpeg
ImageIO-style plugin.
|
void |
readHeader() |
Raster |
readRaster(int imageIndex,
ImageReadParam param) |
private void |
readRLE4(byte[] bdata) |
private void |
readRLE8(byte[] bdata) |
void |
reset() |
private void |
resetHeaderInfo() |
void |
setInput(Object input,
boolean seekForwardOnly,
boolean ignoreMetadata)
Overrides the method defined in the superclass.
|
abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, checkReadParamBandSettings, clearAbortRequest, computeRegions, dispose, getAspectRatio, getAvailableLocales, getDestination, getFormatName, getImageMetadata, getInput, getLocale, getMinIndex, getNumThumbnails, getOriginatingProvider, getRawImageType, getSourceRegion, getStreamMetadata, getThumbnailHeight, getThumbnailWidth, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, hasThumbnails, isIgnoringMetadata, isImageTiled, isSeekForwardOnly, processImageComplete, processImageProgress, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, read, readAll, readAll, readAsRenderedImage, readerSupportsThumbnails, readThumbnail, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, setInput, setInput, setLocale
private static final int VERSION_2_1_BIT
private static final int VERSION_2_4_BIT
private static final int VERSION_2_8_BIT
private static final int VERSION_2_24_BIT
private static final int VERSION_3_1_BIT
private static final int VERSION_3_4_BIT
private static final int VERSION_3_8_BIT
private static final int VERSION_3_24_BIT
private static final int VERSION_3_NT_16_BIT
private static final int VERSION_3_NT_32_BIT
private static final int VERSION_4_1_BIT
private static final int VERSION_4_4_BIT
private static final int VERSION_4_8_BIT
private static final int VERSION_4_16_BIT
private static final int VERSION_4_24_BIT
private static final int VERSION_4_32_BIT
private static final int VERSION_3_XP_EMBEDDED
private static final int VERSION_4_XP_EMBEDDED
private static final int VERSION_5_XP_EMBEDDED
private long bitmapFileSize
private long bitmapOffset
private long compression
private long imageSize
private byte[] palette
private int imageType
private int numBands
private boolean isBottomUp
private int bitsPerPixel
private int redMask
private int greenMask
private int blueMask
private int alphaMask
private SampleModel sampleModel
private SampleModel originalSampleModel
private ColorModel colorModel
private ColorModel originalColorModel
private ImageInputStream iis
private boolean gotHeader
private long imageDataOffset
private int width
private int height
private Rectangle destinationRegion
private Rectangle sourceRegion
private BMPMetadata metadata
private BufferedImage bi
private boolean noTransform
private boolean seleBand
private int scaleX
private int scaleY
private int[] sourceBands
private int[] destBands
public BMPImageReader(ImageReaderSpi originator)
BMPImageReader
from the provided
ImageReaderSpi
.public void setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata)
setInput
in class ImageReader
public int getNumImages(boolean allowSearch) throws IOException
getNumImages
in class ImageReader
IOException
public int getWidth(int imageIndex) throws IOException
getWidth
in class ImageReader
IOException
public int getHeight(int imageIndex) throws IOException
getHeight
in class ImageReader
IOException
private void checkIndex(int imageIndex)
public void readHeader() throws IOException
IOException
public Iterator getImageTypes(int imageIndex) throws IOException
getImageTypes
in class ImageReader
IOException
public ImageReadParam getDefaultReadParam()
getDefaultReadParam
in class ImageReader
public IIOMetadata getImageMetadata(int imageIndex) throws IOException
getImageMetadata
in class ImageReader
IOException
public IIOMetadata getStreamMetadata() throws IOException
getStreamMetadata
in class ImageReader
IOException
public boolean isRandomAccessEasy(int imageIndex) throws IOException
isRandomAccessEasy
in class ImageReader
IOException
public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException
read
in class ImageReader
IOException
public boolean canReadRaster()
canReadRaster
in class ImageReader
public Raster readRaster(int imageIndex, ImageReadParam param) throws IOException
readRaster
in class ImageReader
IOException
private void resetHeaderInfo()
public void reset()
reset
in class ImageReader
private void read1Bit(byte[] bdata) throws IOException
IOException
private void read4Bit(byte[] bdata) throws IOException
IOException
private void read8Bit(byte[] bdata) throws IOException
IOException
private void read24Bit(byte[] bdata) throws IOException
IOException
private void read16Bit(short[] sdata) throws IOException
IOException
private void read32Bit(int[] idata) throws IOException
IOException
private void readRLE8(byte[] bdata) throws IOException
IOException
private void decodeRLE8(int imSize, int padding, byte[] values, byte[] bdata) throws IOException
IOException
private void readRLE4(byte[] bdata) throws IOException
IOException
private void decodeRLE4(int imSize, int padding, byte[] values, byte[] bdata) throws IOException
IOException
private BufferedImage readEmbedded(int type, BufferedImage bi, ImageReadParam bmpParam) throws IOException
bi
- The destination BufferedImage
.bmpParam
- The ImageReadParam
for decoding this
BMP image. The parameters for subregion, band selection and
subsampling are used in decoding the jpeg image.IOException
Copyright © 2015 Open Microscopy Environment