|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--javax.media.jai.remote.SerializableRenderedImage
A serializable wrapper class for classes which implement the
RenderedImage interface.
A SerializableRenderedImage provides a means to serialize
a RenderedImage. Transient fields are handled using
Serializers registered with SerializerFactory.
Two means are available for providing the wrapped
RenderedImage data to a remote version of a
SerializableRenderedImage object: either via deep copy or by
"on-demand" copying. If a deep copy is requested, the entire image
Raster is copied during object serialization and tiles are
extracted from it as needed using the Raster.createChild()
method. If a deep copy is not used, the image data are transmitted
"on-demand" using socket communications. If the request is made on the
local host, the image data are provided in both cases merely by forwarding
the request to the wrapped RenderedImage. Note that a single
SerializableRenderedImage object should be able to service
multiple remote hosts.
This class makes no guarantee as to the stability of the data of the
wrapped image, at least in the case where a deep copy is not made.
Consequently if the data of a RenderedImage change but
affected tiles have already been transmitted then the modifications will
not be visible remotely. For example, this implies that a
SerializableRenderedImage should not be used to wrap a
RenderedOp the data of which are subject to change if the
chain in which the node is present is edited. Instead the
SerializableRenderedImage should be used to wrap the image
returned by invoking either getRendering() or
createInstance() on the RenderedOp. A similar
situation will obtain if the wrapped image is a
WritableRenderedImage. If in this case the wrapped image
is also a PlanarImage, then the image returned by
createSnapshot() should be wrapped instead.
An example of the usage of this class is as follows:
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
public class SomeSerializableClass implements Serializable {
protected transient RenderedImage image;
// Fields omitted.
public SomeSerializableClass(RenderedImage image) {
this.image = image;
}
// Methods omitted.
// Serialization method.
private void writeObject(ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(new SerializableRenderedImage(image));
}
// Deserialization method.
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
in.defaultReadObject();
image = (RenderedImage)in.readObject();
}
}
RenderedImage,
WritableRenderedImage,
PlanarImage,
RenderedOp, Serialized Form| Constructor Summary | |
SerializableRenderedImage(RenderedImage source)
Constructs a SerializableRenderedImage wrapper for a
RenderedImage source. |
|
SerializableRenderedImage(RenderedImage source,
boolean useDeepCopy)
Constructs a SerializableRenderedImage wrapper for a
RenderedImage source. |
|
SerializableRenderedImage(RenderedImage source,
boolean useDeepCopy,
OperationRegistry registry,
String formatName,
TileCodecParameterList encodingParam,
TileCodecParameterList decodingParam)
Constructs a SerializableRenderedImage wrapper for a
RenderedImage source. |
|
| Method Summary | |
WritableRaster |
copyData(WritableRaster dest)
|
void |
dispose()
Provides a hint that an image will no longer be accessed from a reference in user space. |
protected void |
finalize()
If a deep copy is not being used, unset the data server availability flag and wait for the server thread to rejoin the current thread. |
ColorModel |
getColorModel()
|
Raster |
getData()
|
Raster |
getData(Rectangle rect)
|
int |
getHeight()
|
int |
getMinTileX()
|
int |
getMinTileY()
|
int |
getMinX()
|
int |
getMinY()
|
int |
getNumXTiles()
|
int |
getNumYTiles()
|
Object |
getProperty(String name)
|
String[] |
getPropertyNames()
|
SampleModel |
getSampleModel()
|
Vector |
getSources()
If this SerializableRenderedImage has not been
serialized, this method returns a Vector containing
only the RenderedImage passed to the constructor; if
this image has been deserialized, it returns null. |
Raster |
getTile(int tileX,
int tileY)
|
int |
getTileGridXOffset()
|
int |
getTileGridYOffset()
|
int |
getTileHeight()
|
int |
getTileWidth()
|
int |
getWidth()
|
| Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public SerializableRenderedImage(RenderedImage source,
boolean useDeepCopy,
OperationRegistry registry,
String formatName,
TileCodecParameterList encodingParam,
TileCodecParameterList decodingParam)
throws NotSerializableException
SerializableRenderedImage wrapper for a
RenderedImage source. Image data may be serialized
tile-by-tile or via a single deep copy. Tile encoding and
decoding may be effected via a TileEncoder and
TileDecoder specified by format name.
It may be noted that if the TileCodec utilizes
Serializers for encoding the image data, and none
is available for the DataBuffer of the supplied
image, an error/exception may be encountered.
source - The RenderedImage source.useDeepCopy - Whether a deep copy of the entire image Raster
will be made during object serialization.registry - The OperationRegistry to use in
creating the TileEncoder. The
TileDecoder will of necessity be
created using the default OperationRegistry
as the specified OperationRegistry is not
serialized. If null the default registry
will be used.formatName - The name of the format used to encode the data.
If null simple tile serialization will
be performed either directly or by use of a "raw"
TileCodec.encodingParam - The parameters to be used for data encoding. If
null the default encoding
TileCodecParameterList for this
format will be used. Ignored if
formatName is null.decodingParam - The parameters to be used for data decoding. If
null a complementary
TileCodecParameterList will be
derived from encodingParam. Ignored
if formatName is null.source
or formatName is null.Serializers
are available for the types of
SampleModel, and ColorModel
contained in the specified image.
public SerializableRenderedImage(RenderedImage source,
boolean useDeepCopy)
SerializableRenderedImage wrapper for a
RenderedImage source. Image data may be serialized
tile-by-tile or via a single deep copy. No TileCodec
will be used, i.e., data will be transmitted using the serialization
protocol for Rasters.source - The RenderedImage source.useDeepCopy - Whether a deep copy of the entire image Raster
will be made during object serialization.source
is null.Serializers
are available for the types of DataBuffer,
SampleModel, and ColorModel
contained in the specified image.public SerializableRenderedImage(RenderedImage source)
SerializableRenderedImage wrapper for a
RenderedImage source. Image data will be serialized
tile-by-tile if possible. No TileCodec
will be used, i.e., data will be transmitted using the serialization
protocol for Rasters.source - The RenderedImage source.source
is null.Serializers
are available for the types of DataBuffer,
SampleModel, and ColorModel
contained in the specified image.| Method Detail |
public WritableRaster copyData(WritableRaster dest)
public ColorModel getColorModel()
public Raster getData()
public Raster getData(Rectangle rect)
public int getHeight()
public int getMinTileX()
public int getMinTileY()
public int getMinX()
public int getMinY()
public int getNumXTiles()
public int getNumYTiles()
public Object getProperty(String name)
public String[] getPropertyNames()
public SampleModel getSampleModel()
public Vector getSources()
SerializableRenderedImage has not been
serialized, this method returns a Vector containing
only the RenderedImage passed to the constructor; if
this image has been deserialized, it returns null.
public Raster getTile(int tileX,
int tileY)
public int getTileGridXOffset()
public int getTileGridYOffset()
public int getTileHeight()
public int getTileWidth()
public int getWidth()
protected void finalize()
throws Throwable
public void dispose()
SerializableRenderedImage defines this method to
behave as follows:
The results of referencing an image after a call to
dispose() are undefined.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||