Class BMPImageWriteParam
ImageWriteParam for encoding images in
the BMP format.
This class allows for the specification of various parameters while writing a BMP format image file. By default, the data layout is bottom-up, such that the pixels are stored in bottom-up order, the first scanline being stored last.
The particular compression scheme to be used can be specified by using
the setCompressionType() method with the appropriate type
string. The compression scheme specified will be honored if and only if it
is compatible with the type of image being written. If the specified
compression scheme is not compatible with the type of image being written
then the IOException will be thrown by the BMP image writer.
If the compression type is not set explicitly then getCompressionType()
will return null. In this case the BMP image writer will select
a compression type that supports encoding of the given image without loss
of the color resolution.
The compression type strings and the image type(s) each supports are listed in the following table:
| Type String | Description | Image Types |
|---|---|---|
| BI_RGB | Uncompressed RLE | <= 8-bits/sample |
| BI_RLE8 | 8-bit Run Length Encoding | <= 8-bits/sample |
| BI_RLE4 | 4-bit Run Length Encoding | <= 4-bits/sample |
| BI_BITFIELDS | Packed data | 16 or 32 bits/sample |
-
Field Summary
Fields declared in class ImageWriteParam
canOffsetTiles, canWriteCompressed, canWriteProgressive, canWriteTiles, compressionMode, compressionQuality, compressionType, compressionTypes, locale, MODE_COPY_FROM_METADATA, MODE_DEFAULT, MODE_DISABLED, MODE_EXPLICIT, preferredTileSizes, progressiveMode, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, tilingMode, tilingSetModifier and TypeFieldDescriptionprotected booleanAbooleanthat istrueif thisImageWriteParamallows tiling grid offset parameters to be set.protected booleanAbooleanthat istrueif this writer can write images using compression.protected booleanAbooleanthat istrueif thisImageWriteParamallows images to be written as a progressive sequence of increasing quality passes.protected booleanAbooleanthat istrueif thisImageWriteParamallows tile width and tile height parameters to be set.protected intThe mode controlling compression settings, which must be set to one of the fourMODE_*values.protected floatAfloatcontaining the current compression quality setting.protected StringAStringcontaining the name of the current compression type, ornullif none is set.protected String[]An array ofStrings containing the names of the available compression types.protected LocaleALocaleto be used to localize compression type names and quality descriptions, ornullto use a defaultLocale.static final intA constant value that may be passed into methods such assetTilingMode,setProgressiveMode, orsetCompressionModeto enable that feature for future writes.static final intA constant value that may be passed into methods such assetTilingMode,setProgressiveMode, andsetCompressionModeto enable that feature for future writes.static final intA constant value that may be passed into methods such assetTilingMode,setProgressiveMode, andsetCompressionModeto disable a feature for future writes.static final intA constant value that may be passed into methods such assetTilingModeorsetCompressionModeto enable a feature for future writes.protected Dimension[]An array of preferred tile size range pairs.protected intThe mode controlling progressive encoding, which must be set to one of the fourMODE_*values, exceptMODE_EXPLICIT.protected intThe amount by which the tile grid origin should be offset horizontally from the image origin if tiling has been set, or 0 otherwise.protected intThe amount by which the tile grid origin should be offset vertically from the image origin if tiling has been set, or 0 otherwise.protected intThe height of each tile if tiling has been set, or 0 otherwise.protected intThe width of each tile if tiling has been set, or 0 otherwise.protected intThe mode controlling tiling settings, which Must be set to one of the fourMODE_*values.protected booleanAbooleanthat istrueif tiling parameters have been specified.Fields declared in class IIOParam
controller, defaultController, destinationOffset, destinationType, sourceBands, sourceRegion, sourceXSubsampling, sourceYSubsampling, subsamplingXOffset, subsamplingYOffsetModifier and TypeFieldDescriptionprotected IIOParamControllerTheIIOParamControllerthat will be used to provide settings for thisIIOParamobject when theactivateControllermethod is called.protected IIOParamControllerThe defaultIIOParamControllerthat will be used to provide settings for thisIIOParamobject when theactivateControllermethod is called.protected PointThe offset in the destination where the upper-left decoded pixel should be placed.protected ImageTypeSpecifierAnImageTypeSpecifierto be used to generate a destination image when reading, or to set the output color type when writing.protected int[]An array ofints indicating which source bands will be used, ornull.protected RectangleThe source region, onnullif none is set.protected intThe decimation subsampling to be applied in the horizontal direction.protected intThe decimation subsampling to be applied in the vertical direction.protected intA horizontal offset to be applied to the subsampling grid before subsampling.protected intA vertical offset to be applied to the subsampling grid before subsampling. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs anBMPImageWriteParamobject with default values for all parameters and anull Locale.BMPImageWriteParam(Locale locale) Constructs aBMPImageWriteParamset to use a givenLocaleand with default values for all parameters. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thetopDownparameter.voidsetTopDown(boolean topDown) If set, the data will be written out in a top-down manner, the first scanline being written first.Methods declared in class ImageWriteParam
canOffsetTiles, canWriteCompressed, canWriteProgressive, canWriteTiles, getBitRate, getCompressionMode, getCompressionQuality, getCompressionQualityDescriptions, getCompressionQualityValues, getCompressionType, getCompressionTypes, getLocale, getLocalizedCompressionTypeName, getPreferredTileSizes, getProgressiveMode, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getTilingMode, isCompressionLossless, setCompressionMode, setCompressionQuality, setCompressionType, setProgressiveMode, setTiling, setTilingMode, unsetCompression, unsetTilingModifier and TypeMethodDescriptionbooleanReturnstrueif the writer can perform tiling with non-zero grid offsets while writing.booleanReturnstrueif this writer supports compression.booleanReturnstrueif the writer can write out images as a series of passes of progressively increasing quality.booleanReturnstrueif the writer can perform tiling while writing.floatgetBitRate(float quality) Returns afloatindicating an estimate of the number of bits of output data for each bit of input image data at the given quality level.intReturns the current compression mode, if compression is supported.floatReturns the current compression quality setting.String[]Returns an array ofStrings that may be used along withgetCompressionQualityValuesas part of a user interface for setting or displaying the compression quality level.float[]Returns an array offloats that may be used along withgetCompressionQualityDescriptionsas part of a user interface for setting or displaying the compression quality level.Returns the currently set compression type, ornullif none has been set.String[]Returns a list of available compression types, as an array orStrings, ornullif a compression type may not be chosen using these interfaces.Returns the currently setLocale, ornullif only a defaultLocaleis supported.Returns a localized version of the name of the current compression type, using theLocalereturned bygetLocale.Returns an array ofDimensions indicating the legal size ranges for tiles as they will be encoded in the output file or stream.intReturns the current mode for writing the stream in a progressive manner.intReturns the horizontal tile grid offset of an image as it will be written to the output stream.intReturns the vertical tile grid offset of an image as it will be written to the output stream.intReturns the height of each tile in an image as it will be written to the output stream.intReturns the width of each tile in an image as it will be written to the output stream.intReturns the current tiling mode, if tiling is supported.booleanReturnstrueif the current compression type provides lossless compression.voidsetCompressionMode(int mode) Specifies whether compression is to be performed, and if so how compression parameters are to be determined.voidsetCompressionQuality(float quality) Sets the compression quality to a value between0and1.voidsetCompressionType(String compressionType) Sets the compression type to one of the values indicated bygetCompressionTypes.voidsetProgressiveMode(int mode) Specifies that the writer is to write the image out in a progressive mode such that the stream will contain a series of scans of increasing quality.voidsetTiling(int tileWidth, int tileHeight, int tileGridXOffset, int tileGridYOffset) Specifies that the image should be tiled in the output stream.voidsetTilingMode(int mode) Determines whether the image will be tiled in the output stream and, if it will, how the tiling parameters will be determined.voidRemoves any previous compression type and quality settings.voidRemoves any previous tile grid parameters specified by calls tosetTiling.Methods declared in class IIOParam
activateController, getController, getDefaultController, getDestinationOffset, getDestinationType, getSourceBands, getSourceRegion, getSourceXSubsampling, getSourceYSubsampling, getSubsamplingXOffset, getSubsamplingYOffset, hasController, setController, setDestinationOffset, setDestinationType, setSourceBands, setSourceRegion, setSourceSubsamplingModifier and TypeMethodDescriptionbooleanActivates the installedIIOParamControllerfor thisIIOParamobject and returns the resulting value.Returns whateverIIOParamControlleris currently installed.Returns the defaultIIOParamController, if there is one, regardless of the currently installed controller.Returns the offset in the destination image at which pixels are to be placed.Returns the type of image to be returned by the read, if one was set by a call tosetDestination(ImageTypeSpecifier), as anImageTypeSpecifier.int[]Returns the set of source bands to be used.Returns the source region to be used.intReturns the number of source columns to advance for each pixel.intReturns the number of rows to advance for each pixel.intReturns the horizontal offset of the subsampling grid.intReturns the vertical offset of the subsampling grid.booleanReturnstrueif there is a controller installed for thisIIOParamobject.voidsetController(IIOParamController controller) Sets theIIOParamControllerto be used to provide settings for thisIIOParamobject when theactivateControllermethod is called, overriding any default controller.voidsetDestinationOffset(Point destinationOffset) Specifies the offset in the destination image at which future decoded pixels are to be placed, when reading, or where a region will be written, when writing.voidsetDestinationType(ImageTypeSpecifier destinationType) Sets the desired image type for the destination image, using anImageTypeSpecifier.voidsetSourceBands(int[] sourceBands) Sets the indices of the source bands to be used.voidsetSourceRegion(Rectangle sourceRegion) Sets the source region of interest.voidsetSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling, int subsamplingXOffset, int subsamplingYOffset) Specifies a decimation subsampling to apply on I/O.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.booleanIndicates whether some other object is "equal to" this one.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class<?> getClass()Returns the runtime class of thisObject.inthashCode()Returns a hash code value for this object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
BMPImageWriteParam
Constructs aBMPImageWriteParamset to use a givenLocaleand with default values for all parameters.- Parameters:
locale- aLocaleto be used to localize compression type names and quality descriptions, ornull.
-
BMPImageWriteParam
public BMPImageWriteParam()Constructs anBMPImageWriteParamobject with default values for all parameters and anull Locale.
-
-
Method Details
-
setTopDown
public void setTopDown(boolean topDown) If set, the data will be written out in a top-down manner, the first scanline being written first.- Parameters:
topDown- whether the data are written in top-down order.
-
isTopDown
public boolean isTopDown()Returns the value of thetopDownparameter. The default isfalse.- Returns:
- whether the data are written in top-down order.
-