framework
Class Images

java.lang.Object
  extended by framework.Images

public class Images
extends Object

This class contains various methods for loading and manipulating images.


Constructor Summary
Images()
           
 
Method Summary
static BufferedImage createCompatibleImage(Image image)
          Optimise an image for high-speed drawing to the screen.
static BufferedImage createCompatibleImage(int width, int height, int transparency)
          Create a blank image optimised for high-speed drawing to the screen.
static void drawCentredImage(Graphics2D g, Image image, double x, double y)
           
static void drawRotatedImage(Graphics2D g, Image image, double x, double y, double radians)
           
static void drawTiledImage(Graphics2D g, Image image, int xOffset, int yOffset)
           
static void drawTiledImage(Graphics2D g, Image image, Shape drawArea, int xOffset, int yOffset)
           
static BufferedImage[] getFrames(File file)
           
static BufferedImage[] getFrames(File file, int count)
           
static BufferedImage[] getFrames(File file, int w, int h)
           
static BufferedImage[] getFrames(File file, int w, int h, int count)
           
static BufferedImage[] getFrames(InputStream stream)
           
static BufferedImage[] getFrames(InputStream stream, int count)
           
static BufferedImage[] getFrames(InputStream stream, int w, int h)
           
static BufferedImage[] getFrames(InputStream stream, int w, int h, int count)
           
static BufferedImage[] getFrames(URL url)
           
static BufferedImage[] getFrames(URL url, int count)
           
static BufferedImage[] getFrames(URL url, int w, int h)
           
static BufferedImage[] getFrames(URL url, int w, int h, int count)
           
static BufferedImage getImage(File file)
           
static BufferedImage getImage(InputStream stream)
           
static BufferedImage getImage(String file, Class c)
           
static BufferedImage getImage(URL url)
           
static int getTransparency(Image image)
          Get the transparency level of an image.
static BufferedImage[] rotate(Image[] images, double radians)
           
static BufferedImage[] rotate(Image[] images, double radians, boolean keepCorners)
           
static BufferedImage rotate(Image image, double radians)
           
static BufferedImage rotate(Image image, double radians, boolean keepCorners)
           
static BufferedImage[] split(BufferedImage image)
           
static BufferedImage[] split(BufferedImage image, int count)
           
static BufferedImage[] split(BufferedImage image, int w, int h)
           
static BufferedImage[] split(BufferedImage image, int w, int h, int count)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Images

public Images()
Method Detail

getImage

public static BufferedImage getImage(URL url)
                              throws IOException
Throws:
IOException

getImage

public static BufferedImage getImage(File file)
                              throws IOException
Throws:
IOException

getImage

public static BufferedImage getImage(InputStream stream)
                              throws IOException
Throws:
IOException

getImage

public static BufferedImage getImage(String file,
                                     Class c)
                              throws IOException
Throws:
IOException

split

public static BufferedImage[] split(BufferedImage image)

split

public static BufferedImage[] split(BufferedImage image,
                                    int count)

split

public static BufferedImage[] split(BufferedImage image,
                                    int w,
                                    int h)

split

public static BufferedImage[] split(BufferedImage image,
                                    int w,
                                    int h,
                                    int count)

getFrames

public static BufferedImage[] getFrames(URL url)
                                 throws IOException
Throws:
IOException

getFrames

public static BufferedImage[] getFrames(URL url,
                                        int count)
                                 throws IOException
Throws:
IOException

getFrames

public static BufferedImage[] getFrames(URL url,
                                        int w,
                                        int h)
                                 throws IOException
Throws:
IOException

getFrames

public static BufferedImage[] getFrames(URL url,
                                        int w,
                                        int h,
                                        int count)
                                 throws IOException
Throws:
IOException

getFrames

public static BufferedImage[] getFrames(File file)
                                 throws IOException
Throws:
IOException

getFrames

public static BufferedImage[] getFrames(File file,
                                        int count)
                                 throws IOException
Throws:
IOException

getFrames

public static BufferedImage[] getFrames(File file,
                                        int w,
                                        int h)
                                 throws IOException
Throws:
IOException

getFrames

public static BufferedImage[] getFrames(File file,
                                        int w,
                                        int h,
                                        int count)
                                 throws IOException
Throws:
IOException

getFrames

public static BufferedImage[] getFrames(InputStream stream)
                                 throws IOException
Throws:
IOException

getFrames

public static BufferedImage[] getFrames(InputStream stream,
                                        int count)
                                 throws IOException
Throws:
IOException

getFrames

public static BufferedImage[] getFrames(InputStream stream,
                                        int w,
                                        int h)
                                 throws IOException
Throws:
IOException

getFrames

public static BufferedImage[] getFrames(InputStream stream,
                                        int w,
                                        int h,
                                        int count)
                                 throws IOException
Throws:
IOException

rotate

public static BufferedImage rotate(Image image,
                                   double radians)

rotate

public static BufferedImage rotate(Image image,
                                   double radians,
                                   boolean keepCorners)

rotate

public static BufferedImage[] rotate(Image[] images,
                                     double radians)

rotate

public static BufferedImage[] rotate(Image[] images,
                                     double radians,
                                     boolean keepCorners)

drawTiledImage

public static void drawTiledImage(Graphics2D g,
                                  Image image,
                                  int xOffset,
                                  int yOffset)

drawTiledImage

public static void drawTiledImage(Graphics2D g,
                                  Image image,
                                  Shape drawArea,
                                  int xOffset,
                                  int yOffset)

drawCentredImage

public static void drawCentredImage(Graphics2D g,
                                    Image image,
                                    double x,
                                    double y)

drawRotatedImage

public static void drawRotatedImage(Graphics2D g,
                                    Image image,
                                    double x,
                                    double y,
                                    double radians)

createCompatibleImage

public static BufferedImage createCompatibleImage(Image image)
Optimise an image for high-speed drawing to the screen.

Parameters:
image - the original image
Returns:
an optimised copy of the image

createCompatibleImage

public static BufferedImage createCompatibleImage(int width,
                                                  int height,
                                                  int transparency)
Create a blank image optimised for high-speed drawing to the screen.

Parameters:
width - width of the created image
height - height of the created image
transparency - transparency level of the created image (java.awt.Transparency constant).
Returns:
an optimised new image of the correct size and transparency

getTransparency

public static int getTransparency(Image image)
Get the transparency level of an image.

Parameters:
image - the image
Returns:
One of the java.awt.Transparency constants