org.homeunix.thecave.moss.util.image
Class ImageFunctions

java.lang.Object
  extended by org.homeunix.thecave.moss.util.image.ImageFunctions

public class ImageFunctions
extends java.lang.Object


Constructor Summary
ImageFunctions()
           
 
Method Summary
static java.awt.image.BufferedImage getImageFromComponent(java.awt.Component c)
          Get a BufferedImage representation of a component.
static java.awt.image.BufferedImage imageToBufferedImage(java.awt.Image img)
          Converts from Image to BufferedImage.
static java.awt.image.BufferedImage rotateImage(java.awt.image.BufferedImage img, int degrees)
          Rotates the given BufferedImage the specified number of degrees.
static java.awt.image.BufferedImage scaleImage(java.awt.image.BufferedImage img, int maxSize)
          Scales the image.
static java.awt.image.BufferedImage scaleImage(java.awt.image.BufferedImage img, int width, int height)
          Scales the image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageFunctions

public ImageFunctions()
Method Detail

scaleImage

public static java.awt.image.BufferedImage scaleImage(java.awt.image.BufferedImage img,
                                                      int maxSize)
Scales the image. Is relatively slow for large images, but should be fine for smaller ones.

Parameters:
img -
maxSize -
Returns:

scaleImage

public static java.awt.image.BufferedImage scaleImage(java.awt.image.BufferedImage img,
                                                      int width,
                                                      int height)
Scales the image. Is relatively slow for larger ones, but should be fine for smaller ones.

Parameters:
img -
width -
height -
Returns:

imageToBufferedImage

public static java.awt.image.BufferedImage imageToBufferedImage(java.awt.Image img)
Converts from Image to BufferedImage. To go the other direction, you can just cast BufferedImage as Image.

Parameters:
img - The Image to convert to BufferedImage
Returns:
A BufferedImage representation of the Image

rotateImage

public static java.awt.image.BufferedImage rotateImage(java.awt.image.BufferedImage img,
                                                       int degrees)
Rotates the given BufferedImage the specified number of degrees.

Parameters:
img - The BufferedImage to rotate
degrees - The number of degrees to rotate
Returns:
A rotated copy of the BufferedImage

getImageFromComponent

public static java.awt.image.BufferedImage getImageFromComponent(java.awt.Component c)
Get a BufferedImage representation of a component. This allows you to make 'screenshots' of components easily.

Parameters:
c - The component which you want an image of
Returns:
A BufferedImage of the given component