public class ImagePack extends ImageBase implements java.lang.Iterable<java.awt.image.BufferedImage>
getImage()
method. The user can cycle through the images with the
cycle()
method.Modifier and Type | Field and Description |
---|---|
protected int |
currentImage
Image currently displayed, used for cycling through the images.
|
protected java.util.List<java.awt.image.BufferedImage> |
imageList
The images.
|
imageCache
Modifier | Constructor and Description |
---|---|
protected |
ImagePack()
Constructor for internal use.
|
|
ImagePack(java.awt.image.BufferedImage... images)
Creates a new set of images.
|
|
ImagePack(java.lang.String path,
java.lang.String... fileNames)
Creates a new set of images.
|
Modifier and Type | Method and Description |
---|---|
void |
addImage(java.awt.Image img)
Adds an image to the stack.
|
java.awt.Image |
cycle()
Cycle through the images.
|
void |
draw(java.awt.Graphics g,
java.awt.Point position,
java.awt.image.ImageObserver observer)
Draw the image at the given position.
|
java.awt.Dimension |
getDimension()
Dimension of the image.
|
java.awt.image.BufferedImage |
getImage()
Gets the current image.
|
java.awt.image.BufferedImage |
getImage(int index)
Gets the image at the given position.
|
java.util.Iterator<java.awt.image.BufferedImage> |
iterator() |
int |
size()
Number of the images stored.
|
loadImage, loadImage, toBufferedImage
protected int currentImage
protected java.util.List<java.awt.image.BufferedImage> imageList
protected ImagePack()
public ImagePack(java.awt.image.BufferedImage... images)
images
- to be storedpublic ImagePack(java.lang.String path, java.lang.String... fileNames)
path
- path to the imagefileNames
- names of the files to be loadedpublic void addImage(java.awt.Image img)
img
- the image.public java.awt.Image cycle()
public void draw(java.awt.Graphics g, java.awt.Point position, java.awt.image.ImageObserver observer)
ImageBase
public java.awt.Dimension getDimension()
ImageBase
getDimension
in class ImageBase
public java.awt.image.BufferedImage getImage()
public java.awt.image.BufferedImage getImage(int index)
index
- position of the imagepublic java.util.Iterator<java.awt.image.BufferedImage> iterator()
iterator
in interface java.lang.Iterable<java.awt.image.BufferedImage>
Iterable.iterator()
public int size()