org.gerhardb.lib.image
Class ImageChangeUtil

java.lang.Object
  extended by org.gerhardb.lib.image.ImageChangeUtil

public class ImageChangeUtil
extends java.lang.Object


Method Summary
static float calcTheta(int fromWidth, int fromHeight, double toWidth, double toHeight)
          How to size the picture up or down to fit in the area given.
static float calcThetaDown(int fromWidth, int fromHeight, double toWidth, double toHeight)
          How to size the picture down to fit in the area given.
static float calcThetaUp(int fromWidth, int fromHeight, double toWidth, double toHeight)
          How to size the picture up to fit in the area given.
static float calcThetaWidth(int fromWidth, double toWidth)
          How to size the picture to fit a given width.
static java.awt.image.BufferedImage fitAspectDown(java.awt.image.BufferedImage image, int scaleWidth, int scaleHeight)
          Adjust image to fit in the given size maintaining the aspect ratio.
static java.awt.image.BufferedImage fitAspectFill(java.awt.image.BufferedImage image, int scaleWidth, int scaleHeight)
          Adjust image to fit in the given size maintaining the aspect ratio.
static java.awt.image.BufferedImage flip(java.awt.image.BufferedImage image)
           
static java.awt.image.BufferedImage resizeImageDown(java.awt.image.BufferedImage image, double toWidth, double toHeight)
           
static java.awt.image.BufferedImage rotateLeft(java.awt.image.BufferedImage image)
           
static java.awt.image.BufferedImage rotateRight(java.awt.image.BufferedImage image)
           
static java.awt.image.BufferedImage scale(java.awt.image.BufferedImage image, float scale)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

rotateRight

public static java.awt.image.BufferedImage rotateRight(java.awt.image.BufferedImage image)

rotateLeft

public static java.awt.image.BufferedImage rotateLeft(java.awt.image.BufferedImage image)

flip

public static java.awt.image.BufferedImage flip(java.awt.image.BufferedImage image)

scale

public static java.awt.image.BufferedImage scale(java.awt.image.BufferedImage image,
                                                 float scale)

fitAspectDown

public static java.awt.image.BufferedImage fitAspectDown(java.awt.image.BufferedImage image,
                                                         int scaleWidth,
                                                         int scaleHeight)
Adjust image to fit in the given size maintaining the aspect ratio. Only scales DOWN.

Parameters:
image - BufferedImage
width - int
height - int
Returns:
BufferedImage

fitAspectFill

public static java.awt.image.BufferedImage fitAspectFill(java.awt.image.BufferedImage image,
                                                         int scaleWidth,
                                                         int scaleHeight)
Adjust image to fit in the given size maintaining the aspect ratio. Will scale up or down.

Parameters:
image - BufferedImage
width - int
height - int
scaleUp - boolean If true, scale the image up to fit as well as down to fit.
Returns:
BufferedImage

resizeImageDown

public static java.awt.image.BufferedImage resizeImageDown(java.awt.image.BufferedImage image,
                                                           double toWidth,
                                                           double toHeight)
                                                    throws java.lang.Exception
Returns:
ResizedImage Returns null if the image did not need to be resized.
Throws:
java.lang.Exception

calcTheta

public static float calcTheta(int fromWidth,
                              int fromHeight,
                              double toWidth,
                              double toHeight)
How to size the picture up or down to fit in the area given. All of the picture will be shown with a best fit.


calcThetaWidth

public static float calcThetaWidth(int fromWidth,
                                   double toWidth)
How to size the picture to fit a given width.


calcThetaDown

public static float calcThetaDown(int fromWidth,
                                  int fromHeight,
                                  double toWidth,
                                  double toHeight)
How to size the picture down to fit in the area given.


calcThetaUp

public static float calcThetaUp(int fromWidth,
                                int fromHeight,
                                double toWidth,
                                double toHeight)
How to size the picture up to fit in the area given.



Copyright ? 2007 Gerhard Beck. All rights reserved. Subject to GPL.