net.sourceforge.lentikit
Class Utils

java.lang.Object
  extended bynet.sourceforge.lentikit.Utils

public class Utils
extends java.lang.Object

Author:
ROWBOTTOM_A To change this generated comment edit the template variable "typecomment": Window>Preferences>Java>Templates. To enable and disable the creation of type comments go to Window>Preferences>Java>Code Generation.

Field Summary
static boolean PRESERVE_ASPECT_RATIO
           
 
Constructor Summary
Utils()
           
 
Method Summary
static java.awt.image.BufferedImage createBufferedImage(int x, int y, int typeHint)
          returns a BufferedImage of the desired size, it may use the typeHint but is not guaranteed to do so.
static double inchesToMeters(double inches)
          Simple method to convert incehs to Meters
static java.awt.image.BufferedImage readImage(java.io.File f)
          Returns a bufferedImage made from the file, can return null!
static void saveImageAsPNG(java.awt.image.BufferedImage image, java.io.File saveTo)
          Saves the image in PNG format to the specified file
static void saveImageAsPNG(java.awt.image.BufferedImage image, java.lang.String filename)
          Saves the image in PNG format to the specified file
static java.awt.image.BufferedImage scaleImage(java.awt.image.BufferedImage im, java.awt.Dimension destImageSize, boolean preserveAspectRatio)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRESERVE_ASPECT_RATIO

public static final boolean PRESERVE_ASPECT_RATIO
See Also:
Constant Field Values
Constructor Detail

Utils

public Utils()
Method Detail

readImage

public static final java.awt.image.BufferedImage readImage(java.io.File f)
                                                    throws java.io.IOException
Returns a bufferedImage made from the file, can return null!

Throws:
java.io.IOException

scaleImage

public static java.awt.image.BufferedImage scaleImage(java.awt.image.BufferedImage im,
                                                      java.awt.Dimension destImageSize,
                                                      boolean preserveAspectRatio)

createBufferedImage

public static java.awt.image.BufferedImage createBufferedImage(int x,
                                                               int y,
                                                               int typeHint)
returns a BufferedImage of the desired size, it may use the typeHint but is not guaranteed to do so. This utility method is provided for lentikit as a central place for trying out different types of BufferedImage to evaluate performance and memory usage. In addition it checks for OutOfMemoryError and displays a JOptionPane dialog, since buffered images are far and away the most greedy users of memory creating a BufferedImage is the most likely time to run out of memory.


inchesToMeters

public static double inchesToMeters(double inches)
Simple method to convert incehs to Meters


saveImageAsPNG

public static void saveImageAsPNG(java.awt.image.BufferedImage image,
                                  java.lang.String filename)
Saves the image in PNG format to the specified file


saveImageAsPNG

public static void saveImageAsPNG(java.awt.image.BufferedImage image,
                                  java.io.File saveTo)
Saves the image in PNG format to the specified file



Copyright © 2004 Sourceforge. All Rights Reserved.