com.croftsoft.core.awt.image
Class ImageLib

java.lang.Object
  extended by com.croftsoft.core.awt.image.ImageLib

public final class ImageLib
extends Object

Static method library for manipulating Image objects.

Since:
1997-02-14
Version:
$Id: ImageLib.java,v 1.2 2006/12/10 03:46:31 croft Exp $
Author:
David Wallace Croft

Method Summary
static Image crop(Image image, int x, int y, int w, int h, Applet applet)
           
static BufferedImage loadAutomaticImage(String imageFilename, int transparency, Component component, ClassLoader classLoader, Dimension dimension)
          Loads an automatic image from a resource file.
static BufferedImage loadBufferedImage(String imageFilename, ClassLoader classLoader)
           
static Dimension shrinkToFit(int imageWidth, int imageHeight, int graphicsWidth, int graphicsHeight)
           
static Rectangle shrinkToFitAndCenter(int imageWidth, int imageHeight, int graphicsWidth, int graphicsHeight)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

crop

public static Image crop(Image image,
                         int x,
                         int y,
                         int w,
                         int h,
                         Applet applet)

loadAutomaticImage

public static BufferedImage loadAutomaticImage(String imageFilename,
                                               int transparency,
                                               Component component,
                                               ClassLoader classLoader,
                                               Dimension dimension)
                                        throws IOException
Loads an automatic image from a resource file.

Parameters:
imageFilename - The path/filename of the resource image, usually within a JAR.
transparency - Transparency.BITMASK, .OPAQUE, or .TRANSLUCENT.
component - The image will be compatible with this Component.
classLoader - If null, component.getClass ( ).getClassLoader ( ) is used.
dimension - If null, the image will not be scaled.
Throws:
IOException

loadBufferedImage

public static BufferedImage loadBufferedImage(String imageFilename,
                                              ClassLoader classLoader)
                                       throws IOException
Throws:
IOException

shrinkToFit

public static Dimension shrinkToFit(int imageWidth,
                                    int imageHeight,
                                    int graphicsWidth,
                                    int graphicsHeight)

shrinkToFitAndCenter

public static Rectangle shrinkToFitAndCenter(int imageWidth,
                                             int imageHeight,
                                             int graphicsWidth,
                                             int graphicsHeight)

CroftSoft Javadoc

CroftSoft Core Javadoc (2008-09-28 20:58:02)