org.dishevelled.piccolo.sprite
Class Animations

java.lang.Object
  extended by org.dishevelled.piccolo.sprite.Animations

public final class Animations
extends Object

Static utility methods for creating animations.

Version:
$Revision$ $Date$
Author:
Michael Heuer

Method Summary
static MultipleFramesAnimation createAnimation(BufferedImage spriteSheet, int x, int y, int width, int height, int frames)
          Create and return a new multiple frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.
static SingleFrameAnimation createAnimation(File image)
          Create and return a new single frame animation from the specified image file.
static MultipleFramesAnimation createAnimation(File spriteSheet, int x, int y, int width, int height, int frames)
          Create and return a new multiple frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.
static MultipleFramesAnimation createAnimation(File baseImage, String suffix, int frames)
          Create and return a new multiple frames animation containing all the frame images specified from baseImage.
static SingleFrameAnimation createAnimation(Image image)
          Create and return a new single frame animation from the specified image.
static SingleFrameAnimation createAnimation(InputStream image)
          Create and return a new single frame animation from the specified image input stream.
static MultipleFramesAnimation createAnimation(InputStream spriteSheet, int x, int y, int width, int height, int frames)
          Create and return a new multiple frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.
static MultipleFramesAnimation createAnimation(List<Image> images)
          Create and return a new multiple frames animation containing the specified frame images.
static MultipleFramesAnimation createAnimation(String baseImage, String suffix, int frames)
          Create and return a new multiple frames animation containing all the frame images specified from baseImage.
static SingleFrameAnimation createAnimation(URL image)
          Create and return a new single frame animation from the specified image URL.
static MultipleFramesAnimation createAnimation(URL spriteSheet, int x, int y, int width, int height, int frames)
          Create and return a new multiple frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.
static MultipleFramesAnimation createAnimation(URL baseImage, String suffix, int frames)
          Create and return a new multiple frames animation containing all the frame images specified from baseImage.
static List<Image> createFrameList(BufferedImage spriteSheet, int x, int y, int width, int height, int frames)
          Create and return an unmodifiable list of frame images containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.
static List<Image> createFrameList(File spriteSheet, int x, int y, int width, int height, int frames)
          Create and return an unmodifiable list of frame images containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.
static List<Image> createFrameList(File baseImage, String suffix, int frames)
          Create and return an unmodifiable list of images containing all the frame images specified from baseImage.
static List<Image> createFrameList(InputStream spriteSheet, int x, int y, int width, int height, int frames)
          Create and return an unmodifiable list of frame images containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.
static List<Image> createFrameList(String baseImage, String suffix, int frames)
          Create and return an unmodifiable list of images containing all the frame images specified from baseImage.
static List<Image> createFrameList(URL spriteSheet, int x, int y, int width, int height, int frames)
          Create and return an unmodifiable list of frame images containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.
static List<Image> createFrameList(URL baseImage, String suffix, int frames)
          Create and return an unmodifiable list of images containing all the frame images specified from baseImage.
static LoopedFramesAnimation createLoopedAnimation(BufferedImage spriteSheet, int x, int y, int width, int height, int frames)
          Create and return a new looped frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.
static LoopedFramesAnimation createLoopedAnimation(File spriteSheet, int x, int y, int width, int height, int frames)
          Create and return a new looped frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.
static LoopedFramesAnimation createLoopedAnimation(File baseImage, String suffix, int frames)
          Create and return a new looped frames animation containing all the frame images specified from baseImage.
static LoopedFramesAnimation createLoopedAnimation(InputStream spriteSheet, int x, int y, int width, int height, int frames)
          Create and return a new looped frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.
static LoopedFramesAnimation createLoopedAnimation(List<Image> images)
          Create and return a new looped frames animation containing the specified frame images.
static LoopedFramesAnimation createLoopedAnimation(String baseImage, String suffix, int frames)
          Create and return a new looped frames animation containing all the frame images specified from baseImage.
static LoopedFramesAnimation createLoopedAnimation(URL spriteSheet, int x, int y, int width, int height, int frames)
          Create and return a new looped frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.
static LoopedFramesAnimation createLoopedAnimation(URL baseImage, String suffix, int frames)
          Create and return a new looped frames animation containing all the frame images specified from baseImage.
static BufferedImage createSpriteSheet(File baseImage, String suffix, int frames)
          Create and return a new sprite sheet image containing all of the specified frame images specified from baseImage assembled horizontally.
static BufferedImage createSpriteSheet(List<Image> frameImages)
          Create and return a new sprite sheet image containing all of the specified frame images assembled horizontally.
static BufferedImage createSpriteSheet(String baseImage, String suffix, int frames)
          Create and return a new sprite sheet image containing all of the specified frame images specified from baseImage assembled horizontally.
static BufferedImage createSpriteSheet(URL baseImage, String suffix, int frames)
          Create and return a new sprite sheet image containing all of the specified frame images specified from baseImage assembled horizontally.
static List<Image> flipHorizontally(List<Image> frameImages)
          Create and return an unmodifiable list of frame images containing all the frame images from frameImages in the same order flipped horizontally.
static List<Image> flipVertically(List<Image> frameImages)
          Create and return an unmodifiable list of frame images containing all the frame images from frameImages in the same order flipped vertically.
static List<Image> rotate(BufferedImage image, int steps)
          Create and return an unmodifiable list of frame images created by rotating around the center of specified image 2π/steps times.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createAnimation

public static SingleFrameAnimation createAnimation(InputStream image)
                                            throws IOException
Create and return a new single frame animation from the specified image input stream.

Parameters:
image - image input stream
Returns:
a new single frame animation from the specified image
Throws:
IOException - if an IO error occurs

createAnimation

public static SingleFrameAnimation createAnimation(File image)
                                            throws IOException
Create and return a new single frame animation from the specified image file.

Parameters:
image - image file
Returns:
a new single frame animation from the specified image
Throws:
IOException - if an IO error occurs

createAnimation

public static SingleFrameAnimation createAnimation(URL image)
                                            throws IOException
Create and return a new single frame animation from the specified image URL.

Parameters:
image - image URL
Returns:
a new single frame animation from the specified image
Throws:
IOException - if an IO error occurs

createAnimation

public static SingleFrameAnimation createAnimation(Image image)
Create and return a new single frame animation from the specified image.

Parameters:
image - image
Returns:
a new single frame animation from the specified image

createAnimation

public static MultipleFramesAnimation createAnimation(String baseImage,
                                                      String suffix,
                                                      int frames)
                                               throws IOException
Create and return a new multiple frames animation containing all the frame images specified from baseImage.

Parameters:
baseImage - base image file or URL name
suffix - image suffix
frames - number of frames
Returns:
a new multiple frames animation containing all the frame images specified from baseImage
Throws:
IOException - if an IO error occurs

createAnimation

public static MultipleFramesAnimation createAnimation(File baseImage,
                                                      String suffix,
                                                      int frames)
                                               throws IOException
Create and return a new multiple frames animation containing all the frame images specified from baseImage.

Parameters:
baseImage - base image file
suffix - image suffix
frames - number of frames
Returns:
a new multiple frames animation containing all the frame images specified from baseImage
Throws:
IOException - if an IO error occurs

createAnimation

public static MultipleFramesAnimation createAnimation(URL baseImage,
                                                      String suffix,
                                                      int frames)
                                               throws IOException
Create and return a new multiple frames animation containing all the frame images specified from baseImage.

Parameters:
baseImage - base image URL
suffix - image suffix
frames - number of frames
Returns:
a new multiple frames animation containing all the frame images specified from baseImage
Throws:
IOException - if an IO error occurs

createLoopedAnimation

public static LoopedFramesAnimation createLoopedAnimation(String baseImage,
                                                          String suffix,
                                                          int frames)
                                                   throws IOException
Create and return a new looped frames animation containing all the frame images specified from baseImage.

Parameters:
baseImage - base image file or URL name
suffix - image suffix
frames - number of frames
Returns:
a new looped frames animation containing all the frame images specified from baseImage
Throws:
IOException - if an IO error occurs

createLoopedAnimation

public static LoopedFramesAnimation createLoopedAnimation(File baseImage,
                                                          String suffix,
                                                          int frames)
                                                   throws IOException
Create and return a new looped frames animation containing all the frame images specified from baseImage.

Parameters:
baseImage - base image file
suffix - image suffix
frames - number of frames
Returns:
a new looped frames animation containing all the frame images specified from baseImage
Throws:
IOException - if an IO error occurs

createLoopedAnimation

public static LoopedFramesAnimation createLoopedAnimation(URL baseImage,
                                                          String suffix,
                                                          int frames)
                                                   throws IOException
Create and return a new looped frames animation containing all the frame images specified from baseImage.

Parameters:
baseImage - base image URL
suffix - image suffix
frames - number of frames
Returns:
a new looped frames animation containing all the frame images specified from baseImage
Throws:
IOException - if an IO error occurs

createAnimation

public static MultipleFramesAnimation createAnimation(InputStream spriteSheet,
                                                      int x,
                                                      int y,
                                                      int width,
                                                      int height,
                                                      int frames)
                                               throws IOException
Create and return a new multiple frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.

Parameters:
spriteSheet - sprite sheet input stream
x - starting location x
y - starting location y
width - frame width
height - frame height
frames - number of frames
Returns:
a new multiple frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames
Throws:
IOException - if an IO error occurs

createAnimation

public static MultipleFramesAnimation createAnimation(File spriteSheet,
                                                      int x,
                                                      int y,
                                                      int width,
                                                      int height,
                                                      int frames)
                                               throws IOException
Create and return a new multiple frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.

Parameters:
spriteSheet - sprite sheet file
x - starting location x
y - starting location y
width - frame width
height - frame height
frames - number of frames
Returns:
a new multiple frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames
Throws:
IOException - if an IO error occurs

createAnimation

public static MultipleFramesAnimation createAnimation(URL spriteSheet,
                                                      int x,
                                                      int y,
                                                      int width,
                                                      int height,
                                                      int frames)
                                               throws IOException
Create and return a new multiple frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.

Parameters:
spriteSheet - sprite sheet URL
x - starting location x
y - starting location y
width - frame width
height - frame height
frames - number of frames
Returns:
a new multiple frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames
Throws:
IOException - if an IO error occurs

createAnimation

public static MultipleFramesAnimation createAnimation(BufferedImage spriteSheet,
                                                      int x,
                                                      int y,
                                                      int width,
                                                      int height,
                                                      int frames)
Create and return a new multiple frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.

Parameters:
spriteSheet - sprite sheet image
x - starting location x
y - starting location y
width - frame width
height - frame height
frames - number of frames
Returns:
a new multiple frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames

createLoopedAnimation

public static LoopedFramesAnimation createLoopedAnimation(InputStream spriteSheet,
                                                          int x,
                                                          int y,
                                                          int width,
                                                          int height,
                                                          int frames)
                                                   throws IOException
Create and return a new looped frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.

Parameters:
spriteSheet - sprite sheet input stream
x - starting location x
y - starting location y
width - frame width
height - frame height
frames - number of frames
Returns:
a new looped frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames
Throws:
IOException - if an IO error occurs

createLoopedAnimation

public static LoopedFramesAnimation createLoopedAnimation(File spriteSheet,
                                                          int x,
                                                          int y,
                                                          int width,
                                                          int height,
                                                          int frames)
                                                   throws IOException
Create and return a new looped frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.

Parameters:
spriteSheet - sprite sheet file
x - starting location x
y - starting location y
width - frame width
height - frame height
frames - number of frames
Returns:
a new looped frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames
Throws:
IOException - if an IO error occurs

createLoopedAnimation

public static LoopedFramesAnimation createLoopedAnimation(URL spriteSheet,
                                                          int x,
                                                          int y,
                                                          int width,
                                                          int height,
                                                          int frames)
                                                   throws IOException
Create and return a new looped frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.

Parameters:
spriteSheet - sprite sheet URL
x - starting location x
y - starting location y
width - frame width
height - frame height
frames - number of frames
Returns:
a new looped frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames
Throws:
IOException - if an IO error occurs

createLoopedAnimation

public static LoopedFramesAnimation createLoopedAnimation(BufferedImage spriteSheet,
                                                          int x,
                                                          int y,
                                                          int width,
                                                          int height,
                                                          int frames)
Create and return a new looped frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.

Parameters:
spriteSheet - sprite sheet image
x - starting location x
y - starting location y
width - frame width
height - frame height
frames - number of frames
Returns:
a new looped frames animation containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames

createAnimation

public static MultipleFramesAnimation createAnimation(List<Image> images)
Create and return a new multiple frames animation containing the specified frame images.

Parameters:
images - list of frame images, must not be null
Returns:
a new multiple frames animation containing the specified frame images

createLoopedAnimation

public static LoopedFramesAnimation createLoopedAnimation(List<Image> images)
Create and return a new looped frames animation containing the specified frame images.

Parameters:
images - list of frame images, must not be null
Returns:
a new looped frames animation containing the specified frame images

createFrameList

public static List<Image> createFrameList(String baseImage,
                                          String suffix,
                                          int frames)
                                   throws IOException
Create and return an unmodifiable list of images containing all the frame images specified from baseImage.

Parameters:
baseImage - base image file or URL name
suffix - image suffix
frames - number of frames
Returns:
a new unmodifiable list of images containing all the frame images specified from baseImage
Throws:
IOException - if an IO error occurs

createFrameList

public static List<Image> createFrameList(File baseImage,
                                          String suffix,
                                          int frames)
                                   throws IOException
Create and return an unmodifiable list of images containing all the frame images specified from baseImage.

Parameters:
baseImage - base image file
suffix - image suffix
frames - number of frames
Returns:
a new unmodifiable list of images containing all the frame images specified from baseImage
Throws:
IOException - if an IO error occurs

createFrameList

public static List<Image> createFrameList(URL baseImage,
                                          String suffix,
                                          int frames)
                                   throws IOException
Create and return an unmodifiable list of images containing all the frame images specified from baseImage.

Parameters:
baseImage - base image URL
suffix - image suffix
frames - number of frames
Returns:
a new unmodifiable list of images containing all the frame images specified from baseImage
Throws:
IOException - if an IO error occurs

createFrameList

public static List<Image> createFrameList(InputStream spriteSheet,
                                          int x,
                                          int y,
                                          int width,
                                          int height,
                                          int frames)
                                   throws IOException
Create and return an unmodifiable list of frame images containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.

Parameters:
spriteSheet - sprite sheet input stream
x - starting location x
y - starting location y
width - frame width
height - frame height
frames - number of frames
Returns:
an unmodifiable list of frame images containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames
Throws:
IOException - if an IO error occurs

createFrameList

public static List<Image> createFrameList(File spriteSheet,
                                          int x,
                                          int y,
                                          int width,
                                          int height,
                                          int frames)
                                   throws IOException
Create and return an unmodifiable list of frame images containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.

Parameters:
spriteSheet - sprite sheet file
x - starting location x
y - starting location y
width - frame width
height - frame height
frames - number of frames
Returns:
an unmodifiable list of frame images containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames
Throws:
IOException - if an IO error occurs

createFrameList

public static List<Image> createFrameList(URL spriteSheet,
                                          int x,
                                          int y,
                                          int width,
                                          int height,
                                          int frames)
                                   throws IOException
Create and return an unmodifiable list of frame images containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.

Parameters:
spriteSheet - sprite sheet file
x - starting location x
y - starting location y
width - frame width
height - frame height
frames - number of frames
Returns:
an unmodifiable list of frame images containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames
Throws:
IOException - if an IO error occurs

createFrameList

public static List<Image> createFrameList(BufferedImage spriteSheet,
                                          int x,
                                          int y,
                                          int width,
                                          int height,
                                          int frames)
Create and return an unmodifiable list of frame images containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames.

Parameters:
spriteSheet - sprite sheet image
x - starting location x
y - starting location y
width - frame width
height - frame height
frames - number of frames
Returns:
an unmodifiable list of frame images containing all the frame images from spriteSheet as specified by the starting location (x, y) and read horizontally the specified number of frames

createSpriteSheet

public static BufferedImage createSpriteSheet(List<Image> frameImages)
Create and return a new sprite sheet image containing all of the specified frame images assembled horizontally.

Parameters:
frameImages - frame images, must not be null
Returns:
a new sprite sheet image containing all of the specified frame images assembled horizontally

createSpriteSheet

public static BufferedImage createSpriteSheet(String baseImage,
                                              String suffix,
                                              int frames)
                                       throws IOException
Create and return a new sprite sheet image containing all of the specified frame images specified from baseImage assembled horizontally.

Parameters:
baseImage - base image file or URL name
suffix - image suffix
frames - number of frames
Returns:
a new sprite sheet image containing all of the specified frame images specified from baseImage assembled horizontally
Throws:
IOException - if an IO error occurs

createSpriteSheet

public static BufferedImage createSpriteSheet(File baseImage,
                                              String suffix,
                                              int frames)
                                       throws IOException
Create and return a new sprite sheet image containing all of the specified frame images specified from baseImage assembled horizontally.

Parameters:
baseImage - base image file
suffix - image suffix
frames - number of frames
Returns:
a new sprite sheet image containing all of the specified frame images specified from baseImage assembled horizontally
Throws:
IOException - if an IO error occurs

createSpriteSheet

public static BufferedImage createSpriteSheet(URL baseImage,
                                              String suffix,
                                              int frames)
                                       throws IOException
Create and return a new sprite sheet image containing all of the specified frame images specified from baseImage assembled horizontally.

Parameters:
baseImage - base image URL
suffix - image suffix
frames - number of frames
Returns:
a new sprite sheet image containing all of the specified frame images specified from baseImage assembled horizontally
Throws:
IOException - if an IO error occurs

flipHorizontally

public static List<Image> flipHorizontally(List<Image> frameImages)
Create and return an unmodifiable list of frame images containing all the frame images from frameImages in the same order flipped horizontally.

Parameters:
frameImages - list of frame images, must not be null
Returns:
an unmodifiable list of frame images containing all the frame images from frameImages in the same order flipped horizontally

flipVertically

public static List<Image> flipVertically(List<Image> frameImages)
Create and return an unmodifiable list of frame images containing all the frame images from frameImages in the same order flipped vertically.

Parameters:
frameImages - list of frame images, must not be null
Returns:
an unmodifiable list of frame images containing all the frame images from frameImages in the same order flipped vertically

rotate

public static List<Image> rotate(BufferedImage image,
                                 int steps)
Create and return an unmodifiable list of frame images created by rotating around the center of specified image 2π/steps times.

Parameters:
image - image to rotate, must not be null
steps - number of steps
Returns:
an unmodifiable list of frame images created by rotating around the center of specified image 2π/steps times


Copyright (c) 2006-2011 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).