net.sourceforge.hivegui.imaging
Class ImageTools

java.lang.Object
  extended by net.sourceforge.hivegui.imaging.ImageTools

public class ImageTools
extends java.lang.Object

Provides miscellaneous utility functions for handling images. There is no need to instantiate this class since it only provides static methods.

Author:
Jean-Francois Poilpret

Constructor Summary
protected ImageTools()
           
 
Method Summary
static java.awt.image.BufferedImage cloneImage(java.awt.image.BufferedImage source, int sourceType)
          Clone an image.
static java.awt.image.BufferedImage scaleImage(java.awt.image.BufferedImage source, int sourceType, double ratio)
          Scale an Image to a new size.
static java.awt.image.BufferedImage scaleImage(java.awt.image.BufferedImage source, int sourceType, int newSize)
          Scale an Image to a new size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageTools

protected ImageTools()
Method Detail

cloneImage

public static java.awt.image.BufferedImage cloneImage(java.awt.image.BufferedImage source,
                                                      int sourceType)
Clone an image.

Parameters:
source - original image to clone
sourceType - type of the source image (as defined in BufferedImage)
Returns:
a new image which is an exact copy of the source image

scaleImage

public static java.awt.image.BufferedImage scaleImage(java.awt.image.BufferedImage source,
                                                      int sourceType,
                                                      int newSize)
Scale an Image to a new size. The method keeps the aspect ratio of the original Image.

Parameters:
source - original image to scale down
sourceType - type of the source image (as defined in BufferedImage)
newSize - new size to which the image should be scaled
Returns:
a new image which is a scaled copy of the source image

scaleImage

public static java.awt.image.BufferedImage scaleImage(java.awt.image.BufferedImage source,
                                                      int sourceType,
                                                      double ratio)
Scale an Image to a new size. The method keeps the aspect ratio of the original Image.

Parameters:
source - original image to scale down
sourceType - type of the source image (as defined in BufferedImage)
ratio - scaling ratio
Returns:
a new image which is a scaled copy of the source image