Ableverse™
Platform 6.0

av.imageio
Class PassiveAnimationImage

java.lang.Object
  extended by av.imageio.PassiveAnimationImage
All Implemented Interfaces:
RenderedImage

public class PassiveAnimationImage
extends Object
implements RenderedImage

Some kinds of images such as GIF, may contain multiple frames and more meta information to represent animations, standard ImageIO only read their first frames currently, and the push model of image rendering since jdk1.0 is poor at animation image support.

This class tries to fill this blank by prerendering animation image frames at read time and dynamically supply different frames in a system time basis. The successfully read animation of this class relies on System.currentTimeMillis() return value, and calculate current frame as if it has been started from the first frame since midnight 1970-01-01.

Use IIO instead of ImageIO to read images potentially be an animation, and if the format is supported by this class, an instance of this class will be returned.

Currently only javax.imageio compatible GIF images are supported.

Author:
Compl

Field Summary
protected static int MINIMUM_DELAY
           
 
Constructor Summary
PassiveAnimationImage(IIOMetadata streamMeta, IIOImage firstFrame, Iterator<IIOImage> restFrames)
           
PassiveAnimationImage(IIOMetadata streamMeta, Iterator<IIOImage> frames)
           
 
Method Summary
 WritableRaster copyData(WritableRaster raster)
           
 BufferedImage getBackground()
           
 ColorModel getColorModel()
           
 BufferedImage getCurrentFrame()
           
 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<RenderedImage> getSources()
           
 Raster getTile(int tileX, int tileY)
           
 int getTileGridXOffset()
           
 int getTileGridYOffset()
           
 int getTileHeight()
           
 int getTileWidth()
           
 int getWidth()
           
static boolean supports(IIOMetadata streamMeta, IIOImage firstFrame)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINIMUM_DELAY

protected static final int MINIMUM_DELAY
See Also:
Constant Field Values
Constructor Detail

PassiveAnimationImage

public PassiveAnimationImage(IIOMetadata streamMeta,
                             Iterator<IIOImage> frames)

PassiveAnimationImage

public PassiveAnimationImage(IIOMetadata streamMeta,
                             IIOImage firstFrame,
                             Iterator<IIOImage> restFrames)
Method Detail

supports

public static boolean supports(IIOMetadata streamMeta,
                               IIOImage firstFrame)

getBackground

public BufferedImage getBackground()

getCurrentFrame

public BufferedImage getCurrentFrame()

getWidth

public int getWidth()
Specified by:
getWidth in interface RenderedImage

getHeight

public int getHeight()
Specified by:
getHeight in interface RenderedImage

getMinTileX

public int getMinTileX()
Specified by:
getMinTileX in interface RenderedImage

getMinTileY

public int getMinTileY()
Specified by:
getMinTileY in interface RenderedImage

getMinX

public int getMinX()
Specified by:
getMinX in interface RenderedImage

getMinY

public int getMinY()
Specified by:
getMinY in interface RenderedImage

getNumXTiles

public int getNumXTiles()
Specified by:
getNumXTiles in interface RenderedImage

getNumYTiles

public int getNumYTiles()
Specified by:
getNumYTiles in interface RenderedImage

getSources

public Vector<RenderedImage> getSources()
Specified by:
getSources in interface RenderedImage

getTileGridXOffset

public int getTileGridXOffset()
Specified by:
getTileGridXOffset in interface RenderedImage

getTileGridYOffset

public int getTileGridYOffset()
Specified by:
getTileGridYOffset in interface RenderedImage

getTileHeight

public int getTileHeight()
Specified by:
getTileHeight in interface RenderedImage

getTileWidth

public int getTileWidth()
Specified by:
getTileWidth in interface RenderedImage

getProperty

public Object getProperty(String name)
Specified by:
getProperty in interface RenderedImage

getPropertyNames

public String[] getPropertyNames()
Specified by:
getPropertyNames in interface RenderedImage

getSampleModel

public SampleModel getSampleModel()
Specified by:
getSampleModel in interface RenderedImage

getColorModel

public ColorModel getColorModel()
Specified by:
getColorModel in interface RenderedImage

copyData

public WritableRaster copyData(WritableRaster raster)
Specified by:
copyData in interface RenderedImage

getData

public Raster getData()
Specified by:
getData in interface RenderedImage

getData

public Raster getData(Rectangle rect)
Specified by:
getData in interface RenderedImage

getTile

public Raster getTile(int tileX,
                      int tileY)
Specified by:
getTile in interface RenderedImage

Ableverse™
Platform 6.0

Copyright© 2006 Ableverse Platform. All rights reserved.