|
This release of the JAI specification contains no API changes from the 1.0 release. The reference implementation, called Java Advanced Imaging 1.0.2, contains bug fixes and performance improvements.
The Java Advanced Imaging API home page is located at http://java.sun.com/products/java-media/jai/. There you will find binaries, documentation, answers to freqeuently asked questions, and other information.
Two small API additions were made to the unofficial classes in the com.sun.media.jai.codec package.
The changes are described in the "What's New" section of this document.
This version of Java Advanced Imaging requires the following:
All areas of the core JAI specification have been implemented for this release. The
com.sun.media.jai.codec package (formerly named
javax.media.jai.codec) continues not to be a committed part of JAI. These classes should continue to be considered provisional and exist only as helper classes for the JAI implementation.
Sun has submitted a JSR (Java Specification Request) for image I/O and will be developing a specification and a reference implementation under the Java Community Process. The results of this process will replace the temporary I/O helper classes shipped as part of this release in the
com.sun.media.jai.codec package. The JSR may be found at
http://java.sun.com/aboutJava/communityprocess/jsr/jsr_015_iio.html.
All operators outlined in the Java Advanced Imaging API specification are implemented in the 1.0.2 implementation.
Some known bugs exist - see the BUGS file for details.
The major areas of JAI functionality are described below:
Additionally, users may extend a number of non-image classes in order to add functionality to JAI:
BorderExtender may be used to obtain customized functionality.
Warp may be written to perform customized image warping.
Interpolation may be written to perform customized pixel interpolation.
Graphics2D-Style Drawing
TiledImageGraphics class provides the drawing functionality of the
Graphics2D class for images that are instances of the
TiledImage class. The
RenderableGraphics class provides a way to store a sequence of drawing commands and to "replay" them at an arbitrary output resolution.
ROI or
ROIShape object. These ROIs may be used as parameters to the
Extrema,
Mean or
Histogram operations and the
TiledImage.set and
TiledImage.setData methods. Operations produce an appropriate
ROI property on their output when one exists on their input.
Due to a bug in the FCS version of Java 1.2 (Java 2), initialization of a
ROIShape from an
Area is not performed correctly. This prevents methods such as
add(),
subtract(),
intersect(), and
exclusiveOr() from functioning correctly.
The classes dealing with image file handling (the
com.sun.media.jai.codec package and private implementation packages that provide support for it) have been separated into a new jar file,
jai_codec.jar. This jar file may be used separately from the
jai_core.jar file containing the
javax.media.jai,
javax.media.jai.iterator,
javax.media.jai.operator, and
javax.media.jai.widget packages as well as their supporting packages.
As described in the Core Functionality section of this document, the image codec classes should be considered as temporary helper functions. They will be replaced by a new API for image I/O that is to be defined under the Java Community Process.
The BMP reader can read Version 2.x, 3.x and some 4.x BMP images. BMP images with 1, 4, 8, 24 bits can be read with this reader. Support for 16 and 32 bit images has also been implemented, although such images are not very common.
Reading of compressed BMPs is supported.
BI_RGB,
BI_RLE8,
BI_RLE4 and
BI_BITFIELDS compressions are handled.
The BMP reader emits properties such as type of compression, bits per pixel etc. Use the
getPropertyNames() method to get the names of all the properties emitted.
BMP Limitations:
BMP Writer:
IndexColorModel with 2, 16, or 256 palette entries will be written in palette form. Compression is not supported.
The image view object is ignored, and image property information is not exported.
There is no FlashPIX writer.
GIF files are read using the JDK's internal reader. There is no GIF writer. Due to a bug in the AWT GIF decoder, GIFs with a transparent background will be decoded as if their background were black.
GIF files may not be read remotely, i.e., via
RemoteImage, on hosts without window system access as the reader uses the AWT toolkit which requires window system access.
com.sun.image.codec.jpeg package of the JDK. A set of simple JAI wrapper classes around these classes is provided.
com.sun.media.jai.codec.PNGDecodeParam and
PNGEncodeParam for more information.
Due to the limitations of the format, only images with 1 or 3 bands may be written.
TIFF support has the following limitations:
RasterAccessor class.
Source images with
ComponentColorModels and
IndexColorModels are supported.
DirectColorModel images are not yet supported.
Source images with
SampleModel types other than
ComponentSampleModel have not been extensively tested.
ComponentSampleModel/
ComponentColorModel sources are processed most efficiently by
RasterAccessor.
java.util.Collection is a collection of the same type. Nested collections are supported. Operators may also emit collections of their choice, or take collections as sources and emit a single image.
Note that the "fileload" operation may not be used to load images remotely if the image file is not visible to the client file system even if the file is visible to the server file system. Use the "URL" operation instead for this purpose. The "filestore" operation may however be used to store an image on a server to a file not visible from the client file system. The "filestore" and other "immediate" operations are rendered upon deserialization of the associated
RenderedOp and should not be created using
JAI.create() if they are to be processed remotely.
See section below for instructions on how to use remote imaging in JAI.
SnapshotImage provides an arbitrary number of synchronous views of a possibly changing
WritableRenderedImage.
The following image operators are implemented in this release. Only a brief description of each operator is provided here. For detailed information on these operators, refer to their full documentation, available at http://java.sun.com/products/java-media/jai/docs/index.html.
All operations are performed on a per-band basis, unless specified otherwise.
Java Advanced Imaging extends the imaging functionality provided in the Java 2D API, by providing a more flexible and scalable architecture, targeted for complex, high performance imaging requirements. The focus of this release is on providing a working implementation of the general framework for adding image-processing operators. We encourage you to play with the operators we have provided, to add your own operators, and to provide feedback to us on any problems or shortcomings with the general framework.
Java Advanced Imaging addresses imaging performance by providing C-based native code for some image operators, as well as the pure Java implementations. On Sun UltraSPARC-based platforms, additional performance is gained with hardware acceleration for those operators.
The following operators have native acceleration for at least some cases:
For more information on RMI (remote method invocation) please refer to: http://java.sun.com/products/jdk/rmi/index.html
1. Create a Security Policy File
If
$JAI is the base directory where Java Advanced Imaging is installed, create a text file named
$JAI/policy containing the following:
grant {
// Allow everything for now
permission java.security.AllPermission;
};
For more information on policy files and permissions please see:
http://java.sun.com/products/jdk/1.2/docs/guide/security/PolicyFiles.html http://java.sun.com/products/jdk/1.2/docs/guide/security/permissions.html
2. Start the RMI Registry
Log in to the remote machine where the image server will be running and start the RMI registry. For example, in the Solaris operating environment using a Bourne-compatible shell (e.g.,
/bin/sh):
$ unset CLASSPATH $ rmiregistry &
3. Start the JAI Remote Image Server
While still logged in to the remote server machine, set the
CLASSPATH and
LD_LIBRARY_PATH environment variables as required for JAI (see the INSTALL file) and start the remote imaging server:
| Point and Arithmetic Operators | ||
|---|---|---|
| absolute | Computes the absolute value of the pixels of an image. | |
| add | Adds the pixel values of two source images. | |
| addcollection | Adds a collection of images to one another. | |
| addconst | Adds a set of constant values to the pixel values of a source image. | |
| addconsttocollection | Adds a set of constant values to the pixel values of a Collection of source images. | |
| and | And's the pixel values of two source images. | |
| andconst | And's the pixel values of a source image with a set of constants. | |
| bandcombine | Computes a linear combination of the bands of an image. | |
| bandselect | Selects a subset of the bands of an image, possibly reordering them. | |
| clamp | Set all pixel values below the low value to that low value, set all the pixel values above the high value to that high value. | |
| colorconvert | Converts an image to a given ColorSpace. | |
| composite | Combines two images based on their alpha values at each pixel. | |
| constant | Creates an image with constant pixel values. | |
| divide | Divides the pixel values of the first source image by the pixel values of the second source image. | |
| dividebyconst | Divides the pixel values of a source image by a set of constants. | |
| divideintoconst | Divides a set of constants by the pixel values of a source image. | |
| exp | Computes the exponential of the pixel values of an image. | |
| format | Performs reformatting on an image, including data type casting, replacing the
SampleModel and ColorModel, and restructuring the tile grid.
|
|
| invert | Inverts the pixel values of an image. | |
| log | Computes the natural logarithm of the pixel values of an image. | |
| lookup | Performs general table lookup on an image. | |
| matchcdf | Performs a piecewise linear remapping of pixel values to match a given cumulative distribution function. | |
| max | Chooses the maximum pixel values between two images. | |
| min | Chooses the minimum pixel values between two images. | |
| multiply | Multiplies the pixel values of two source images. | |
| multiplyconst | Multiplies the pixel values of a source image by a set of constants. | |
| not | Inverts the pixel values of a source image. | |
| or | Or's the pixel values of two source images. | |
| orconst | Or's the pixel values of a source image with a set of constants. | |
| overlay | Overlays one image on top of another image. | |
| piecewise | Performs piecewise linear remapping of the pixel values of an image. | |
| rescale | Performs a linear remapping of the pixel values of an image. | |
| subtract | Subtracts the pixel values of one image from those of another. | |
| subtractconst | Subtracts a set of constant values from the pixel values of an image. | |
| subtractfromconst | Subtracts a set of constant values from the pixel values of an image. | |
| threshold | Maps the pixel values that fall between a low and high value to a set of constants. | |
| xor | Xor's the pixel values of two source images. | |
| xorconst | Xor's a source image with a set of constants. | |
| Area and Geometric operators | ||
| affine | Performs affine image mapping. | |
| border | Adds a border around an image. | |
| boxfilter | Convolves an image using a two-dimensional box filter. | |
| convolve | Performs an MxN image convolution. | |
| crop | Extracts a subarea of an image. | |
| gradientmagnitude | Performs edge detection using orthogonal gradient masks. | |
| medianfilter | Computes the median value of a pixel neighborhood. | |
| rotate | Rotates an image about an arbitrary point. | |
| scale | Scales and translates an image. | |
| shear | Shears an image. | |
| translate | Translates an image by an integral or fractional amount. | |
| transpose | Reflects an image in a specified direction or rotates an image in multiples of 90 degrees. | |
| warp | Performs geometric warping on an image. | |
| Frequency-domain, Transform, and Complex Operators | ||
| conjugate | Computes the complex conjugate of an image. | |
| dct | Computes the Discrete Cosine Transform of an image. | |
| dft | Computes the Discrete Fourier Transform of an image, possibly resulting in a complex image. | |
| dividecomplex | Computes the quotient of two complex images. | |
| idct | Computes the inverse Discrete Cosine Transform of an image. | |
| idft | Computes the inverse Discrete Fourier Transform of an image. | |
| magnitude | Computes the magnitude of a complex image. | |
| magnitudesquared | Computes the squared magnitude of a complex image. | |
| multiplycomplex | Computes the product of two complex images. | |
| periodicshift | Shifts an image periodically. | |
| phase | Computes the phase angle of a complex image. | |
| polartocomplex | Creates a complex image from two images representing magnitude and phase. | |
| Sourceless operators | ||
| imagefunction | Creates an image by evaluating a function. | |
| pattern | Creates an image consisting of a repeated pattern. | |
| File and Stream Operators | ||
| awtimage | Converts a java.awt.Image into a PlanarImage. | |
| bmp | Loads an image in BMP format. | |
| encode | Writes an image to an OutputStream. | |
| fileload | Loads an image from a file. | |
| filestore | Writes an image to a file in a given format. | |
| fpx | Loads an image in FlashPIX format. | |
| gif | Loads an image in GIF format. | |
| iip | Reads an image from a remote IIP server, performing IIP view transforms (affine, colortwist, filter, crop). | |
| iipresolution | Reads a single resolution of an image from a remote IIP server. | |
| jpeg | Loads an image in JPEG format. | |
| png | Loads an image in PNG 1.0 or 1.1 format. | |
| pnm | Loads an image in PBM, PGM, or PPM format. | |
| stream | Loads an image from a stream. | |
| tiff | Loads an image in TIFF 6.0 format. | |
| url | Loads an image from a URL. | |
| Statistical operators | ||
| extrema | Computes the maximum and minimum pixel values of an image. | |
| histogram | Computes the histogram of an image. | |
| mean | Computes the mean pixel value of a region of an image. | |
| Other Operators | ||
| errordiffusion | Performs error diffusion color quantization using a specified color map and error filter. | |
| ordereddither | Performs color quantization using a specified color map and a fixed dither mask. | |
| renderable | Constructs a
RenderableImage from a
RenderedImage source.
|
|
$ CLASSPATH=$JAI/lib/jai_core.jar:$JAI/lib/jai_codec.jar:\
$JAI/lib/mlibwrapper_jai.jar
$ export CLASSPATH
$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JAI/lib
$ export LD_LIBRARY_PATH
$ java \
-Djava.rmi.server.codebase=\
"file:$JAI/lib/jai_core.jar file:$JAI/lib/jai_codec.jar" \
-Djava.rmi.server.useCodebaseOnly=false \
-Djava.security.policy=file:$JAI/policy \
com.sun.media.jai.rmi.RMIImageImpl
|
||
For example, when the above steps are executed on a machine with IP address
123.456.78.90 the following is printed:
Server: using host 123.456.78.90 port 1099 Registering image server as "rmi://123.456.78.90:1099/RemoteImageServer". Server: Bound RemoteImageServer into the registry. |
Run the local application making sure that the
serverName parameter of any
RemoteImage constructors corresponds to the machine on which the remote image server is running. For example, if the machine with IP address
123.456.78.90 above is named
myserver the
serverName parameter of any
RemoteImage() constructors should be
"myserver".
The Java Advanced Imaging API White Paper, the HTML document of the API, and a programmer's guide "Programming in Java Advanced Imaging" as well as a quick-reference guide can be found at http://java.sun.com/products/java-media/jai/docs/
This section describes the significant changes and improvements to the Java Advanced Imaging API and its reference implementation since the previous release.
CLASSPATH and (on the Solaris Operating Environment)
LD_LIBRARY_PATH variables. The registry file has been renamed to
registryFile.jai and is installed into the
lib/ext directory of the JRE, along with the
jar files. A copy is present in the
jai_core.jar file as well, which is used if a separate file is not present or is unreadable.
NullPointerException was being thrown during attempts to access exception message strings.
RemoteImage may be used as the data source of another imaging chain without actually transferring data to the client machine.
ComponentSampleModelJAI:
bankIndices.
OperationRegistry:
ParameterBlockJAI:
null parameter values.
PlanarImage: Provide an error message in
getData if the size of the resulting buffer would be bigger than
Integer.MAX_VALUE.
RectIter:
SampleModel translation factors are now taken into account. The
ComponentSampleModel case has been sped up.
RenderedOp (and
CollectionOp): Fix
createInstance so it will "unfreeze" nodes as indicated.
TileCache:
TiledImage:
ColorModel using
PlanarImage.createColorModel() in secondary constructors. Fix a bug where floating point samples were being truncated to integers in
setData.
TileScheduler:
UntiledOpImage:
ScrollingImagePanel
com.sun.media.jai.codec package:
TIFFDecodeParam.decodeSigned16BitsTo8Bits
TIFFDirectory.isBigEndian
AddCollection:
Affine:
BandCombine:
BandSelect:
BoxFilter:
Border:
Constant:
Convolve:
Crop:
DCT:
DFT:
ErrorDiffusion:
FileLoad/FileStore:
Format:
SampleModel to be changed using
ImageLayout in
RenderingHints.
IIP:
IIPResolution:
MedianFilter:
PeriodicShift:
Rotate:
Scale:
Extrema,
Histogram,
Mean):
xPeriod and
yPeriod were not taken into account properly.
SubtractConst:
Transpose :
Warp:
SeekableStream
readLongLE() no longer loses upper 32 bits of 64-bit words.
ImageCodec
createGrayIndexColorModel() wherein the
blackIsZero parameter was being interpreted opposite to its intent.
BMP
JPEG
TIFF
The information below is included for historical reasons only. Versions of the Java Advanced Image API prior to the 1.0 version are unsupported and should not be used.
javax.media.jai.codec package has been renamed to
com.sun.media.jai.codec. See the
Core Functionality section for more information.
RenderableGraphics,
OperationDescriptor
MultiResolutionRenderableImage,
PropertyGenerator
OperationRegistry
CRIFJAI,
Coordinate,
CoordinateMapper,
PointMapper,
PropertyGeneratorImpl
Coordinate support will be considered for reintroduction in a future release of JAI.
RenderedImage and provides a renderable "view" of it.
Constant,
DCT,
DFT,
IDCT,
IDFT,
Magnitude,
Magnitudesquared,
Max,
Min,
Phase,
Transpose
JAI.create or
JAI.createNS methods, trailing parameters of an operation ParameterBlock may now be omitted. The parameters will be filled in with default values as specified by the
OperationDescriptor being used. If default values do not exist for one or more of the parameters, an exception will be thrown.
float in order to allow the operation to work in the Renderable layer.
setImageParamters,
addSource,
addSink,
removeSource,
removeSink. The
setSource(PlanarImage, int) and
getBounds2D methods have been removed from the API.
OpImage.computesUniqueTiles has been added in order to prevent incorrect optimization when using certain image sources.
null to indicate the absence of a default value for a parameter. Instead, a constant value of
NO_PARAMETER_DEFAULT is used. This allows the use of
null as a default value.
OperationDescriptor dealing with hints have been removed:
getHintClasses,
getHintKeys,
getHintDefaults. Methods to support renderable mode operation have been added:
getRenderableSourceClasses,
getRenderableDestClass,
validateRenderableArguments.
OperationDescriptor.getDefaultValue has had its name changed to
getParamDefaultValue.
registerOperationByName,
registerRIFByClassName,
registerCRIFByClassName,
registerCIFByClassName. These methods existed for convenience only and accordingly no functionality has been lost.
JAI class has had methods
createRenderableCollection and
createRenderableCollectionNS added.
RenderedOp class have been made private; accessor methods have been provided for them.
ContextualRenderedImageFactory (CRIF) for a single operation. The notions of product and preference for CRIFs have been removed.
PropertyGenerator.getProperty(String, RendererableOp),
PropertySource.getPropertySource(RenderableOp), and
RenderableOp.getOperationName.
ImageMIPMap class has been changed to remove the previous limitation on resolution selection.
Interpolation classes have been modified to simplify the implementation of subclasses.
Warp.warpRect describes the semantics in detail.
WarpPolynomial and
WarpGrid classes.
mapSourceRect method has been added to the
Warp class and its subclasses.
computeRect method is called per source tile, it is recommended that tile sizes be larger in order to reduce the overhead of calling
computeRect repeatedly.
IndexColorModels.
This split is preliminary; there may be additional changes to the jar file structure in the final release.
In package
javax.media.jai:
BorderExtender,
BorderExtenderConstant,
BorderExtenderCopy,
BorderExtenderReflect,
BorderExtenderWrap,
BorderExtenderZero,
CanvasJAI,
CollectionImageFactory,
ComponentSampleModelJAI,
FloatDoubleColorModel,
ImageFunction,
RasterFormatTag
In package
javax.media.jai.codec:
PNGEncodeParam,
PNGSuggestedPaletteEntry,
TIFFEncodeParam
In package
javax.media.jai.operator:
AddConstToCollectionDescriptor,
ColorConvertDescriptor,
ConjugateDescriptor,
CropDescriptor,
EncodeDescriptor,
FileStoreDescriptor,
GradientMagnitudeDescriptor,
ImageFunctionDescriptor,
MatchCDFDescriptor,
PeriodicShiftDescriptor,
PiecewiseDescriptor,
PolarToComplexDescriptor,
URLDescriptor
TileCache,
TileScheduler
In package
javax.media.jai:
DisplayOpImage,
FloatComponentSampleModel,
MultiSourceOpImage,
PixelChain,
PointLUTOpImage,
RenderingHintsJAI
In package
javax.media.jai.operator:
DilateDescriptor,
ErodeDescriptor,
FPXFileDescriptor,
SobelDescriptor
AddConstToCollection,
BoxFilter,
ColorConvert,
Conjugate,
CropDescriptor,
Encode,
FileStore,
GradientMagnitude,
ImageFunction,
MatchCDF,
PeriodicShift,
Piecewise,
PolarToComplex,
URL
DCT,
DFT,
Exp,
Extrema,
Gradient,
IDCT,
IDFT,
Log,
Shear
Absolute,
Add,
AddConst,
Affine,
And,
AndConst,
BandCombine,
BandSelect,
Clamp,
ColorConvert,
Composite,
Conjugate,
Constant,
Crop,
Divide,
DivideByConst,
DivideIntoConst,
DivideComplex,
Exp,
Format,
Invert,
Log,
Lookup,
MatchCDF,
Multiply,
MultiplyConst,
MultiplyComplex,
Not,
Or,
OrConst,
Overlay,
PeriodicShift,
Piecewise,
PolarToComplex,
Rescale,
Rotate,
Scale,
Subtract,
SubtractConst,
SubtractFromConst,
Threshold,
Translate,
Xor,
XorConst
RenderableOp.getProperty(String) is not implemented.
OpImage during construction has been improved to allow more control while at the same time producing better default behavior. See the documentation for the
OpImage constructor for details.
In particular, setting the output
SampleModel to have a data type with more range and/or precision than the source data type will cause the pixel processing to be done in the more precise data type.
IndexColorModel are dynamically expanded by the RasterAccessor class. The
BMP,
PNG,
PNM, and
TIFF image decoders may produce output with
IndexColorModels. Other codecs may do so in the future.
PointOpImage support in-place operations in order to conserve memory and reduce object construction overhead. The
PointOpImage.permitInPlaceOperation() method determines whether to allow such operations on a given image.
For debugging purposes, it is possible to disable all in-place operations by setting the Java system property
javax.media.jai.PointOpImage.InPlace to
false. This property may be removed in a future release.
TileCache and
TileScheduler are now interfaces. It is possible to use a rendering hint to specify the
TileCache instance to be used to hold the tiles from a given
OpImage.
The
TileCache interface now allows the capacity to be set in terms of a maximum number of tiles held and a maximum amount of memory associated with those tiles.
TileScheduler now performs multi-threading by default.
PlanarImage.getTiles and
prefetchTiles have been added to provide performance hints to the tile scheduler.
JAI class may now be instantiated. Each instance may reference a different
OperationRegistry and
TileCache and a different set of default rendering hints.
RasterAccessor.findCompatibleTag now takes a
SampleModel instead of a
Raster in order to allow the tag values to be reused.
RasterFormatTag is now a class rather than being represented by an enumerated value.
OpImage now has a method
getFormatTags that computes and caches a suitable
RasterFormatTag based on the source and destination image formats.
BorderExtenders has been added. A
BorderExtender provides a way to retrieve a portion of
PlanarImage that may extend beyond the normal boundaries of that image. The area outside the image is computed dynamically by the
BorderExtender. Two new methods on
PlanarImage,
getExtendedData and
copyExtendedData make use of a
BorderExtender argument.
OpImage now has a method hasExtender(int
sourceIndex) which indicates whether a
BorderExtender was supplied for the specified source image during construction.
ComponentSampleModelJAI and
FloatDoubleColorModel fix bugs and address limitations of the Java2D
ComponentSampleModel and
ComponentColorModel classes. The
RasterFactory class may be used to instantiate the new classes using familiar interfaces.
PlanarImage.createColorModel(RenderedImage) method has been removed. The
createColorModel(SampleModel) method has been extended to handle a greater variety of input
SampleModels.
OperationDescriptor now implements
java.io.Serializable.
OperationDescriptorImpl now includes a constant
NO_PARAMETER_DEFAULT that may be used by subclasses to indicate the lack of a default value for a given parameter. This change allows the use of
null as a parameter default. The logic in
OperationDescriptorImpl.validateParameters has been changed to make use of this mechanism.
A mechanism is being considered for the final release that would allow a variable number of arguments to be used for all operations.
RenderingHintsJAI now live in the
JAI class. The following rendering hint keys were added:
KEY_BORDER_EXTENDER,
KEY_ENCODE_PARAM,
KEY_OPERATION_REGISTRY,
KEY_OPERATION_BOUND,
KEY_TILE_CACHE
The following rendering hint key was removed:
KEY_PNG_EMIT_SQUARE_PIXELS
ImageLayout.unsetImageDimensions method has been renamed to
unsetImageBounds.
isPositivePowerOf2 and
nextPositivePowerOf2 methods have been removed from
UntiledOpImage.
RenderedOp was modified such that "immediate" operations, i.e., those which have an associated
OperationDescriptor the
isImmediate method of which returns
true, will be rendered upon deserialization. When creating an imaging graph for remote evaluation such operations should be created by explicitly constructing a
RenderedOp rather than invoking
JAI.create which will itself force evaluation of the operation.
RectIter.jumpLines and
jumpPixels now throw
IndexOutOfBoundsException when leaving the bounding rectangle of the iterator.
The method
Interpolation.create has been renamed to
Interpolation.getInstance. It now returns a previously created instance of the standard Interpolation subclasses.
InterpolationTable now requires the
dataH and
dataV constructor parameters to have the correct length.
ImageMIPMap and
ImagePyramid classes have been reworked.
ImageMIPMap now includes a
getAsRenderable method to produce a
RenderableImage based on the pyramid data.
The current implementation of
ImageMIPMap has a limitation of not allowing higher resolutions to be retrieved after retrieving lower levels.
OperationDescriptor contains new methods
isRenderedSupported, and
isRenderableSupported. These methods are used by the
JAI.createNS and
createRenderableNS methods to determine the suitability of the operation.
OperationDescriptor.isImmediate method, if it returns true, will force the
JAI.create method to immediately request a rendering of the operation rather than simply returning a
RenderedOp representing the operation.
Pattern operator takes a
RenderedImage as a source instead of a
Raster parameter.
ImageFunction interface for use by the
ImageFunction operation was added.
(Affine,
Rotate,
Scale,
Shear, and
Translate), were changed to produce an output image of a fixed size regardless of the type of interpolation being performed. If no
BorderExtender is specified, the edges of the output image will be left blank. If a
BorderExtender is specified, it will be used to provide additional source pixels as needed in order to fill in the entirety of the output.
KernelJAI.getRotatedKernel provides the rotated kernel.
ImageLayout hint is supplied, single-component complex imagery may be applied to multi-component imagery to generate a multi-component result.
ImageLayout hint; the default behavior has not been modified.
ImageDecodeParam object has been added to the
FileLoad,
FPX,
PNG,
Stream,
TIFF, and
URL operations. It is possible to omit this parameter or to set it to
null.
Encode and
FileStore operations take an
ImageEncodeParam object as a parameter. This parameter may be omitted or set to
null.
PropertyGenerators which set a
Boolean-valued property named "COMPLEX" have been added to the following operations: "dft", "idft", "magnitude", "phase", "magnitudesquared", "mutiplycomplex", "dividecomplex", "conjugate", "polartocomplex" and "imagefunction".
OperationDescriptors of the "dft" and "idft" operations to indicate whether the input and output image data are real or complex.
PNG decoder now performs gamma correction by default. The
PNGDecodeParam class has been updated to allow more control over the decoding process.
BMP decoder now emits 1, 4, and 8 bit images in packed format. The
BMP encoder now writes 1, 4, and 8 bit palette images as well as 24 bit truecolor images.
BMPEncodeParam class has been simplified.
PNG encoder has been added, along with a
PNGEncodeParam class. Another new class,
PNGSuggestedPaletteEntry, has been created for use by
PNGEncodeParam.
TIFFDecodeParam now allows the user to specify byte or short output for palette color images. The
TIFF decoder now handles G3, G4, and PackBits compressed bilevel images.
TIFF encoder has been added to perform baseline (non-compressed)
TIFF encoding. The
TIFFField class now has a public constructor.
getNumPages(),
decodeAsRaster(int page) and
decodeAsRenderedImage(int page) methods to
ImageDecoder.
ImageEncoder.encode(Raster) with
ImageEncoder.encode(Raster, ColorModel).
ImageCodec:
getCodecs(),
getDecoderNames(),
getEncoderNames(),
getEncodeParamClass(),
getDecodeParamClass(), and
canEncodeImage()
JPEGEncodeParam interface has been completely rewritten. This solves problems with color conversion in the previous release as well as providing an easier-to-use interface.
SampleDescriptor class has undergone the following changes:
null parameter indicating that the default
TileCache should be used.
int formatTag =
RasterAccessor.findCompatibleTag(sources, dest);
RasterAccessor srcAccessor =
new RasterAccessor(source, srcRect, formatTag);
RasterAccessor dstAccessor =
new RasterAccessor(dest, destRect, formatTag);
|
RasterFormatTag[] formatTags = getFormatTags();
RasterAccessor srcAccessor =
new RasterAccessor(sources[0], srcRect, formatTags[0],
getSource(0).getColorModel());
RasterAccessor dstAccessor =
new RasterAccessor(dest, destRect, formatTags[1],
getColorModel());
|
JAIExampleApp.java and
JAISamplePanel.java have undergone the following change. The line:
OperationRegistry or = JAI.getOperationRegistry();
OperationRegistry or = JAI.getDefaultInstance().getOperationRegistry();
JAIImageReader.java has undergone the following change. The line:
String[] names = ImageCodec.getCodecNames(stream);
String[] names = ImageCodec.getDecoderNames(stream);
JAIPatternPanel.java has undergone the following change. The "pattern" operation now takes a
RenderedImage source instead of a
Raster parameter.
JAIRotatePanel.java and
JAIScalePanel have undergone the following change. The
Interpolation.create method has had its name changed to
Interpolation.getInstance.
JAIWarpDemo.java has been changed to use the new coefficient order from the
Warp class.
ColorModel.
BorderExtender to be used.
FormatDemo.java has had the line:
String[] names = ImageCodec.getCodecNames(stream);
String[] names = ImageCodec.getDecoderNames(stream);
SamplePNMCodec has had the following methods added:
getEncodeParamClass getDecodeParamClass canEncodeImage
SamplePNMImageDecoder has had its
decodeAsRenderedImage method modified to take a 'page' argument, in accordance with its superclass.
getPropertyNames(String prefix) method of
SimpleRenderedImage has an implementation.
CollectionImage,
CollectionOp,
CoordinateImage,
IntegerSequence,
RasterFactory,
SequentialImage,
UntiledOpImage,
ByteArraySeekableStream,
FPXDecodeParam,
FileCacheSeekableStream,
FileSeekableStream,
ForwardSeekableStream,
MemoryCacheSeekableStream,
PNGDecodeParam,
SeekableStream,
SegmentedSeekableStream,
StreamSegment,
StreamSegmentMapper,
TIFFDecodeParam,
AddCollectionDescriptor,
DCTDescriptor,
DFTDescriptor,
FileLoadDescriptor,
IDCTDescriptor,
IDFTDescriptor,
OrderedDitherDescriptor
FormatRecognizer,
ImageCollection,
InputStreamOpImage,
OutputStreamOpImage,
RemoteImageImpl,
RemoteRenderedImage,
ContrastDescriptor,
FFTDescriptor,
FileDescriptor,
GIFFileDescriptor,
IFFTDescriptor,
PowConstDescriptor,
TIFFFileDescriptor
A C-based native library on Windows NT and 95
A C-based native library on Solaris
Hardware acceleration on UltraSPARC-based systems
These operators are:
Most native operators now support byte, short, int, float, and double data types.
All operators continue to have pure-Java implementations.
java.util.Collection for more about the concept of collections.
The output of a standard image operator on a collection is a collection of the same type. Nested collections are supported.
Operators may also emit collections of their choice, or take collections as sources and emit a single image by returning an appropriate result from the
OperationDescriptor.getDestClass() method.
javax.media.jai.RemoteImage class. A number of classes have been made
Serializable for use with
RemoteImage. See section above for details on how to use remote imaging.
javax.media.jai.codec package now contains a new set of classes including
SeekableStream and its subclasses. These classes are as follows:
SeekableStream: an abstract class combining the functionality of
InputStream and
RandomAccessFile, along with the ability to read primitive data types in little-endian format.
ByteArraySeekableStream: implements
SeekableStream functionality on data stored in an array of bytes.
FileSeekableStream: implements
SeekableStream functionality on data stored in a File.
ForwardSeekableStream: provides
SeekableStream functionality on data from an
InputStream with minimal overhead, but does not allow seeking backwards.
ForwardSeekableStream may be used with input formats that support streaming, avoiding the need to cache the input data.
FileCacheSeekableStream: provides
SeekableStream functionality on data from an
InputStream, using a cache file to allow seeking backwards.
MemoryCacheSeekableStream: provides
SeekableStream functionality on data from an
InputStream, using an
in-memory cache to allow seeking backwards.
MemoryCacheSeekableStream should be used when security or lack of access to local disk precludes the use of
FileCacheSeekableStream.
SegmentedSeekableStream: provides a contiguous view of non-contiguous source data.
StreamSegment and
StreamSegmentMapper: utility classes used with
SegmentedSeekableStream.
By adding the ability to seek to the usual streaming semantics of
InputStream, the codec architecture is greatly simplified.
Numerous other changes have occurred in the
java.media.jai.codec package, including extensions to the
ImageCodec class. The
FormatRecognizer class has been removed and its functionality subsumed by
ImageCodec.
float and
double.
OperationRegistry is more robust. Failure to load an operator is dealt with gracefully. It is therefore possible to run in pure-Java code only by not loading the native libraries.
Parameters are checked for validity earlier and more thoroughly, simplifying debugging.
PlanarImage.getMaxX() and
getMaxY() have been changed to return the index of the first row or column outside of the image. This usage is more consistent with other Java API classes including
java.awt.Rectangle.
OperationDescriptor.validateParameters() method has been changed to
validateArguments().
Number now use the
double datatype.
RasterFactory class to work around bugs in Java2D's
Raster creation methods. This class may be removed when Java2D is updated.
ROI.transform() methods that takes an Interpolation argument.
TIFFDirectory.getNumDirectories() to determine the number of images in a multipage TIFF file.
PlanarImage.getSplits() ignores image borders
A C-based native library on Windows NT and 95
A C-based native library on Solaris
Hardware acceleration on UltraSPARC-based systems
These operators are:
javax.media.jai.InputStreamOpImage, was added.
javax.media.jai.codec and the private implementations are in
com.sun.media.jai.codec. For example, to encode a JPEG file, you might use the following code:
RenderedImage im;
String filename;
FileOutputStream dst =
new FileOutputStream(filename);
ImageEncoder enc =
ImageCodec.createImageEncoder("JPEG",
dst, null);
enc.encode(im);
dst.close();
|
JPEG, BMP, and PNM formats may currently be written.
javax.media.jai.FormatRecognizer now exists. It may be subclassed and instances of its subclasses may be registered with the
OperationRegistry in order to automatically detect new file types when using the Stream and File operators.
javax.media.jai.operator.TIFFDescriptor class now specifies reading from an
InputStream instead of a
File.
javax.media.jai.operator.TIFFFileDescriptor, was added.
javax.media.jai.InterpolationBicubic2 is provided.
javax.media.jai.operator.TransposeDescriptor class was modified for better conformance with Java2D.
findNearestEntry() was added to
LookupTableJAI to find the nearest entry to a given pixel value. A subclass
javax.media.jai.ColorCube of
javax.media.jai.LookupTableJAI was also added to support faster processing in the error diffusion algorithm: finding the nearest color is considerably faster when the lookup table used is a color cube. The error diffusion implementation includes a single optimization for the case of a 3-band byte source image when a ColorCube is used for the color map and the error filter is the Floyd-Steinberg filter.
Double precision source images are not currently supported by the error diffusion operation. The
findNearestEntry() methods of
LookupTableJAI and
ColorCube do not yet support tables which are of other than byte data type.
getAsBufferedImage() method in
PlanarImage is now provided.
javax.media.jai.JAI class were changed.
writeToStream() in
OutputStreamOpImage was changed to allow it to throw
IOExceptions.
javax.media.jai.PlanarImage that create a suitable color model for a particular
SampleModel:
static ColorModel createColorModel(RenderedImage) static ColorModel createColorModel(SampleModel)
static int tileXtoX(int tx,
int tileGridXOffset,
int tileWidth)
static int tileYtoY(int ty,
int tileGridYOffset,
int tileHeight)
|
Warp class and its subclasses were improved. The hierarchy is now:
class javax.media.jai.Warp class javax.media.jai.WarpGrid class javax.media.jai.WarpPerspective class javax.media.jai.WarpPolynomial class javax.media.jai.WarpAffine class javax.media.jai.WarpCubic class javax.media.jai.WarpGeneralPolynomial class javax.media.jai.WarpQuadratic |
All
Warp subclasses now have two versions of the
WarpPoint,
WarpRect, and
WarpSparseRect classes. One version returns or fills in an int array of fixed-point warp positions, and the other uses a float array.
The
Warp class implements both versions of
WarpPoint and
WarpRect in terms of
WarpSparseRect. The integer version of
WarpSparseRect is implemented in terms of the float version.
The
WarpPolynomial subclasses were reorganized to leave
WarpPolynomial abstract, with a
WarpGeneralPolynomial class providing the implementation.
WarpAffine is now a subclass of
WarpPolynomial, and a
WarpCubic class has been added.
WarpAffine now has additional constructors using the same parameters as the other
WarpPolynomial subclasses.
All
WarpPolynomial classes now order the polynomial coefficients as follows:
1, x, y, x^2, x*y, y^2, ...
WarpPolynomial offers a static factory method createWarp() that takes a set of corresponding points in the source and destination coordinate systems and creates a "best-fit" instance of
WarpPolynomial. The fitting algorithm is implementation-dependent.
All
WarpPolynomial classes allow the specification of scale factors to be applied to the source and destination coordinates. Thus the result of a
WarpPolynomial may be described as:
dest_x =
post_scale_x*x_poly(source_x*pre_scale_x,
source_y*pre_scale_y
dest_y =
post_scale_y*y_poly(source_x*pre_scale_x,
source_y*pre_scale_y)
|
Raster and
SampleModel.
validateParameters() method was added to the
OperationDescriptor and
OperationDescriptorImpl classes. This method is responsible for determining if a given set of sources and parameters are allowed by the specification of an operation, independent of a particular implementation.
OpImage to create pixel-interleaved and banded
SampleModels.
mergeRunLengthList() method was added to the
ROI class. A version of
getAsRectangleList() was also added with a boolean argument mergeRectangles that causes the initial set of run length
Rectangles to be merged into a minimal set.
rectangleListToBitmask() was added to the
ROIShape class.
byte, unsigned
short, and
int data types. Support for signed
short,
float, and
double data types will be added in a future release.
