|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ngs.image.ImageSource
com.ngs.image.source.DefaultThumbnailSource
com.ngs.image.source.JAIImageSource
public abstract class JAIImageSource
An ImageSource that reads images using the JAI libraries from SeekableStream objects.
This class provides default implementations of page caching, pre-scaling of images, and converting JAI PlanarImages to BufferedImages. Classes that wish to make use of some or all of these features should extend this class, and implement the (using JAI) readStream(SeekableStream) method. In this method, RenderedOp objects should be packaged with the page number (ImageSource index) into ImagePage objects, and cached. JAI will lazily render (and cache) the Image to a BufferedImage. This class respects that.
Nested Class Summary | |
---|---|
protected static class |
JAIImageSource.ImagePage
Internal class that represents a single images in a multi-image document. |
Constructor Summary | |
---|---|
protected |
JAIImageSource()
Creates a new JAIImageSOurce |
Method Summary | |
---|---|
protected void |
cachePage(JAIImageSource.ImagePage ip)
Caches the given ImagePage. |
void |
close()
Clears the fileName (if one is set), and disposes and flushes any cached, rendered objects. |
void |
dispose()
Implements ImageSource. |
BufferedImage |
getImage(int index)
Implements ImageSource. |
int |
getImageCount()
Implements ImageSource. |
String |
getImageName()
Implements ImageSource. |
protected void |
open(com.sun.media.jai.codec.SeekableStream stream,
String name)
Opens the given Stream as the given name. |
protected abstract void |
readStream(com.sun.media.jai.codec.SeekableStream stream)
This readStream should parse the current stream and populate the imageCache with new ImagePage objects.. |
void |
setPreScale(float preScale)
If pre-scaling (using JAI) is desired, set the preScale (both x and y axis) here. |
Methods inherited from class com.ngs.image.source.DefaultThumbnailSource |
---|
getThumbnail |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected JAIImageSource()
Method Detail |
---|
public void dispose()
dispose
in class DefaultThumbnailSource
public void close()
public void setPreScale(float preScale)
preScale
- The multiplier to use when scaling x and y axis.protected void open(com.sun.media.jai.codec.SeekableStream stream, String name)
stream
- The stream to open.name
- The name of the streamprotected abstract void readStream(com.sun.media.jai.codec.SeekableStream stream) throws IOException
IOException
protected void cachePage(JAIImageSource.ImagePage ip)
public BufferedImage getImage(int index)
getImage
in class DefaultThumbnailSource
index
- The image to obtain from this ImageSource.
public int getImageCount()
getImageCount
in class DefaultThumbnailSource
public String getImageName()
getImageName
in class DefaultThumbnailSource
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |